Skip to content

Commit d275c30

Browse files
Merge pull request #24 from AlexGustafsson/exposed-sceneConfig
Exposed scene config
2 parents d66de28 + 7460b95 commit d275c30

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,21 @@ The **`this.props.toRoute()`** callback prop takes one parameter (a JavaScript o
9696
- `leftCorner`: Specify a component to render on the left side of the navigation bar (like the "Add people"-button on the first page of the Twitter app)
9797
- `rightCorner`: Specify a component to render on the right side of the navigation bar
9898
- `titleComponent`: Specify a component to replace the title. This could for example be your logo (as in the first page of the Instagram app)
99-
- `headerStyle`: change the style of your header for the new route. You could for example specify a new backgroundColor and the router will automatically make a nice transition from one color to the other!
99+
- `headerStyle`: Change the style of your header for the new route. You could for example specify a new backgroundColor and the router will automatically make a nice transition from one color to the other!
100100
- `passProps`: Takes in an object. Passes each `key: value` pair to your component as a prop. i.e. <Component key={value} />
101-
- `trans`: if you set trans to `true` it will make the navbar transparent and move your component content so that it sits behind the nav.
102-
- `leftCornerProps`: if you set a `leftCorner` component you can use this property to pass props to that component.
103-
- `rightCornerProps`: if you set a `rightCorner` component you can use this property to pass props to that component.
101+
- `trans`: If you set trans to `true` it will make the navbar transparent and move your component content so that it sits behind the nav.
102+
- `leftCornerProps`: If you set a `leftCorner` component you can use this property to pass props to that component.
103+
- `rightCornerProps`: If you set a `rightCorner` component you can use this property to pass props to that component.
104+
- `sceneConfig`: Control the animation of the route being switched. Possible values are:
105+
- Navigator.SceneConfigs.FadeAndroid
106+
- Navigator.SceneConfigs.FloatFromBottom
107+
- Navigator.SceneConfigs.FloatFromBottomAndroid
108+
- Navigator.SceneConfigs.FloatFromLeft
109+
- Navigator.SceneConfigs.FloatFromRight
110+
- Navigator.SceneConfigs.HorizontalSwipeJump
111+
- Navigator.SceneConfigs.PushFromRight
112+
- Navigator.SceneConfigs.VerticalDownSwipeJump
113+
- Navigator.SceneConfigs.VerticalUpSwipeJump
104114

105115
The **`this.props.replaceRoute`** takes in an object that can contain the same keys as `toRoute()`. The difference is that instead of adding a route to your stack, it replaces the route
106116
that you're on with the new route that you pass it.

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ var Router = React.createClass({
6262
this.props.customAction(opts);
6363
},
6464

65+
configureScene: function(route) {
66+
return route.sceneConfig || Navigator.SceneConfigs.FloatFromRight;
67+
},
68+
6569
renderScene: function(route, navigator) {
6670

6771
var goForward = function(route) {
@@ -205,6 +209,7 @@ var Router = React.createClass({
205209
navigationBar={navigationBar}
206210
renderScene={this.renderScene}
207211
onWillFocus={this.onWillFocus}
212+
configureScene={this.configureScene}
208213
/>
209214
)
210215
}

0 commit comments

Comments
 (0)