question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: null is not an object (evaluating 'Toast._ref.show')

See original GitHub issue

I am getting this error when I am trying to prompt a message. I am using expo version 39.0.2 with the following packages. react: 16.13.1 react-native: 0.63 react-native-toast-message: 1.3.6

I am also using ui-kitten and redux. The component is placed inside the inner layer (redux).

My app root looks like this:

function App() {
  return (
    <RootLayout>
      <Provider store={store}>
        <AppNavigator />
        <Toast ref={(ref) => Toast.setRef(ref)} />
      </Provider>
    </RootLayout>
  );
}

export default () => {
  return (
    <>
      <IconRegistry icons={EvaIconsPack} />
      <ApplicationProvider
        {...eva}
        theme={{ ...eva.light, ...theme, ...themeExtra }}
      >
        <App />
      </ApplicationProvider>
    </>
  );
};

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
trbsicommented, Dec 11, 2020

If someone gets the same error I fixed it by adding <Toast> to App.js

return (
    <NavigationContainer>
        <AuthContext.Provider value={authContext}>
            <Stack.Navigator>
                <Stack.Screen name="Home"
                    children={createBottomTabs}
                    options={{
                        headerTitle: Trans.t('app_name'),
                        headerTitleAlign: 'center'
                    }}></Stack.Screen>

                <Stack.Screen
                    name='Contacts'
                    component={ContactsScreen}
                ></Stack.Screen>
            </Stack.Navigator>
            <Toast ref={(ref) => Toast.setRef(ref)} />
        </AuthContext.Provider>
    </NavigationContainer>
);
1reaction
calintamascommented, Dec 6, 2020

Ok, glad it works! I’m closing this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

null is not an object (evaluating 'this._ref.show') #89
After npm installing this library, the given code doesn't work. <Toast ref={Toast.setRef} />. and after initialisation calling Toast.show({ ...
Read more >
null is not an object (evaluating 'this.toastInstance._root. ...
I am facing a Nativ Base Toast issue. When I first load application and then navigate to ticket status, if I go back...
Read more >
typeerror: null is not an object (evaluating 'nativemodules ...
TypeError : null is not an object (evaluating 'NativeModules["SQLite"][method]') This error is located at: in ProfileScene (created by SceneView) in ...
Read more >
null is not an object while accessing the Native Module-React ...
Coding example for the question typeError: null is not an object while accessing the Native Module-React Native.
Read more >
react-native-toast-message
Toast message component for React Native. Latest version: 2.1.5 ... Start using react-native-toast-message in your project by running `npm i ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found