This should be simple, but I’m trying to simply have a way when people are offline to go to a specific screen - this is in app.js (I left out the code to determine when the user is offline). When they are offline the component NotOnline shows, but if you touch on Categories! you get "undefined is not an object (evaluating o.props.navigation, navigate). Is there something I’m obviously missing? Thanks.
import React from "react";
import {
Platform,
StatusBar,
StyleSheet,
View,
NetInfo,
Text,
Image
} from "react-native";
import { AppLoading, Asset } from "expo";
import RootNavigation from "./navigation/RootNavigation";
class NotOnline extends React.Component {
_handlePress = () => {
this.props.navigation.navigate('Categories');
}
render() {
return (
<View >
<Text onPress={this._handlePress}>Categories!</Text>
</View>
);
}
}
export default class AppContainer extends React.Component {
state = {
appIsReady: false,
isOnline: false,
};
render() {
if (!this.state.isOnline) {
return <NotOnline />;
}
if (this.state.appIsReady && this.state.loggedIn) {
return (
<View style={styles.container}>
{Platform.OS === "ios" && <StatusBar barStyle="default" />}
{Platform.OS === "android" && (
<View style={styles.statusBarUnderlay} />
)}
<RootNavigation />
</View>
);
} else {
return <AppLoading />;
}
}
}
});