You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,8 @@ import Router from 'react-native-simple-router';
22
22
23
23
The basics:
24
24
```javascript
25
-
26
-
importReact, { StyleSheet } from'react-native';
25
+
importReactfrom'react';
26
+
import { StyleSheet } from'react-native';
27
27
28
28
// The initial page
29
29
classHelloPageextendsReact.Component {
@@ -69,14 +69,14 @@ Boom. That's it.
69
69
From the "Hello world!"-page you can then navigate further to a new component by calling ```this.props.toRoute()```. Let's build upon the HelloPage component in our first example:
@@ -102,6 +102,8 @@ class HelloPage extends React.Component {
102
102
}
103
103
104
104
HelloPage.propTypes= propTypes;
105
+
106
+
exportdefaultHelloPage;
105
107
```
106
108
107
109
Now, when you click on "Next page please!", it will go to the next page (which in this case is still HelloPage but with a new title). Keep in mind that ```this.props.toRoute()``` needs to be called from one of the top-level routes, therefore, if your link is deeply nested within multiple components, you need to make sure that the action "bubbles up" until it reaches the parent route, which in turn calls ```this.props.toRoute()```.
@@ -232,7 +234,7 @@ To see more of the router in action, you can check out the Twitter example app t
232
234
Test the app by requiring the TwitterApp component:
0 commit comments