[FIX] Handle TypeErrors on navigationRef and draftMessage due to null properties (#2232)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
bf63014a6a
commit
68e9e1455b
|
@ -44,7 +44,7 @@ const App = React.memo(({ root, isMasterDetail }) => {
|
||||||
const navTheme = navigationTheme(theme);
|
const navTheme = navigationTheme(theme);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const state = Navigation.navigationRef.current.getRootState();
|
const state = Navigation.navigationRef.current?.getRootState();
|
||||||
const currentRouteName = getActiveRouteName(state);
|
const currentRouteName = getActiveRouteName(state);
|
||||||
Navigation.routeNameRef.current = currentRouteName;
|
Navigation.routeNameRef.current = currentRouteName;
|
||||||
setCurrentScreen(currentRouteName);
|
setCurrentScreen(currentRouteName);
|
||||||
|
|
|
@ -11,7 +11,7 @@ export const INAPP_NOTIFICATION_EMITTER = 'NotificationInApp';
|
||||||
const InAppNotification = memo(() => {
|
const InAppNotification = memo(() => {
|
||||||
const show = (notification) => {
|
const show = (notification) => {
|
||||||
const { payload } = notification;
|
const { payload } = notification;
|
||||||
const state = Navigation.navigationRef.current.getRootState();
|
const state = Navigation.navigationRef.current?.getRootState();
|
||||||
const route = getActiveRoute(state);
|
const route = getActiveRoute(state);
|
||||||
if (payload.rid) {
|
if (payload.rid) {
|
||||||
if (route?.name === 'RoomView' && route.params?.rid === payload.rid) {
|
if (route?.name === 'RoomView' && route.params?.rid === payload.rid) {
|
||||||
|
|
|
@ -196,7 +196,7 @@ class MessageBox extends Component {
|
||||||
console.log('Messagebox.didMount: Thread not found');
|
console.log('Messagebox.didMount: Thread not found');
|
||||||
}
|
}
|
||||||
} else if (!sharing) {
|
} else if (!sharing) {
|
||||||
msg = this.room.draftMessage;
|
msg = this.room?.draftMessage;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
log(e);
|
||||||
|
|
|
@ -150,7 +150,7 @@ class Root extends React.Component {
|
||||||
this.setState({ root: 'outside' });
|
this.setState({ root: 'outside' });
|
||||||
}
|
}
|
||||||
|
|
||||||
const state = Navigation.navigationRef.current.getRootState();
|
const state = Navigation.navigationRef.current?.getRootState();
|
||||||
const currentRouteName = getActiveRouteName(state);
|
const currentRouteName = getActiveRouteName(state);
|
||||||
Navigation.routeNameRef.current = currentRouteName;
|
Navigation.routeNameRef.current = currentRouteName;
|
||||||
setCurrentScreen(currentRouteName);
|
setCurrentScreen(currentRouteName);
|
||||||
|
|
Loading…
Reference in New Issue