In this example, we push the
UserProfile screen and pass two initial props to it:
passProps don't need to be serializable. You can use this mechanism to pass lambda functions or even React Components.
Handling passProps in static options
Each component can have a static options property which is used to configure the style properties of elements on the screen when that component is displayed.
Static options can either be a simple object, or a function which accepts
passProps as an argument. Sometimes when declaring components, not all style properties are known. For example, a user profile screen will usually have the user's name as the TopBar title text. Therefore the title must be configured dynamically when pushing the screen.
Following the code example above, lets see how to use props passed in the push command to set the TopBar title.
Notice that we're using the component
id in order to update props of this specific instance of the component.