We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents adc3039 + 50df03f commit 493e532Copy full SHA for 493e532
src/hocs/copilot.js
@@ -78,6 +78,8 @@ const copilot = ({
78
79
startTries = 0;
80
81
+ mounted = false;
82
+
83
eventEmitter = mitt();
84
85
isFirstStep = (): boolean => this.state.currentStep === this.getFirstStep();
@@ -94,6 +96,9 @@ const copilot = ({
94
96
}
95
97
98
unregisterStep = (stepName: string): void => {
99
+ if (!this.mounted) {
100
+ return;
101
+ }
102
this.setState(({ steps }) => ({
103
steps: Object.entries(steps)
104
.filter(([key]) => key !== stepName)
@@ -149,6 +154,14 @@ const copilot = ({
149
154
});
150
155
151
156
157
+ componentDidMount() {
158
+ this.mounted = true;
159
160
161
+ componentWillUnmount() {
162
+ this.mounted = false;
163
+ };
164
152
165
render() {
153
166
return (
167
<View style={{ flex: 1 }}>
0 commit comments