Skip to content

WARN Looks like you're passing an inline function for 'component' prop for the screen 'Home' (e.g. component={() => <SomeComponent />}). Passing an inline function will cause the component state to be lost on re-render and cause perf issues since it's re-created every render. You can pass the function as children to 'Screen' instead to achieve the desired behaviour. #21

@sebastianjung

Description

@sebastianjung

It seems that this piece of code:
return React.createElement(Stack.Screen, { key: name, name: name, component: C, options: Opts });
throws warnings in minified bundle.

Changing the code to the following, seems to resolve the issue.
return React.createElement(Stack.Screen, { key: name, name: name, options: Opts },(props) => <C {...props} />);

Any thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions