123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- import React, {
- Component,
- Text,
- View,
- ScrollView,
- TouchableOpacity,
- StyleSheet,
- AlertIOS
- } from 'react-native';
-
- export default class FirstTabScreen extends Component {
- static navigatorButtons = {
- leftButtons: [{
- icon: require('../../img/navicon_menu.png'),
- id: 'menu'
- }],
- rightButtons: [
- {
- title: 'Edit',
- id: 'edit'
- },
- {
- icon: require('../../img/navicon_add.png'),
- id: 'add'
- }
- ]
- };
- static navigatorStyle = {
- drawUnderTabBar: true
- };
- constructor(props) {
- super(props);
-
- this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
- }
- onNavigatorEvent(event) {
- if (event.id == 'menu') {
- this.props.navigator.toggleDrawer({
- side: 'left',
- animated: true
- });
- }
- if (event.id == 'edit') {
- AlertIOS.alert('NavBar', 'Edit button pressed');
- }
- if (event.id == 'add') {
- AlertIOS.alert('NavBar', 'Add button pressed');
- }
- }
- render() {
- return (
- <View style={{flex: 1, padding: 20}}>
-
- <TouchableOpacity onPress={ this.onPushPress.bind(this) }>
- <Text style={styles.button}>Push Plain Screen</Text>
- </TouchableOpacity>
-
- <TouchableOpacity onPress={ this.onPushStyledPress.bind(this) }>
- <Text style={styles.button}>Push Styled Screen</Text>
- </TouchableOpacity>
-
- <TouchableOpacity onPress={ this.onModalPress.bind(this) }>
- <Text style={styles.button}>Show Modal Screen</Text>
- </TouchableOpacity>
-
- <TouchableOpacity onPress={ this.onLightBoxPress.bind(this) }>
- <Text style={styles.button}>Show LightBox</Text>
- </TouchableOpacity>
-
- </View>
- );
- }
- onPushPress() {
- this.props.navigator.push({
- title: "More",
- screen: "example.PushedScreen"
- });
- }
- onPushStyledPress() {
- this.props.navigator.push({
- title: "Styled",
- screen: "example.StyledScreen"
- });
- }
- onModalPress() {
- this.props.navigator.showModal({
- title: "Modal",
- screen: "example.ModalScreen"
- });
- }
- onLightBoxPress() {
- this.props.navigator.showLightBox({
- screen: "example.LightBoxScreen",
- style: {
- backgroundBlur: "dark"
- }
- });
- }
- }
-
- const styles = StyleSheet.create({
- button: {
- textAlign: 'center',
- fontSize: 18,
- marginBottom: 10,
- marginTop:10,
- color: 'blue'
- }
- });
|