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.

doesn't work when using stack navigator (react navigation): null is not an object

See original GitHub issue

When going back to the previous screen the app is crashing and I got this error: TypeError: null is not an object (evaluating 'canvas.getContext').

Otherwise its drawing on the proper screen.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

20reactions
kasbackcommented, Oct 13, 2019

Hello i think this should fix your problem :

if (canvas !== null){
            const ctx = canvas.getContext('2d');
            canvas.width = 500;
            canvas.height = 500;
            ctx.beginPath();
            ctx.arc(170, 150, 100, 0, 2 * Math.PI);
           ctx.stroke();
}
0reactions
KFernandoDilepixcommented, Oct 13, 2019

@kasback Indeed its working ! Thank you guys @iddan

Read more comments on GitHub >

github_iconTop Results From Across the Web

createStackNavigator is causing null is not an object ...
I get this error message even if I'm only importing createStackNavigator. If comment out the import, the app works normally. My package.json ...
Read more >
React Navigation Error - null is not an object (evaluating ...
Hi,. I'm new to both react-native and react navigation, I've followed the docs exactly to get started. However, when I pasted the code...
Read more >
Troubleshooting | React Navigation
Troubleshooting. This section attempts to outline issues that users frequently encounter when first getting accustomed to using React Navigation.
Read more >
Troubleshooting - React Navigation
This section attempts to outline issues that can happen during setup and may not be related to React Navigation itself. Also see common...
Read more >
Navigation prop reference
Navigation prop reference. Each screen component in your app is provided with the navigation prop automatically. It looks like this: this.props.navigation.
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