-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix eslint Example/components/TabView.js
- Loading branch information
Showing
1 changed file
with
43 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |