Return statement missing for renderScene
Summary: Explain the **motivation** for making this change. What existing problem does the pull request solve? Example code for "Using Navigators" under "THE BASICS" does not work. renderScene needs to return the components, not just instantiate them. **Test plan (required)** I copy-paste and ran the code but did not get anything rendered. I added a return statement before the component which made it work. Arrow functions need a return statement when supplying a { block of code }. Closes https://github.com/facebook/react-native/pull/9161 Differential Revision: D3663200 Pulled By: hramos fbshipit-source-id: a8732dd1098de7c8ea915f459adb3403a8168f19
This commit is contained in:
parent
54d8f221c2
commit
0fdbfb029e
|
@ -78,7 +78,7 @@ render() {
|
|||
<Navigator
|
||||
initialRoute={{ title: 'My Initial Scene', index: 0 }}
|
||||
renderScene={(route, navigator) => {
|
||||
<MyScene title={route.title} />
|
||||
return <MyScene title={route.title} />
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
@ -112,25 +112,27 @@ export default class SimpleNavigationApp extends Component {
|
|||
<Navigator
|
||||
initialRoute={{ title: 'My Initial Scene', index: 0 }}
|
||||
renderScene={(route, navigator) =>
|
||||
<MyScene
|
||||
title={route.title}
|
||||
|
||||
// Function to call when a new scene should be displayed
|
||||
onForward={ () => {
|
||||
const nextIndex = route.index + 1;
|
||||
navigator.push({
|
||||
title: 'Scene ' + nextIndex,
|
||||
index: nextIndex,
|
||||
});
|
||||
}}
|
||||
|
||||
// Function to call to go back to the previous scene
|
||||
onBack={() => {
|
||||
if (route.index > 0) {
|
||||
navigator.pop();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
return (
|
||||
<MyScene
|
||||
title={route.title}
|
||||
|
||||
// Function to call when a new scene should be displayed
|
||||
onForward={ () => {
|
||||
const nextIndex = route.index + 1;
|
||||
navigator.push({
|
||||
title: 'Scene ' + nextIndex,
|
||||
index: nextIndex,
|
||||
});
|
||||
}}
|
||||
|
||||
// Function to call to go back to the previous scene
|
||||
onBack={() => {
|
||||
if (route.index > 0) {
|
||||
navigator.pop();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue