/** * @flow */ import React from 'react'; import { SafeAreaView, StatusBar, Text, View } from 'react-native'; import { withNavigationFocus } from 'react-navigation'; import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs'; import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; import { Button } from './commonComponents/ButtonWithMargin'; import SampleText from './SampleText'; class Child extends React.Component { render() { return ( {this.props.isFocused ? 'I know that my parent is focused!' : 'My parent is not focused! :O'} ); } } const ChildWithNavigationFocus = withNavigationFocus(Child); const createTabScreen = (name, icon, focusedIcon, tintColor = '#673ab7') => { class TabScreen extends React.Component { static navigationOptions = { tabBarLabel: name, tabBarIcon: ({ tintColor, focused }) => ( ), }; state = { showChild: false }; render() { const { isFocused } = this.props; return ( {'Tab ' + name.toLowerCase()} {'props.isFocused: ' + (isFocused ? ' true' : 'false')} {this.state.showChild ? ( ) : (