Clean up APIs.

Reviewed By: ericvicenti

Differential Revision: D3010136

fb-gh-sync-id: 310864450bfc86ebc2d696f8ef4876b14fa3a57f
shipit-source-id: 310864450bfc86ebc2d696f8ef4876b14fa3a57f
This commit is contained in:
Hedger Wang
2016-03-04 14:57:31 -08:00
committed by Facebook Github Bot 7
parent fbef6f6893
commit 71e59761c9
23 changed files with 788 additions and 730 deletions
@@ -49,6 +49,7 @@ function reduceNavigationState(initialState) {
const ExampleReducer = reduceNavigationState({
index: 0,
key: 'exmaple',
children: [{key: 'First Route'}],
});
@@ -56,12 +57,13 @@ class NavigationCardStackExample extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {isHorizontal: true};
}
componentWillMount() {
this._renderNavigation = this._renderNavigation.bind(this);
this._renderScene = this._renderScene.bind(this);
this._toggleDirection = this._toggleDirection.bind(this);
this.state = {isHorizontal: true};
}
render() {
@@ -86,8 +88,7 @@ class NavigationCardStackExample extends React.Component {
);
}
_renderScene(props) {
const {navigationParentState, onNavigate} = props;
_renderScene(/*NavigationSceneRendererProps*/ props) {
return (
<ScrollView style={styles.scrollView}>
<NavigationExampleRow
@@ -99,21 +100,21 @@ class NavigationCardStackExample extends React.Component {
onPress={this._toggleDirection}
/>
<NavigationExampleRow
text={'route = ' + props.navigationState.key}
text={'route = ' + props.scene.navigationState.key}
/>
<NavigationExampleRow
text="Push Route"
onPress={() => {
onNavigate({
props.onNavigate({
type: 'push',
key: 'Route ' + navigationParentState.children.length,
key: 'Route ' + props.scenes.length,
});
}}
/>
<NavigationExampleRow
text="Pop Route"
onPress={() => {
onNavigate({
props.onNavigate({
type: 'pop',
});
}}