Last active
March 23, 2016 01:25
-
-
Save rt2zz/bedd70a4ee2d2ee2be74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// navbar can be specified per route declaratively in the corresponding routeDictionary | |
{ | |
testdrive: { | |
Component: Testdrive, | |
navbar: { | |
left: (routeProps, prevRouteProps) => prevRouteProps.title // can be function of props & routeStack | |
left: 'Active Drive' // or string | |
left: <SomeComponent /> // or component | |
middle: // ... same thing | |
right: // ... same thing | |
underlay: <UnderlayComponent /> | |
overlay: <OverlayComponent /> | |
} | |
} | |
} | |
// @IMPLEMENTATION this will passed along to the navbar via context too, but it will be standardized and abstracted away in the app navigator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// navbar can be imperatively set / overrode via context | |
// this is a little automagical, but also allows for unlimited flexibility including changing route title within one route (e.g. intentBuilder) | |
class SomeScene extends Component { | |
componentWillMount() { | |
this.context.navbar.set({ | |
left, | |
middle, | |
right, | |
//... | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment