diff --git a/app/AppContainer.js b/app/AppContainer.js index 4242c0cd..4023635f 100644 --- a/app/AppContainer.js +++ b/app/AppContainer.js @@ -44,7 +44,7 @@ const App = React.memo(({ root, isMasterDetail }) => { const navTheme = navigationTheme(theme); React.useEffect(() => { - const state = Navigation.navigationRef.current.getRootState(); + const state = Navigation.navigationRef.current?.getRootState(); const currentRouteName = getActiveRouteName(state); Navigation.routeNameRef.current = currentRouteName; setCurrentScreen(currentRouteName); diff --git a/app/containers/InAppNotification/index.js b/app/containers/InAppNotification/index.js index 765f1607..fd0ad636 100644 --- a/app/containers/InAppNotification/index.js +++ b/app/containers/InAppNotification/index.js @@ -11,7 +11,7 @@ export const INAPP_NOTIFICATION_EMITTER = 'NotificationInApp'; const InAppNotification = memo(() => { const show = (notification) => { const { payload } = notification; - const state = Navigation.navigationRef.current.getRootState(); + const state = Navigation.navigationRef.current?.getRootState(); const route = getActiveRoute(state); if (payload.rid) { if (route?.name === 'RoomView' && route.params?.rid === payload.rid) { diff --git a/app/containers/MessageBox/index.js b/app/containers/MessageBox/index.js index deb0c6a7..b07626ea 100644 --- a/app/containers/MessageBox/index.js +++ b/app/containers/MessageBox/index.js @@ -196,7 +196,7 @@ class MessageBox extends Component { console.log('Messagebox.didMount: Thread not found'); } } else if (!sharing) { - msg = this.room.draftMessage; + msg = this.room?.draftMessage; } } catch (e) { log(e); diff --git a/app/share.js b/app/share.js index 8508c7c2..93840b82 100644 --- a/app/share.js +++ b/app/share.js @@ -150,7 +150,7 @@ class Root extends React.Component { this.setState({ root: 'outside' }); } - const state = Navigation.navigationRef.current.getRootState(); + const state = Navigation.navigationRef.current?.getRootState(); const currentRouteName = getActiveRouteName(state); Navigation.routeNameRef.current = currentRouteName; setCurrentScreen(currentRouteName);