diff --git a/app/AppContainer.js b/app/AppContainer.js index 4242c0cda..4023635f7 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 765f16078..fd0ad6368 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 deb0c6a7f..b07626eac 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 8508c7c2d..93840b828 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);