Skip to content

Commit 200d9af

Browse files
Hedger Wangfacebook-github-bot-9
authored andcommitted
Add method stopPropagation and stop to NavigationEvent
Summary: @​public Add method `stopPropagation` and `stop` to NavigationEvent so we can stop event easily once event bubbling and capturing is supported. Reviewed By: @fkgozali Differential Revision: D2471903
1 parent a0ccebc commit 200d9af

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Libraries/CustomComponents/Navigator/Navigation/NavigationEvent.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ var _navigationEventPool = new NavigationEventPool();
5757
class NavigationEvent {
5858
_data: any;
5959
_defaultPrevented: boolean;
60+
_propagationStopped: boolean;
6061
_disposed: boolean;
6162
_target: ?Object;
6263
_type: ?string;
@@ -71,6 +72,7 @@ class NavigationEvent {
7172
this._data = data;
7273
this._defaultPrevented = false;
7374
this._disposed = false;
75+
this._propagationStopped = false;
7476
}
7577

7678
/* $FlowFixMe - get/set properties not yet supported */
@@ -97,6 +99,19 @@ class NavigationEvent {
9799
this._defaultPrevented = true;
98100
}
99101

102+
stopPropagation(): void {
103+
this._propagationStopped = true;
104+
}
105+
106+
stop(): void {
107+
this.preventDefault();
108+
this.stopPropagation();
109+
}
110+
111+
isPropagationStopped(): boolean {
112+
return this._propagationStopped;
113+
}
114+
100115
/**
101116
* Dispose the event.
102117
* NavigationEvent shall be disposed after being emitted by

0 commit comments

Comments
 (0)