Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Eslint Example/components/TabView.js #642

Merged
merged 1 commit into from
May 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 43 additions & 45 deletions Example/components/TabView.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
import React from 'react';
import {View, Text, StyleSheet} from "react-native";
import Button from "react-native-button";
import {Actions} from "react-native-router-flux";
import { PropTypes, StyleSheet, Text, View } from 'react-native';
import Button from 'react-native-button';
import { Actions } from 'react-native-router-flux';

const contextTypes = {
drawer: React.PropTypes.object,
};

const propTypes = {
name: PropTypes.string,
sceneStyle: View.propTypes.style,
title: PropTypes.string,
};

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#F5FCFF",
},
welcome: {
fontSize: 20,
textAlign: "center",
margin: 10,
},
instructions: {
textAlign: "center",
color: "#333333",
marginBottom: 5,
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
});

const TabView = (props, context) => {
const drawer = context.drawer;
return (
<View style={[styles.container, props.sceneStyle]}>
<Text>Tab {props.title}</Text>
{props.name === 'tab1_1' &&
<Button onPress={Actions.tab1_2}>next screen for tab1_1</Button>
}
{props.name === 'tab2_1' &&
<Button onPress={Actions.tab2_2}>next screen for tab2_1</Button>
}
<Button onPress={Actions.pop}>Back</Button>
<Button onPress={() => { drawer.close(); Actions.tab1(); }}>Switch to tab1</Button>
<Button onPress={() => { drawer.close(); Actions.tab2(); }}>Switch to tab2</Button>
<Button onPress={() => { drawer.close(); Actions.tab3(); }}>Switch to tab3</Button>
<Button onPress={() => { drawer.close(); Actions.tab4(); }}>Switch to tab4</Button>
<Button onPress={() => { drawer.close(); Actions.tab5(); }}>Switch to tab5</Button>
<Button onPress={() => { drawer.close(); Actions.echo(); }}>push new scene</Button>
</View>
);
};

export default class TabView extends React.Component {
render(){
const drawer = this.context.drawer;
return (
<View style={[styles.container, this.props.sceneStyle]}>
<Text>Tab {this.props.title}</Text>
{this.props.name === "tab1_1" &&
<Button onPress={Actions.tab1_2}>next screen for tab1_1</Button>
}
{this.props.name === "tab2_1" &&
<Button onPress={Actions.tab2_2}>next screen for tab2_1</Button>
}
<Button onPress={Actions.pop}>Back</Button>
<Button onPress={() => {drawer.close();Actions.tab1();}}>Switch to tab1</Button>
<Button onPress={() => {drawer.close();Actions.tab2();}}>Switch to tab2</Button>
<Button onPress={() => {drawer.close();Actions.tab3();}}>Switch to tab3</Button>
<Button onPress={() => {drawer.close();Actions.tab4();}}>Switch to tab4</Button>
<Button onPress={() => {drawer.close();Actions.tab5();}}>Switch to tab5</Button>
<Button onPress={() => {drawer.close();Actions.echo();}}>push new scene</Button>
</View>
);
}
}
TabView.contextTypes = contextTypes;
TabView.propTypes = propTypes;

TabView.contextTypes = {
drawer: React.PropTypes.object
};
export default TabView;