mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Unify scene rederer params that are used render the scene / header.
Reviewed By: fkgozali Differential Revision: D2981045 fb-gh-sync-id: 21688d92e31d882c5a31dd83ca064c2a01837164 shipit-source-id: 21688d92e31d882c5a31dd83ca064c2a01837164
This commit is contained in:
committed by
Facebook Github Bot 9
parent
e55cefc476
commit
73bdef4089
@@ -74,31 +74,34 @@ class NavigationAnimatedExample extends React.Component {
|
||||
<NavigationAnimatedView
|
||||
navigationState={navigationState}
|
||||
style={styles.animatedView}
|
||||
renderOverlay={(position, layout) => (
|
||||
renderOverlay={(props) => (
|
||||
<NavigationHeader
|
||||
navigationState={navigationState}
|
||||
position={position}
|
||||
navigationState={props.navigationParentState}
|
||||
position={props.position}
|
||||
getTitle={state => state.key}
|
||||
/>
|
||||
)}
|
||||
setTiming={(pos, navState) => {
|
||||
Animated.timing(pos, {toValue: navState.index, duration: 1000}).start();
|
||||
}}
|
||||
renderScene={(state, index, position, layout) => (
|
||||
renderScene={(props) => (
|
||||
<NavigationCard
|
||||
key={state.key}
|
||||
index={index}
|
||||
navigationState={navigationState}
|
||||
position={position}
|
||||
layout={layout}>
|
||||
key={props.navigationState.key}
|
||||
index={props.index}
|
||||
navigationState={props.navigationParentState}
|
||||
position={props.position}
|
||||
layout={props.layout}>
|
||||
<ScrollView style={styles.scrollView}>
|
||||
<NavigationExampleRow
|
||||
text={navigationState.children[navigationState.index].key}
|
||||
text={props.navigationState.key}
|
||||
/>
|
||||
<NavigationExampleRow
|
||||
text="Push!"
|
||||
onPress={() => {
|
||||
onNavigate({ type: 'push', key: 'Route #' + navigationState.children.length });
|
||||
onNavigate({
|
||||
type: 'push',
|
||||
key: 'Route #' + props.navigationParentState.children.length
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<NavigationExampleRow
|
||||
|
||||
@@ -79,11 +79,11 @@ class NavigationCardStackExample extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
_renderScene(navigationState, index, position, layout) {
|
||||
_renderScene(props) {
|
||||
return (
|
||||
<ScrollView style={styles.scrollView}>
|
||||
<NavigationExampleRow
|
||||
text={JSON.stringify(navigationState)}
|
||||
text={JSON.stringify(props.navigationState)}
|
||||
/>
|
||||
<NavigationExampleRow
|
||||
text="Push Route"
|
||||
|
||||
@@ -154,25 +154,24 @@ class ExampleTabScreen extends React.Component {
|
||||
/>
|
||||
);
|
||||
}
|
||||
_renderHeader(position, layout) {
|
||||
_renderHeader(props) {
|
||||
return (
|
||||
<NavigationHeader
|
||||
navigationState={this.props.navigationState}
|
||||
position={position}
|
||||
layout={layout}
|
||||
navigationState={props.navigationParentState}
|
||||
position={props.position}
|
||||
layout={props.layout}
|
||||
getTitle={state => stateTypeTitleMap(state)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
_renderScene(child, index, position, layout) {
|
||||
_renderScene(props) {
|
||||
return (
|
||||
<NavigationCard
|
||||
key={child.key}
|
||||
index={index}
|
||||
childState={child}
|
||||
navigationState={this.props.navigationState}
|
||||
position={position}
|
||||
layout={layout}>
|
||||
key={props.navigationState.key}
|
||||
index={props.index}
|
||||
navigationState={props.navigationParentState}
|
||||
position={props.position}
|
||||
layout={props.layout}>
|
||||
<ScrollView style={styles.scrollView}>
|
||||
<NavigationExampleRow
|
||||
text="Open page"
|
||||
|
||||
@@ -30,13 +30,13 @@ var NavigationExampleRow = require('./NavigationExampleRow');
|
||||
var EXAMPLES = {
|
||||
'Tabs': require('./NavigationTabsExample'),
|
||||
'Basic': require('./NavigationBasicExample'),
|
||||
'Animated Card Stack': require('./NavigationAnimatedExample'),
|
||||
'Animated Example': require('./NavigationAnimatedExample'),
|
||||
'Composition': require('./NavigationCompositionExample'),
|
||||
'Card Stack Example': require('./NavigationCardStackExample'),
|
||||
'Tic Tac Toe': require('./NavigationTicTacToeExample'),
|
||||
};
|
||||
|
||||
var EXAMPLE_STORAGE_KEY = 'xNavigationExperimentalExample';
|
||||
var EXAMPLE_STORAGE_KEY = 'NavigationExperimentalExample';
|
||||
|
||||
var NavigationExperimentalExample = React.createClass({
|
||||
statics: {
|
||||
@@ -47,13 +47,13 @@ var NavigationExperimentalExample = React.createClass({
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
exampe: null,
|
||||
example: null,
|
||||
};
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
AsyncStorage.getItem(EXAMPLE_STORAGE_KEY, (err, example) => {
|
||||
if (err || !example) {
|
||||
if (err || !example || !EXAMPLES[example]) {
|
||||
this.setState({
|
||||
example: 'menu',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user