Skip to content

Commit

Permalink
Fix eslint Example/components/TabView.js
Browse files Browse the repository at this point in the history
  • Loading branch information
charpeni committed May 6, 2016
1 parent fd48eba commit e0cd7b4
Showing 1 changed file with 43 additions and 45 deletions.
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;

0 comments on commit e0cd7b4

Please sign in to comment.