Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Commit 980e3f4

Browse files
committed
fix: set correct pointer events when active prop changes
(cherry picked from commit a5f7517)
1 parent e481a33 commit 980e3f4

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/views/Stack/PointerEventsView.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ export default class PointerEventsView extends React.Component<Props> {
2727
this.props.active ? TRUE : FALSE
2828
);
2929

30+
componentDidUpdate(prevProps: Props) {
31+
if (this.props.active !== prevProps.active) {
32+
this.pointerEventsEnabled.setValue(this.props.active ? TRUE : FALSE);
33+
this.setPointerEventsEnabled(this.props.active);
34+
}
35+
}
36+
3037
private exec = block([
3138
cond(
3239
greaterThan(this.props.progress, MIN_PROGRESS),
@@ -40,13 +47,17 @@ export default class PointerEventsView extends React.Component<Props> {
4047
onChange(
4148
this.pointerEventsEnabled,
4249
call([this.pointerEventsEnabled], ([value]) => {
43-
const pointerEvents = this.props.active && value ? 'box-none' : 'none';
44-
45-
this.root && this.root.setNativeProps({ pointerEvents });
50+
this.setPointerEventsEnabled(Boolean(this.props.active && value));
4651
})
4752
),
4853
]);
4954

55+
private setPointerEventsEnabled = (enabled: boolean) => {
56+
const pointerEvents = enabled ? 'box-none' : 'none';
57+
58+
this.root && this.root.setNativeProps({ pointerEvents });
59+
};
60+
5061
private root: View | null = null;
5162

5263
render() {

0 commit comments

Comments
 (0)