mohebifar / react-native-copilot

Step-by-step walkthrough tooltip for your react native app
MIT License
2.25k stars 409 forks source link

null is not an object (evaluating 'this.state.currentStep.target') #117

Open rezapirighadim opened 5 years ago

rezapirighadim commented 5 years ago

I get some error of my app in bugsnag reporter that say's null is not an object (evaluating 'this.state.currentStep.target') this statement used in '/node_modules/@okgrow/react-native-copilot/src/hocs/copilot.js'

I never see this error in my test or development time .

it cause 10 time crash for 7 user in 2 day of our release.

Environment

OS: android version 8.1 and 9 react-native-copilot : "^2.4.1", react-native: 0.57.8

jeromecornet commented 5 years ago

I'm not sure how to reproduce this consistently, but that has happened to me when a user navigates away from the screen before copilot renders the overlay.

rezapirighadim commented 5 years ago

I'm not sure how to reproduce this consistently, but that has happened to me when a user navigates away from the screen before copilot renders the overlay.

I'm fix this problem by lock the screen with a View component that full all of the screen with transparent background and zIndex = 100 . and remove this after user skip or pass all steps of walk through .

export-mike commented 4 years ago

I'm getting this same error null is not an object (evaluating 'this.state.currentStep.target') reported on our sentry issues.

SiSa68 commented 4 years ago

I show copilot in child view, and I may remove child view in some case. If I show copilot and then remove my child view (which CopilotStep component is inside it) I got null is not an object (evaluating 'currentStep.text') error, when user select the 'previous' button on tooltip I was able to fix this problem by adding this code to the copilot HOC's render function:

    if(Object.values(this.state.steps).length === 0 && this.state.visible)
      this.stop();

@mohebifar Mohammad jaan, I hope you add the such a code to prevent this error

mohebifar commented 4 years ago

@SiSa68 Thanks for the proposed solution. Would you be able to create a PR?

SiSa68 commented 4 years ago

@mohebifar I moved the code to the unregisterStep function(I think there is a better place for this), and I made PR

cparello commented 3 years ago

Did this ever get merged into the master as I still see this error.