Search code examples
iosreactjsnavigationreact-nativenavigator

What props can be passed to Navigator.push


I've been searching for about an hour now with 0 results to this question. I'm just looking for a list of the props that can be used when calling navigator.push, specifically how I can use the sceneConfig prop in the call, but a whole list would be really helpful. Of course like always Facebooks documentation is only half baked and quite vague.

What do I pass to navigator.push? I need all the keys and values for the object that could be passed into the function.


Solution

  • When calling Navigator.push, you can provide an argument that is an object with any number of keys and values. The navigator doesn't actually use the values in this for anything, it just gets passed along to your callbacks, renderScene and configureScene.

    The prop renderScene gets the object you called push with, allowing you to examine its contents and return the view you'd like to render.

    The prop configureScene gets the object you called push with, along with the other routes on the stack (the initialRoute prop, and any other objects you previously called push with and haven't popped). Here, you can return something from Navigator.SceneConfigs to describe how the route should animate