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: Cannot read property 'show' of null

See original GitHub issue

When I show a toast and navigate to a screen and when I go back to the screen where I showed the toast the Toast.show() function shows me TypeError: Cannot read property ‘show’ of null

Code:

        try {
          setMessageToast(
            'Estamos enviado um e-mail para você contendo um código de autorização',
          );
          Toast.show({
            type: 'success',
            topOffset: 20,
            autoHide: false,
          });
        } catch (err) {
          console.log(err);
        }

        await AsyncStorage.mergeItem('@storage_signup', data);

        const responseData = await AsyncStorage.getItem('@storage_signup');

        const result = responseData && JSON.parse(responseData);

        await api.post('/users/auth-signup', {
          fullname: result.fullname,
          nickname: result.nickname,
          email: result.email,
        });

        Toast.hide();

        navigation.navigate('SignUp4');

All of the above code is inside a try catch

Remembering that the toast is displayed only once, only after a while it is displayed again without the mentioned error

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
bulkinavcommented, Sep 21, 2021

I have same issue in my Android app on production, but not on iOS (!)

com.facebook.react.common.JavascriptExceptionExceptionsManagerModule.java:83 TypeError: Cannot read property ‘show’ of null, js engine: hermes, stack: show@1:595302 anonymous

App crashes with several hundred a day and it’s depressing. Unfortunately I am unable to reproduce this issue as write @Victorcassiano and it does not seem to occur on all devices.

2reactions
eulerkochycommented, Oct 10, 2021

Same issue. Simple stuff like this, doesn’t work. Fails with the error TypeError: Cannot read property 'show' of null, js engine: hermes

React.useEffect(() => {
    Toast.show({
      type: 'success',
      text1: 'Hello',
      text2: 'This is some something 👋'
    });
  }, []);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >
TypeError: Cannot read property 'value' of Null in JS
To solve the "Cannot read property 'value' of null" error, make sure that the JS script tag is placed at the bottom of...
Read more >
Getting error "Cannot read property 'show' of null" in console ...
I have been trying to setup some jQuery to so that the image shows when the link is rolled over. Here is the...
Read more >
How to deal with TypeError: cannot read properties of null
While coding in Javascript, you must have at least once received a Type Error which has the message “cannot read properties of null”....
Read more >
typeerror can not read property x of null - YouTube
Join this channel to get access to perks:https://www.youtube.com/channel/UCoSpmr2KNOxjwE_B9ynUmig/joinMy GearCamera ...
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