mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-30 05:55:48 +08:00
[ReactNative] s/ReactNavigator/Navigator/
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar');
|
var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar');
|
||||||
var ReactNavigator = require('ReactNavigator');
|
var Navigator = require('Navigator');
|
||||||
var React = require('React');
|
var React = require('React');
|
||||||
var StyleSheet = require('StyleSheet');
|
var StyleSheet = require('StyleSheet');
|
||||||
var ScrollView = require('ScrollView');
|
var ScrollView = require('ScrollView');
|
||||||
@@ -185,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">
|
||||||
<ReactNavigator
|
<Navigator
|
||||||
debugOverlay={false}
|
debugOverlay={false}
|
||||||
style={[styles.appContainer]}
|
style={[styles.appContainer]}
|
||||||
initialRoute={initialRoute}
|
initialRoute={initialRoute}
|
||||||
@@ -202,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">
|
||||||
<ReactNavigator
|
<Navigator
|
||||||
configureScene={() => ReactNavigator.SceneConfigs.FloatFromBottom}
|
configureScene={() => Navigator.SceneConfigs.FloatFromBottom}
|
||||||
debugOverlay={false}
|
debugOverlay={false}
|
||||||
style={[styles.appContainer]}
|
style={[styles.appContainer]}
|
||||||
initialRoute={initialRoute}
|
initialRoute={initialRoute}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ReactNavigator = require('ReactNavigator');
|
var Navigator = require('Navigator');
|
||||||
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 (
|
||||||
<ReactNavigator
|
<Navigator
|
||||||
debugOverlay={false}
|
debugOverlay={false}
|
||||||
style={[styles.appContainer]}
|
style={[styles.appContainer]}
|
||||||
initialRoute={INIT_ROUTE}
|
initialRoute={INIT_ROUTE}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ReactNavigator = require('ReactNavigator');
|
var Navigator = require('Navigator');
|
||||||
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}>
|
||||||
<ReactNavigator
|
<Navigator
|
||||||
debugOverlay={false}
|
debugOverlay={false}
|
||||||
style={styles.appContainer}
|
style={styles.appContainer}
|
||||||
initialRoute={newRandomRoute()}
|
initialRoute={newRandomRoute()}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var React = require('React');
|
var React = require('React');
|
||||||
var ReactNavigator = require('ReactNavigator');
|
var Navigator = require('Navigator');
|
||||||
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 ReactNavigator Example</Text>
|
<Text style={styles.buttonText}>Exit Navigator 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: '<ReactNavigator>',
|
title: '<Navigator>',
|
||||||
description: 'JS-implemented navigation',
|
description: 'JS-implemented navigation',
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -69,11 +69,11 @@ var TabBarExample = React.createClass({
|
|||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
<ReactNavigator
|
<Navigator
|
||||||
style={styles.container}
|
style={styles.container}
|
||||||
initialRoute={{ id: 'menu', }}
|
initialRoute={{ id: 'menu', }}
|
||||||
renderScene={this.renderScene}
|
renderScene={this.renderScene}
|
||||||
configureScene={(route) => ReactNavigator.SceneConfigs.FloatFromBottom}
|
configureScene={(route) => Navigator.SceneConfigs.FloatFromBottom}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar');
|
var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar');
|
||||||
var ReactNavigator = require('ReactNavigator');
|
var Navigator = require('Navigator');
|
||||||
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>
|
||||||
<ReactNavigator
|
<Navigator
|
||||||
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>
|
||||||
<ReactNavigator
|
<Navigator
|
||||||
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 (
|
||||||
<ReactNavigator
|
<Navigator
|
||||||
style={[styles.appContainer]}
|
style={[styles.appContainer]}
|
||||||
configureScene={() => ReactNavigator.SceneConfigs.FloatFromBottom}
|
configureScene={() => Navigator.SceneConfigs.FloatFromBottom}
|
||||||
initialRoute={initialRoute}
|
initialRoute={initialRoute}
|
||||||
renderScene={FirstDeepRouteMapper}
|
renderScene={FirstDeepRouteMapper}
|
||||||
/>
|
/>
|
||||||
@@ -22,7 +22,7 @@ var {
|
|||||||
TouchableHighlight,
|
TouchableHighlight,
|
||||||
View,
|
View,
|
||||||
} = React;
|
} = React;
|
||||||
var ReactNavigatorExample = require('./ReactNavigator/ReactNavigatorExample');
|
var NavigatorExample = require('./Navigator/NavigatorExample');
|
||||||
|
|
||||||
var { TestModule } = React.addons;
|
var { TestModule } = React.addons;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ var COMPONENTS = [
|
|||||||
require('./ListViewSimpleExample'),
|
require('./ListViewSimpleExample'),
|
||||||
require('./MapViewExample'),
|
require('./MapViewExample'),
|
||||||
require('./NavigatorIOSExample'),
|
require('./NavigatorIOSExample'),
|
||||||
ReactNavigatorExample,
|
NavigatorExample,
|
||||||
require('./PickerExample'),
|
require('./PickerExample'),
|
||||||
require('./ScrollViewExample'),
|
require('./ScrollViewExample'),
|
||||||
require('./SliderIOSExample'),
|
require('./SliderIOSExample'),
|
||||||
@@ -176,9 +176,9 @@ class UIExplorerList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onPressRow(example) {
|
_onPressRow(example) {
|
||||||
if (example === ReactNavigatorExample) {
|
if (example === NavigatorExample) {
|
||||||
this.props.onExternalExampleRequested(
|
this.props.onExternalExampleRequested(
|
||||||
ReactNavigatorExample
|
NavigatorExample
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ var TextInputState = {
|
|||||||
* noop if the text field was already focused
|
* noop if the text field was already focused
|
||||||
*/
|
*/
|
||||||
focusTextInput: function(textFieldID: string) {
|
focusTextInput: function(textFieldID: string) {
|
||||||
if (this._currentlyFocusedID != textFieldID && textFieldID != null) {
|
if (this._currentlyFocusedID !== textFieldID && textFieldID !== null) {
|
||||||
this._currentlyFocusedID = textFieldID;
|
this._currentlyFocusedID = textFieldID;
|
||||||
RCTUIManager.focus(textFieldID);
|
RCTUIManager.focus(textFieldID);
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ var TextInputState = {
|
|||||||
* noop if it wasn't focused
|
* noop if it wasn't focused
|
||||||
*/
|
*/
|
||||||
blurTextInput: function(textFieldID: string) {
|
blurTextInput: function(textFieldID: string) {
|
||||||
if (this._currentlyFocusedID == textFieldID && textFieldID != null) {
|
if (this._currentlyFocusedID === textFieldID && textFieldID !== null) {
|
||||||
this._currentlyFocusedID = null;
|
this._currentlyFocusedID = null;
|
||||||
RCTUIManager.blur(textFieldID);
|
RCTUIManager.blur(textFieldID);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* @providesModule ReactNavigator
|
* @providesModule Navigator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
"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 ReactNavigatorSceneConfigs = require('ReactNavigatorSceneConfigs');
|
var NavigatorSceneConfigs = require('NavigatorSceneConfigs');
|
||||||
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,7 +72,7 @@ var styles = StyleSheet.create({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var ReactNavigator = React.createClass({
|
var Navigator = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
configureScene: PropTypes.func,
|
configureScene: PropTypes.func,
|
||||||
@@ -90,7 +90,7 @@ var ReactNavigator = 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 ReactNavigator
|
// The navigator object from a parent Navigator
|
||||||
navigator: PropTypes.object,
|
navigator: PropTypes.object,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,14 +102,14 @@ var ReactNavigator = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
statics: {
|
statics: {
|
||||||
SceneConfigs: ReactNavigatorSceneConfigs,
|
SceneConfigs: NavigatorSceneConfigs,
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [TimerMixin, InteractionMixin, Subscribable.Mixin],
|
mixins: [TimerMixin, InteractionMixin, Subscribable.Mixin],
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
return {
|
return {
|
||||||
configureScene: () => ReactNavigatorSceneConfigs.PushFromRight,
|
configureScene: () => NavigatorSceneConfigs.PushFromRight,
|
||||||
sceneStyle: styles.defaultSceneStyle,
|
sceneStyle: styles.defaultSceneStyle,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -128,7 +128,7 @@ var ReactNavigator = React.createClass({
|
|||||||
} else {
|
} else {
|
||||||
invariant(
|
invariant(
|
||||||
routeStack.length >= 1,
|
routeStack.length >= 1,
|
||||||
'ReactNavigator requires props.initialRoute or props.initialRouteStack.'
|
'Navigator requires props.initialRoute or props.initialRouteStack.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@@ -857,4 +857,4 @@ var ReactNavigator = React.createClass({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = ReactNavigator;
|
module.exports = Navigator;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* @providesModule ReactNavigatorSceneConfigs
|
* @providesModule NavigatorSceneConfigs
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@ var BaseConfig = {
|
|||||||
interpolators: Interpolators.Horizontal,
|
interpolators: Interpolators.Horizontal,
|
||||||
};
|
};
|
||||||
|
|
||||||
var ReactNavigatorSceneConfigs = {
|
var NavigatorSceneConfigs = {
|
||||||
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 ReactNavigatorSceneConfigs = {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ReactNavigatorSceneConfigs;
|
module.exports = NavigatorSceneConfigs;
|
||||||
2
Libraries/react-native/react-native.js
vendored
2
Libraries/react-native/react-native.js
vendored
@@ -26,7 +26,7 @@ var ReactNative = Object.assign(Object.create(require('React')), {
|
|||||||
MapView: require('MapView'),
|
MapView: require('MapView'),
|
||||||
NavigatorIOS: require('NavigatorIOS'),
|
NavigatorIOS: require('NavigatorIOS'),
|
||||||
PickerIOS: require('PickerIOS'),
|
PickerIOS: require('PickerIOS'),
|
||||||
ReactNavigator: require('ReactNavigator'),
|
Navigator: require('Navigator'),
|
||||||
ScrollView: require('ScrollView'),
|
ScrollView: require('ScrollView'),
|
||||||
SliderIOS: require('SliderIOS'),
|
SliderIOS: require('SliderIOS'),
|
||||||
SwitchIOS: require('SwitchIOS'),
|
SwitchIOS: require('SwitchIOS'),
|
||||||
|
|||||||
Reference in New Issue
Block a user