import React, {Component} from 'react'; import { Text, View, TouchableOpacity, StyleSheet, Alert, Platform } from 'react-native'; import {Navigation} from 'react-native-navigation'; 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 = { navBarBackgroundColor: '#4dbce9', navBarTextColor: '#ffff00', navBarSubtitleTextColor: '#ff0000', navBarButtonColor: '#ffffff', statusBarTextColorScheme: 'light', tabBarBackgroundColor: '#4dbce9', tabBarButtonColor: '#ffffff', tabBarSelectedButtonColor: '#ffff00' }; constructor(props) { super(props); // if you want to listen on navigator events, set this up 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') { Alert.alert('NavBar', 'Edit button pressed'); } if (event.id === 'add') { Alert.alert('NavBar', 'Add button pressed'); } } render() { return ( Push Plain Screen Push Styled Screen Show Modal Screen { Platform.OS === 'ios' ? Show LightBox : false } { Platform.OS === 'ios' ? Show In-App Notification : false } Show Single Screen App ); } 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" }, passProps: { greeting: 'hey there' }, }); } onInAppNotificationPress() { this.props.navigator.showInAppNotification({ screen: "example.NotificationScreen" }); } onStartSingleScreenApp() { Navigation.startSingleScreenApp({ screen: { screen: 'example.FirstTabScreen' }, drawer: { left: { screen: 'example.SideMenu' } } }); } } const styles = StyleSheet.create({ button: { textAlign: 'center', fontSize: 18, marginBottom: 10, marginTop: 10, color: 'blue' } });