Skip to content

Commit 8b58d15

Browse files
committed
fix Example
1 parent e8085cd commit 8b58d15

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

Example/Example.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,20 @@ const Example = () => (
8989
>
9090
<Scene key="tab_1_1" component={TabView} title="Tab #1_1" onRight={() => alert('Right button')} rightTitle="Right" />
9191

92-
<Scene key="tab1_2" component={TabView} title="Tab #1_2" back titleStyle={{ color: 'black', alignSelf: 'center' }} />
92+
<Scene key="tab_1_2" component={TabView} title="Tab #1_2" back titleStyle={{ color: 'black', alignSelf: 'center' }} />
9393
</Stack>
9494

9595
<Stack key="tab_2" title="Tab #2" icon={TabIcon} initial>
9696
<Scene key="tab_2_1" component={TabView} title="Tab #2_1" renderRightButton={() => <Text>Right</Text>} />
97-
<Scene key="tab_2_2" component={TabView} title="Tab #2_2" onBack={() => alert('onBack button!')} hideDrawerButton backTitle="Back!" panHandlers={null} />
97+
<Scene key="tab_2_2" component={TabView} title="Tab #2_2" back onBack={() => alert('onBack button!')} hideDrawerButton backTitle="Back!" panHandlers={null} />
9898
</Stack>
9999

100-
<Stack key="tab_3">
101-
<Scene key="tab_3_1" component={TabView} title="Tab #3" icon={TabIcon} rightTitle="Right3" onRight={() => {}} />
100+
<Stack key="tab_3" icon={TabIcon} title="Tab #3">
101+
<Scene key="tab_3_1" component={TabView} rightTitle="Right3" onRight={() => {}} />
102102
</Stack>
103103
<Scene key="tab_4_1" component={TabView} title="Tab #4" hideNavBar icon={TabIcon} />
104-
<Stack key="tab_5">
105-
<Scene key="tab_5_1" component={TabView} title="Tab #5" icon={TabIcon} />
104+
<Stack key="tab_5" icon={TabIcon} title="Tab #5">
105+
<Scene key="tab_5_1" component={TabView} />
106106
</Stack>
107107
</Tabs>
108108
</Scene>

Example/components/TabView.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import {
4-
StyleSheet, Text, View, ViewPropTypes,
5-
} from 'react-native';
3+
import { StyleSheet, Text, View, ViewPropTypes } from 'react-native';
64
import Button from 'react-native-button';
75
import { Actions } from 'react-native-router-flux';
86

97
const propTypes = {
108
name: PropTypes.string.isRequired,
11-
data: PropTypes.string.isRequired,
9+
data: PropTypes.string,
1210
sceneStyle: ViewPropTypes.style,
1311
title: PropTypes.string.isRequired,
1412
};
@@ -32,10 +30,7 @@ class TabView extends React.Component {
3230
state = { hideNavBar: false };
3331

3432
toggleNavBar = () => {
35-
this.setState(
36-
prevState => ({ hideNavBar: !prevState.hideNavBar }),
37-
() => Actions.refresh({ hideNavBar: this.state.hideNavBar }),
38-
);
33+
this.setState(prevState => ({ hideNavBar: !prevState.hideNavBar }), () => Actions.refresh({ hideNavBar: this.state.hideNavBar }));
3934
};
4035

4136
render() {
@@ -78,7 +73,7 @@ class TabView extends React.Component {
7873
</Button>
7974
<Button
8075
onPress={() => {
81-
Actions.tab_5({ data: 'test!' });
76+
Actions.tab_5_1({ data: 'test!' });
8277
}}
8378
>
8479
Switch to tab5 with data

Example/components/drawer/DrawerContent.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import {
4-
StyleSheet, Text, View, ViewPropTypes,
5-
} from 'react-native';
3+
import { StyleSheet, Text, View, ViewPropTypes } from 'react-native';
64
import Button from 'react-native-button';
75
import { Actions } from 'react-native-router-flux';
86

@@ -43,7 +41,7 @@ class DrawerContent extends React.Component {
4341
<Button onPress={Actions.tab_4_1}>Switch to tab4</Button>
4442
<Button
4543
onPress={() => {
46-
Actions.tab_5({ data: 'test!' });
44+
Actions.___tab_5({ data: 'test!' });
4745
}}
4846
>
4947
Switch to tab5 with data

0 commit comments

Comments
 (0)