- [ReactNative] Rename JSNavigationStack to ReactNavigator, rename scene config | Eric Vicenti

This commit is contained in:
Christopher Chedeau 2015-03-24 20:33:17 -07:00
parent 57337cb3e4
commit 39304ab06b
14 changed files with 163 additions and 157 deletions

View File

@ -6,7 +6,7 @@
'use strict'; 'use strict';
var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar'); var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar');
var JSNavigationStack = require('JSNavigationStack'); var ReactNavigator = require('ReactNavigator');
var React = require('React'); var React = require('React');
var StyleSheet = require('StyleSheet'); var StyleSheet = require('StyleSheet');
var ScrollView = require('ScrollView'); var ScrollView = require('ScrollView');
@ -16,8 +16,6 @@ var Text = require('Text');
var TouchableBounce = require('TouchableBounce'); var TouchableBounce = require('TouchableBounce');
var View = require('View'); var View = require('View');
var SAMPLE_TEXT = 'Top Pushes. Middle Replaces. Bottom Pops.'; var SAMPLE_TEXT = 'Top Pushes. Middle Replaces. Bottom Pops.';
var _getRandomRoute = function() { var _getRandomRoute = function() {
@ -187,7 +185,7 @@ var BreadcrumbNavSample = React.createClass({
onPress={this.onTabSelect.bind(this, 0)} onPress={this.onTabSelect.bind(this, 0)}
icon={require('image!madman_tabnav_list')} icon={require('image!madman_tabnav_list')}
title="One"> title="One">
<JSNavigationStack <ReactNavigator
debugOverlay={false} debugOverlay={false}
style={[styles.appContainer]} style={[styles.appContainer]}
initialRoute={initialRoute} initialRoute={initialRoute}
@ -204,8 +202,8 @@ var BreadcrumbNavSample = React.createClass({
onPress={this.onTabSelect.bind(this, 1)} onPress={this.onTabSelect.bind(this, 1)}
icon={require('image!madman_tabnav_create')} icon={require('image!madman_tabnav_create')}
title="Two"> title="Two">
<JSNavigationStack <ReactNavigator
animationConfigRouteMapper={() => JSNavigationStack.AnimationConfigs.FloatFromBottom} configureScene={() => ReactNavigator.SceneConfigs.FloatFromBottom}
debugOverlay={false} debugOverlay={false}
style={[styles.appContainer]} style={[styles.appContainer]}
initialRoute={initialRoute} initialRoute={initialRoute}

View File

@ -5,7 +5,7 @@
*/ */
'use strict'; 'use strict';
var JSNavigationStack = require('JSNavigationStack'); var ReactNavigator = require('ReactNavigator');
var React = require('React'); var React = require('React');
var StyleSheet = require('StyleSheet'); var StyleSheet = require('StyleSheet');
var ScrollView = require('ScrollView'); var ScrollView = require('ScrollView');
@ -132,7 +132,7 @@ var JumpingNavSample = React.createClass({
render: function() { render: function() {
return ( return (
<JSNavigationStack <ReactNavigator
debugOverlay={false} debugOverlay={false}
style={[styles.appContainer]} style={[styles.appContainer]}
initialRoute={INIT_ROUTE} initialRoute={INIT_ROUTE}

View File

@ -5,7 +5,7 @@
*/ */
'use strict'; 'use strict';
var JSNavigationStack = require('JSNavigationStack'); var ReactNavigator = require('ReactNavigator');
var NavigationBar = require('NavigationBar'); var NavigationBar = require('NavigationBar');
var React = require('React'); var React = require('React');
var StyleSheet = require('StyleSheet'); var StyleSheet = require('StyleSheet');
@ -70,7 +70,7 @@ var NavigationBarSample = React.createClass({
render: function() { render: function() {
return ( return (
<View style={styles.appContainer}> <View style={styles.appContainer}>
<JSNavigationStack <ReactNavigator
debugOverlay={false} debugOverlay={false}
style={styles.appContainer} style={styles.appContainer}
initialRoute={newRandomRoute()} initialRoute={newRandomRoute()}

View File

@ -6,7 +6,7 @@
'use strict'; 'use strict';
var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar'); var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar');
var JSNavigationStack = require('JSNavigationStack'); var ReactNavigator = require('ReactNavigator');
var React = require('React'); var React = require('React');
var ScrollView = require('ScrollView'); var ScrollView = require('ScrollView');
var StyleSheet = require('StyleSheet'); var StyleSheet = require('StyleSheet');
@ -90,7 +90,7 @@ var SecondDeepRouteMapper = (route, navigator) => (
<Text style={styles.buttonText}>Push Horizontal</Text> <Text style={styles.buttonText}>Push Horizontal</Text>
</View> </View>
</TouchableBounce> </TouchableBounce>
<JSNavigationStack <ReactNavigator
style={styles.thirdDeepNavigator} style={styles.thirdDeepNavigator}
initialRoute={{title: '3x Nested Horizontal'}} initialRoute={{title: '3x Nested Horizontal'}}
renderScene={ThirdDeepRouteMapper} renderScene={ThirdDeepRouteMapper}
@ -111,7 +111,7 @@ var FirstDeepRouteMapper = (route, navigator) => (
<Text style={styles.buttonText}>Push Outer Vertical Stack</Text> <Text style={styles.buttonText}>Push Outer Vertical Stack</Text>
</View> </View>
</TouchableBounce> </TouchableBounce>
<JSNavigationStack <ReactNavigator
style={styles.secondDeepNavigator} style={styles.secondDeepNavigator}
initialRoute={{title: '2x Nested Horizontal Nav'}} initialRoute={{title: '2x Nested Horizontal Nav'}}
renderScene={SecondDeepRouteMapper} renderScene={SecondDeepRouteMapper}
@ -132,9 +132,9 @@ var NestedBreadcrumbNavSample = React.createClass({
var initialRoute = {title: 'Vertical'}; var initialRoute = {title: 'Vertical'};
// No navigation bar. // No navigation bar.
return ( return (
<JSNavigationStack <ReactNavigator
style={[styles.appContainer]} style={[styles.appContainer]}
animationConfigRouteMapper={() => JSNavigationStack.AnimationConfigs.FloatFromBottom} configureScene={() => ReactNavigator.SceneConfigs.FloatFromBottom}
initialRoute={initialRoute} initialRoute={initialRoute}
renderScene={FirstDeepRouteMapper} renderScene={FirstDeepRouteMapper}
/> />

View File

@ -4,7 +4,7 @@
'use strict'; 'use strict';
var React = require('React'); var React = require('React');
var JSNavigationStack = require('JSNavigationStack'); var ReactNavigator = require('ReactNavigator');
var StyleSheet = require('StyleSheet'); var StyleSheet = require('StyleSheet');
var Text = require('Text'); var Text = require('Text');
var ScrollView = require('ScrollView'); var ScrollView = require('ScrollView');
@ -35,7 +35,7 @@ class NavMenu extends React.Component {
<TouchableHighlight style={styles.button} onPress={() => { <TouchableHighlight style={styles.button} onPress={() => {
this.props.onExampleExit(); this.props.onExampleExit();
}}> }}>
<Text style={styles.buttonText}>Exit JSNavigationStack Example</Text> <Text style={styles.buttonText}>Exit ReactNavigator Example</Text>
</TouchableHighlight> </TouchableHighlight>
</ScrollView> </ScrollView>
); );
@ -45,7 +45,7 @@ class NavMenu extends React.Component {
var TabBarExample = React.createClass({ var TabBarExample = React.createClass({
statics: { statics: {
title: '<JSNavigationStack>', title: '<ReactNavigator>',
description: 'JS-implemented navigation', description: 'JS-implemented navigation',
}, },
@ -69,11 +69,11 @@ var TabBarExample = React.createClass({
render: function() { render: function() {
return ( return (
<JSNavigationStack <ReactNavigator
style={styles.container} style={styles.container}
initialRoute={{ id: 'menu', }} initialRoute={{ id: 'menu', }}
renderScene={this.renderScene} renderScene={this.renderScene}
animationConfigRouteMapper={(route) => JSNavigationStack.AnimationConfigs.FloatFromBottom} configureScene={(route) => ReactNavigator.SceneConfigs.FloatFromBottom}
/> />
); );
}, },

View File

@ -21,7 +21,7 @@ var {
TouchableHighlight, TouchableHighlight,
View, View,
} = React; } = React;
var JSNavigationStackExample = require('./JSNavigationStack/JSNavigationStackExample'); var ReactNavigatorExample = require('./ReactNavigator/ReactNavigatorExample');
var createExamplePage = require('./createExamplePage'); var createExamplePage = require('./createExamplePage');
@ -33,7 +33,7 @@ var COMPONENTS = [
require('./ListViewSimpleExample'), require('./ListViewSimpleExample'),
require('./MapViewExample'), require('./MapViewExample'),
require('./NavigatorIOSExample'), require('./NavigatorIOSExample'),
JSNavigationStackExample, ReactNavigatorExample,
require('./PickerExample'), require('./PickerExample'),
require('./ScrollViewExample'), require('./ScrollViewExample'),
require('./SliderIOSExample'), require('./SliderIOSExample'),
@ -146,9 +146,9 @@ class UIExplorerList extends React.Component {
} }
_onPressRow(example) { _onPressRow(example) {
if (example === JSNavigationStackExample) { if (example === ReactNavigatorExample) {
this.props.onExternalExampleRequested( this.props.onExternalExampleRequested(
JSNavigationStackExample ReactNavigatorExample
); );
return; return;
} }

View File

@ -17,36 +17,42 @@ var {
View, View,
} = React; } = React;
var UIExplorerBlock = require('./UIExplorerBlock'); var styles = StyleSheet.create({
var UIExplorerPage = require('./UIExplorerPage'); box: {
backgroundColor: '#527FE4',
var ViewExample = React.createClass({ borderColor: '#000033',
statics: { borderWidth: 1,
title: '<View>', }
description: 'Basic building block of all UI.' });
},
getInitialState: function() {
return {
textBorderExampleHeight: 20,
};
},
exports.title = '<View>';
exports.description = 'Basic building block of all UI.';
exports.displayName = 'ViewExample';
exports.examples = [
{
title: 'Background Color',
render: function() { render: function() {
return ( return (
<UIExplorerPage title={this.props.navigator ? null : '<View>'}>
<UIExplorerBlock title="Background Color">
<View style={{backgroundColor: '#527FE4', padding: 5}}> <View style={{backgroundColor: '#527FE4', padding: 5}}>
<Text style={{fontSize: 11}}> <Text style={{fontSize: 11}}>
Blue background Blue background
</Text> </Text>
</View> </View>
</UIExplorerBlock> );
<UIExplorerBlock title="Border"> },
}, {
title: 'Border',
render: function() {
return (
<View style={{borderColor: '#527FE4', borderWidth: 5, padding: 10}}> <View style={{borderColor: '#527FE4', borderWidth: 5, padding: 10}}>
<Text style={{fontSize: 11}}>5px blue border</Text> <Text style={{fontSize: 11}}>5px blue border</Text>
</View> </View>
</UIExplorerBlock> );
<UIExplorerBlock title="Padding/Margin"> },
}, {
title: 'Padding/Margin',
render: function() {
return (
<View style={{borderColor: '#bb0000', borderWidth: 0.5}}> <View style={{borderColor: '#bb0000', borderWidth: 0.5}}>
<View style={[styles.box, {padding: 5}]}> <View style={[styles.box, {padding: 5}]}>
<Text style={{fontSize: 11}}>5px padding</Text> <Text style={{fontSize: 11}}>5px padding</Text>
@ -63,8 +69,12 @@ var ViewExample = React.createClass({
</Text> </Text>
</View> </View>
</View> </View>
</UIExplorerBlock> );
<UIExplorerBlock title="Border Radius"> },
}, {
title: 'Border Radius',
render: function() {
return (
<View style={{borderWidth: 0.5, borderRadius: 5, padding: 5}}> <View style={{borderWidth: 0.5, borderRadius: 5, padding: 5}}>
<Text style={{fontSize: 11}}> <Text style={{fontSize: 11}}>
Too much use of `borderRadius` (especially large radii) on Too much use of `borderRadius` (especially large radii) on
@ -72,11 +82,19 @@ var ViewExample = React.createClass({
Use sparingly. Use sparingly.
</Text> </Text>
</View> </View>
</UIExplorerBlock> );
<UIExplorerBlock title="Circle with Border Radius"> },
}, {
title: 'Circle with Border Radius',
render: function() {
return (
<View style={{borderRadius: 10, borderWidth: 1, width: 20, height: 20}} /> <View style={{borderRadius: 10, borderWidth: 1, width: 20, height: 20}} />
</UIExplorerBlock> );
<UIExplorerBlock title="Overflow"> },
}, {
title: 'Overflow',
render: function() {
return (
<View style={{flexDirection: 'row'}}> <View style={{flexDirection: 'row'}}>
<View <View
style={{ style={{
@ -97,8 +115,13 @@ var ViewExample = React.createClass({
</View> </View>
</View> </View>
</View> </View>
</UIExplorerBlock> );
<UIExplorerBlock title="Opacity"> },
}, {
title: 'Opacity',
render: function() {
return (
<View>
<View style={{opacity: 0}}><Text>Opacity 0</Text></View> <View style={{opacity: 0}}><Text>Opacity 0</Text></View>
<View style={{opacity: 0.1}}><Text>Opacity 0.1</Text></View> <View style={{opacity: 0.1}}><Text>Opacity 0.1</Text></View>
<View style={{opacity: 0.3}}><Text>Opacity 0.3</Text></View> <View style={{opacity: 0.3}}><Text>Opacity 0.3</Text></View>
@ -106,23 +129,8 @@ var ViewExample = React.createClass({
<View style={{opacity: 0.7}}><Text>Opacity 0.7</Text></View> <View style={{opacity: 0.7}}><Text>Opacity 0.7</Text></View>
<View style={{opacity: 0.9}}><Text>Opacity 0.9</Text></View> <View style={{opacity: 0.9}}><Text>Opacity 0.9</Text></View>
<View style={{opacity: 1}}><Text>Opacity 1</Text></View> <View style={{opacity: 1}}><Text>Opacity 1</Text></View>
</UIExplorerBlock> </View>
</UIExplorerPage>
); );
}, },
updateHeight: function() {
var height = this.state.textBorderExampleHeight === 50 ? 20 : 50;
this.setState({textBorderExampleHeight: height});
}, },
}); ];
var styles = StyleSheet.create({
box: {
backgroundColor: '#527FE4',
borderColor: '#000033',
borderWidth: 1,
}
});
module.exports = ViewExample;

View File

@ -1,7 +1,7 @@
/** /**
* Copyright 2004-present Facebook. All Rights Reserved. * Copyright 2004-present Facebook. All Rights Reserved.
* *
* @providesModule JSNavigationStack * @providesModule ReactNavigator
*/ */
"use strict" "use strict"
@ -10,7 +10,7 @@ var AnimationsDebugModule = require('NativeModules').AnimationsDebugModule;
var Backstack = require('Backstack'); var Backstack = require('Backstack');
var Dimensions = require('Dimensions'); var Dimensions = require('Dimensions');
var InteractionMixin = require('InteractionMixin'); var InteractionMixin = require('InteractionMixin');
var JSNavigationStackAnimationConfigs = require('JSNavigationStackAnimationConfigs'); var ReactNavigatorSceneConfigs = require('ReactNavigatorSceneConfigs');
var PanResponder = require('PanResponder'); var PanResponder = require('PanResponder');
var React = require('React'); var React = require('React');
var StaticContainer = require('StaticContainer.react'); var StaticContainer = require('StaticContainer.react');
@ -72,10 +72,10 @@ var styles = StyleSheet.create({
} }
}); });
var JSNavigationStack = React.createClass({ var ReactNavigator = React.createClass({
propTypes: { propTypes: {
animationConfigRouteMapper: PropTypes.func, configureScene: PropTypes.func,
// Returns the rendered scene to display when invoked with (route, navigator) // Returns the rendered scene to display when invoked with (route, navigator)
renderScene: PropTypes.func.isRequired, renderScene: PropTypes.func.isRequired,
initialRoute: PropTypes.object, initialRoute: PropTypes.object,
@ -90,7 +90,7 @@ var JSNavigationStack = React.createClass({
onItemRef: PropTypes.func, onItemRef: PropTypes.func,
// Define the component to use for the nav bar, which will get navState and navigator props // Define the component to use for the nav bar, which will get navState and navigator props
navigationBar: PropTypes.node, navigationBar: PropTypes.node,
// The navigator object from a parent JSNavigationStack // The navigator object from a parent ReactNavigator
navigator: PropTypes.object, navigator: PropTypes.object,
/** /**
@ -102,14 +102,14 @@ var JSNavigationStack = React.createClass({
}, },
statics: { statics: {
AnimationConfigs: JSNavigationStackAnimationConfigs, SceneConfigs: ReactNavigatorSceneConfigs,
}, },
mixins: [TimerMixin, InteractionMixin, Subscribable.Mixin], mixins: [TimerMixin, InteractionMixin, Subscribable.Mixin],
getDefaultProps: function() { getDefaultProps: function() {
return { return {
animationConfigRouteMapper: () => JSNavigationStackAnimationConfigs.PushFromRight, configureScene: () => ReactNavigatorSceneConfigs.PushFromRight,
sceneStyle: styles.defaultSceneStyle, sceneStyle: styles.defaultSceneStyle,
}; };
}, },
@ -128,12 +128,12 @@ var JSNavigationStack = React.createClass({
} else { } else {
invariant( invariant(
routeStack.length >= 1, routeStack.length >= 1,
'JSNavigationStack requires props.initialRoute or props.initialRouteStack.' 'ReactNavigator requires props.initialRoute or props.initialRouteStack.'
); );
} }
return { return {
animationConfigStack: routeStack.map( sceneConfigStack: routeStack.map(
(route) => this.props.animationConfigRouteMapper(route) (route) => this.props.configureScene(route)
), ),
idStack: routeStack.map(() => getuid()), idStack: routeStack.map(() => getuid()),
routeStack, routeStack,
@ -203,7 +203,7 @@ var JSNavigationStack = React.createClass({
this.springSystem = new rebound.SpringSystem(); this.springSystem = new rebound.SpringSystem();
this.spring = this.springSystem.createSpring(); this.spring = this.springSystem.createSpring();
this.spring.setRestSpeedThreshold(0.05); this.spring.setRestSpeedThreshold(0.05);
var animationConfig = this.state.animationConfigStack[this.state.presentedIndex]; var animationConfig = this.state.sceneConfigStack[this.state.presentedIndex];
animationConfig && this._configureSpring(animationConfig); animationConfig && this._configureSpring(animationConfig);
this.spring.addListener(this); this.spring.addListener(this);
this.onSpringUpdate(); this.onSpringUpdate();
@ -246,8 +246,8 @@ var JSNavigationStack = React.createClass({
this.setState({ this.setState({
idStack: nextRouteStack.map(getuid), idStack: nextRouteStack.map(getuid),
routeStack: nextRouteStack, routeStack: nextRouteStack,
animationConfigStack: nextRouteStack.map( sceneConfigStack: nextRouteStack.map(
this.props.animationConfigRouteMapper this.props.configureScene
), ),
updatingRangeStart: 0, updatingRangeStart: 0,
updatingRangeLength: nextRouteStack.length, updatingRangeLength: nextRouteStack.length,
@ -273,7 +273,7 @@ var JSNavigationStack = React.createClass({
AnimationsDebugModule.startRecordingFps(); AnimationsDebugModule.startRecordingFps();
} }
this._transitionToToIndexWithVelocity( this._transitionToToIndexWithVelocity(
this.state.animationConfigStack[this.state.fromIndex].defaultTransitionVelocity this.state.sceneConfigStack[this.state.fromIndex].defaultTransitionVelocity
); );
} }
}, },
@ -322,7 +322,7 @@ var JSNavigationStack = React.createClass({
_transitionToToIndexWithVelocity: function(v) { _transitionToToIndexWithVelocity: function(v) {
this._configureSpring( this._configureSpring(
// For visual consistency, the from index is always used to configure the spring // For visual consistency, the from index is always used to configure the spring
this.state.animationConfigStack[this.state.fromIndex] this.state.sceneConfigStack[this.state.fromIndex]
); );
this.state.isAnimating = true; this.state.isAnimating = true;
this.spring.setVelocity(v); this.spring.setVelocity(v);
@ -332,7 +332,7 @@ var JSNavigationStack = React.createClass({
_transitionToFromIndexWithVelocity: function(v) { _transitionToFromIndexWithVelocity: function(v) {
this._configureSpring( this._configureSpring(
this.state.animationConfigStack[this.state.fromIndex] this.state.sceneConfigStack[this.state.fromIndex]
); );
this.state.isAnimating = true; this.state.isAnimating = true;
this.spring.setVelocity(v); this.spring.setVelocity(v);
@ -383,7 +383,7 @@ var JSNavigationStack = React.createClass({
_handleMoveShouldSetPanResponder: function(e, gestureState) { _handleMoveShouldSetPanResponder: function(e, gestureState) {
var currentRoute = this.state.routeStack[this.state.presentedIndex]; var currentRoute = this.state.routeStack[this.state.presentedIndex];
var animationConfig = this.state.animationConfigStack[this.state.presentedIndex]; var animationConfig = this.state.sceneConfigStack[this.state.presentedIndex];
if (!animationConfig.enableGestures) { if (!animationConfig.enableGestures) {
return false; return false;
} }
@ -417,7 +417,7 @@ var JSNavigationStack = React.createClass({
this.state.isResponderOnlyToBlockTouches = false; this.state.isResponderOnlyToBlockTouches = false;
return; return;
} }
var animationConfig = this.state.animationConfigStack[this.state.presentedIndex]; var animationConfig = this.state.sceneConfigStack[this.state.presentedIndex];
var velocity = animationConfig.isVertical ? gestureState.vy : gestureState.vx; var velocity = animationConfig.isVertical ? gestureState.vy : gestureState.vx;
// It's not the real location. There is no *real* location - that's the // It's not the real location. There is no *real* location - that's the
// point of the pan gesture. // point of the pan gesture.
@ -451,7 +451,7 @@ var JSNavigationStack = React.createClass({
_handlePanResponderMove: function(e, gestureState) { _handlePanResponderMove: function(e, gestureState) {
if (!this.state.isResponderOnlyToBlockTouches) { if (!this.state.isResponderOnlyToBlockTouches) {
var animationConfig = this.state.animationConfigStack[this.state.presentedIndex]; var animationConfig = this.state.sceneConfigStack[this.state.presentedIndex];
var distance = animationConfig.isVertical ? gestureState.dy : gestureState.dx; var distance = animationConfig.isVertical ? gestureState.dy : gestureState.dx;
var gestureDetectMovement = animationConfig.gestureDetectMovement; var gestureDetectMovement = animationConfig.gestureDetectMovement;
var nextProgress = (distance - gestureDetectMovement) / var nextProgress = (distance - gestureDetectMovement) /
@ -467,7 +467,7 @@ var JSNavigationStack = React.createClass({
} }
// Use toIndex animation when we move forwards. Use fromIndex when we move back // Use toIndex animation when we move forwards. Use fromIndex when we move back
var animationIndex = this.state.presentedIndex < toIndex ? toIndex : fromIndex; var animationIndex = this.state.presentedIndex < toIndex ? toIndex : fromIndex;
var animationConfig = this.state.animationConfigStack[animationIndex]; var animationConfig = this.state.sceneConfigStack[animationIndex];
var styleToUse = {}; var styleToUse = {};
var useFn = index < fromIndex || index < toIndex ? var useFn = index < fromIndex || index < toIndex ?
animationConfig.interpolators.out : animationConfig.interpolators.out :
@ -602,11 +602,11 @@ var JSNavigationStack = React.createClass({
var activeLength = this.state.presentedIndex + 1; var activeLength = this.state.presentedIndex + 1;
var activeStack = this.state.routeStack.slice(0, activeLength); var activeStack = this.state.routeStack.slice(0, activeLength);
var activeIDStack = this.state.idStack.slice(0, activeLength); var activeIDStack = this.state.idStack.slice(0, activeLength);
var activeAnimationConfigStack = this.state.animationConfigStack.slice(0, activeLength); var activeAnimationConfigStack = this.state.sceneConfigStack.slice(0, activeLength);
var nextStack = activeStack.concat([route]); var nextStack = activeStack.concat([route]);
var nextIDStack = activeIDStack.concat([getuid()]); var nextIDStack = activeIDStack.concat([getuid()]);
var nextAnimationConfigStack = activeAnimationConfigStack.concat([ var nextAnimationConfigStack = activeAnimationConfigStack.concat([
this.props.animationConfigRouteMapper(route), this.props.configureScene(route),
]); ]);
var requestTransitionAndResetUpdatingRange = () => { var requestTransitionAndResetUpdatingRange = () => {
this._requestTransitionTo(nextStack.length - 1); this._requestTransitionTo(nextStack.length - 1);
@ -624,7 +624,7 @@ var JSNavigationStack = React.createClass({
this.setState({ this.setState({
idStack: nextIDStack, idStack: nextIDStack,
routeStack: nextStack, routeStack: nextStack,
animationConfigStack: nextAnimationConfigStack, sceneConfigStack: nextAnimationConfigStack,
jumpToIndex: nextStack.length - 1, jumpToIndex: nextStack.length - 1,
updatingRangeStart: nextStack.length - 1, updatingRangeStart: nextStack.length - 1,
updatingRangeLength: 1, updatingRangeLength: 1,
@ -687,15 +687,15 @@ var JSNavigationStack = React.createClass({
// navigation actually happening // navigation actually happening
var nextIDStack = this.state.idStack.slice(); var nextIDStack = this.state.idStack.slice();
var nextRouteStack = this.state.routeStack.slice(); var nextRouteStack = this.state.routeStack.slice();
var nextAnimationModeStack = this.state.animationConfigStack.slice(); var nextAnimationModeStack = this.state.sceneConfigStack.slice();
nextIDStack[index] = getuid(); nextIDStack[index] = getuid();
nextRouteStack[index] = route; nextRouteStack[index] = route;
nextAnimationModeStack[index] = this.props.animationConfigRouteMapper(route); nextAnimationModeStack[index] = this.props.configureScene(route);
this.setState({ this.setState({
idStack: nextIDStack, idStack: nextIDStack,
routeStack: nextRouteStack, routeStack: nextRouteStack,
animationConfigStack: nextAnimationModeStack, sceneConfigStack: nextAnimationModeStack,
updatingRangeStart: index, updatingRangeStart: index,
updatingRangeLength: 1, updatingRangeLength: 1,
}, () => { }, () => {
@ -784,7 +784,7 @@ var JSNavigationStack = React.createClass({
this.setState({ this.setState({
updatingRangeStart: updatingRangeStart, updatingRangeStart: updatingRangeStart,
updatingRangeLength: updatingRangeLength, updatingRangeLength: updatingRangeLength,
animationConfigStack: this.state.animationConfigStack.slice(0, newStackLength), sceneConfigStack: this.state.sceneConfigStack.slice(0, newStackLength),
idStack: this.state.idStack.slice(0, newStackLength), idStack: this.state.idStack.slice(0, newStackLength),
routeStack: this.state.routeStack.slice(0, newStackLength), routeStack: this.state.routeStack.slice(0, newStackLength),
}, this._resetUpdatingRange); }, this._resetUpdatingRange);
@ -857,4 +857,4 @@ var JSNavigationStack = React.createClass({
}, },
}); });
module.exports = JSNavigationStack; module.exports = ReactNavigator;

View File

@ -1,7 +1,7 @@
/** /**
* Copyright 2004-present Facebook. All Rights Reserved. * Copyright 2004-present Facebook. All Rights Reserved.
* *
* @providesModule JSNavigationStackAnimationConfigs * @providesModule ReactNavigatorSceneConfigs
*/ */
'use strict'; 'use strict';
@ -260,7 +260,7 @@ var BaseConfig = {
interpolators: Interpolators.Horizontal, interpolators: Interpolators.Horizontal,
}; };
var JSNavigationStackAnimationConfigs = { var ReactNavigatorSceneConfigs = {
PushFromRight: merge(BaseConfig, { PushFromRight: merge(BaseConfig, {
// We will want to customize this soon // We will want to customize this soon
}), }),
@ -276,4 +276,4 @@ var JSNavigationStackAnimationConfigs = {
}), }),
}; };
module.exports = JSNavigationStackAnimationConfigs; module.exports = ReactNavigatorSceneConfigs;

View File

@ -25,8 +25,8 @@ var ReactNative = Object.assign(Object.create(require('React')), {
ListView: require('ListView'), ListView: require('ListView'),
MapView: require('MapView'), MapView: require('MapView'),
NavigatorIOS: require('NavigatorIOS'), NavigatorIOS: require('NavigatorIOS'),
JSNavigationStack: require('JSNavigationStack'),
PickerIOS: require('PickerIOS'), PickerIOS: require('PickerIOS'),
ReactNavigator: require('ReactNavigator'),
ScrollView: require('ScrollView'), ScrollView: require('ScrollView'),
SliderIOS: require('SliderIOS'), SliderIOS: require('SliderIOS'),
SwitchIOS: require('SwitchIOS'), SwitchIOS: require('SwitchIOS'),