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.
1 parent 7e468bb commit 660e317Copy full SHA for 660e317
src/components/UIView.tsx
@@ -154,10 +154,16 @@ export class UIView extends Component<UIViewProps, UIViewState> {
154
this.uiViewAddress &&
155
this.uiViewAddress.context &&
156
this.uiViewAddress.context.name;
157
- props.ref = c => {
158
- this.componentInstance = c;
159
- this.registerUiCanExitHook(stateName);
160
- };
+
+ // only class components can implement the
+ // uiCanExit hook and ref doesn't work on
+ // stateless function components
161
+ if(typeof component !== 'string' && !!component.prototype.render) {
162
+ props.ref = c => {
163
+ this.componentInstance = c;
164
+ this.registerUiCanExitHook(stateName);
165
+ };
166
+ }
167
168
let child =
169
!loaded && isValidElement(children)
0 commit comments