Skip to content

Commit

Permalink
fix Example
Browse files Browse the repository at this point in the history
  • Loading branch information
aksonov committed Jul 27, 2018
1 parent e8085cd commit 8b58d15
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
12 changes: 6 additions & 6 deletions Example/Example.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,20 @@ const Example = () => (
>
<Scene key="tab_1_1" component={TabView} title="Tab #1_1" onRight={() => alert('Right button')} rightTitle="Right" />

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

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

<Stack key="tab_3">
<Scene key="tab_3_1" component={TabView} title="Tab #3" icon={TabIcon} rightTitle="Right3" onRight={() => {}} />
<Stack key="tab_3" icon={TabIcon} title="Tab #3">
<Scene key="tab_3_1" component={TabView} rightTitle="Right3" onRight={() => {}} />
</Stack>
<Scene key="tab_4_1" component={TabView} title="Tab #4" hideNavBar icon={TabIcon} />
<Stack key="tab_5">
<Scene key="tab_5_1" component={TabView} title="Tab #5" icon={TabIcon} />
<Stack key="tab_5" icon={TabIcon} title="Tab #5">
<Scene key="tab_5_1" component={TabView} />
</Stack>
</Tabs>
</Scene>
Expand Down
13 changes: 4 additions & 9 deletions Example/components/TabView.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet, Text, View, ViewPropTypes,
} from 'react-native';
import { StyleSheet, Text, View, ViewPropTypes } from 'react-native';
import Button from 'react-native-button';
import { Actions } from 'react-native-router-flux';

const propTypes = {
name: PropTypes.string.isRequired,
data: PropTypes.string.isRequired,
data: PropTypes.string,
sceneStyle: ViewPropTypes.style,
title: PropTypes.string.isRequired,
};
Expand All @@ -32,10 +30,7 @@ class TabView extends React.Component {
state = { hideNavBar: false };

toggleNavBar = () => {
this.setState(
prevState => ({ hideNavBar: !prevState.hideNavBar }),
() => Actions.refresh({ hideNavBar: this.state.hideNavBar }),
);
this.setState(prevState => ({ hideNavBar: !prevState.hideNavBar }), () => Actions.refresh({ hideNavBar: this.state.hideNavBar }));
};

render() {
Expand Down Expand Up @@ -78,7 +73,7 @@ class TabView extends React.Component {
</Button>
<Button
onPress={() => {
Actions.tab_5({ data: 'test!' });
Actions.tab_5_1({ data: 'test!' });
}}
>
Switch to tab5 with data
Expand Down
6 changes: 2 additions & 4 deletions Example/components/drawer/DrawerContent.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet, Text, View, ViewPropTypes,
} from 'react-native';
import { StyleSheet, Text, View, ViewPropTypes } from 'react-native';
import Button from 'react-native-button';
import { Actions } from 'react-native-router-flux';

Expand Down Expand Up @@ -43,7 +41,7 @@ class DrawerContent extends React.Component {
<Button onPress={Actions.tab_4_1}>Switch to tab4</Button>
<Button
onPress={() => {
Actions.tab_5({ data: 'test!' });
Actions.___tab_5({ data: 'test!' });
}}
>
Switch to tab5 with data
Expand Down

1 comment on commit 8b58d15

@daviscabral
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.