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
*First of all, I assume you've already made a react-native project by running `react-native init project-name` and installed `react-native-navbar` component by `npm`.*
26
-
27
-
In your `index.ios.js` file require `react-native-navbar` component:
28
-
```jsx
29
-
var NavigationBar =require('react-native-navbar');
30
-
```
31
-
or, if you use ES2015 syntax:
32
-
```jsx
33
-
importNavigationBarfrom'react-native-navbar';
34
-
```
35
-
36
-
Inside your component's `render` method, use `NavigationBar`:
37
-
```jsx
38
-
render:function() {
39
-
var rightButtonConfig = {
40
-
title:'Next',
41
-
handler:functiononNext() {
42
-
alert('hello!');
43
-
}
44
-
};
45
-
46
-
var titleConfig = {
47
-
title:'Hello, world',
48
-
};
49
-
50
-
return (
51
-
<View style={{ flex:1, }}>
52
-
<NavigationBar
53
-
title={titleConfig}
54
-
rightButton={rightButtonConfig} />
55
-
</View>
56
-
);
57
-
}
58
-
```
59
-
or, if you use ES2015:
18
+
- Install `react-native-navbar`:
19
+
- By using `yarn`:
20
+
```
21
+
$ yarn add react-native-navbar
22
+
```
23
+
- By using `npm`:
24
+
```
25
+
$ npm install react-native-navbar --save
26
+
```
27
+
28
+
- Import it in the file where you want to use it:
29
+
```jsx
30
+
import NavigationBar from 'react-native-navbar';
31
+
```
32
+
33
+
- Add it to your React element tree:
60
34
```jsx
61
-
render() {
62
-
constrightButtonConfig= {
63
-
title:'Next',
64
-
handler: () =>alert('hello!'),
65
-
};
66
-
67
-
consttitleConfig= {
68
-
title:'Hello, world',
69
-
};
70
-
35
+
conststyles= {
36
+
container: {
37
+
flex:1,
38
+
},
39
+
};
40
+
41
+
constrightButtonConfig= {
42
+
title:'Next',
43
+
handler: () =>alert('hello!'),
44
+
};
45
+
46
+
consttitleConfig= {
47
+
title:'Hello, world',
48
+
};
49
+
50
+
functionComponentWithNavigationBar() {
71
51
return (
72
-
<View style={{ flex:1, }}>
52
+
<View style={styles.container}>
73
53
<NavigationBar
74
54
title={titleConfig}
75
-
rightButton={rightButtonConfig} />
55
+
rightButton={rightButtonConfig}
56
+
/>
76
57
</View>
77
58
);
78
59
}
@@ -118,8 +99,5 @@ loaders: [{
118
99
```
119
100
120
101
### Questions?
121
-
Feel free to contact me via
122
-
-[Twitter](https://twitter.com/kureevalexey)
123
-
- Slack (@kureev on #reactiflux channel)
124
-
125
-
If you want to report a bug, please [submit an issue!](https://github.com/Kureev/react-native-navbar/issues/new)
102
+
Feel free to ping me on [twitter](https://twitter.com/kureevalexey)
103
+
If you want to report a bug, please [submit an issue!](https://github.com/react-native-community/react-native-navbar/issues/new)
0 commit comments