mirror of
https://github.com/status-im/react-native.git
synced 2025-01-12 18:44:25 +00:00
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
This commit is contained in:
parent
a0ccebc460
commit
200d9af315
@ -57,6 +57,7 @@ var _navigationEventPool = new NavigationEventPool();
|
||||
class NavigationEvent {
|
||||
_data: any;
|
||||
_defaultPrevented: boolean;
|
||||
_propagationStopped: boolean;
|
||||
_disposed: boolean;
|
||||
_target: ?Object;
|
||||
_type: ?string;
|
||||
@ -71,6 +72,7 @@ class NavigationEvent {
|
||||
this._data = data;
|
||||
this._defaultPrevented = false;
|
||||
this._disposed = false;
|
||||
this._propagationStopped = false;
|
||||
}
|
||||
|
||||
/* $FlowFixMe - get/set properties not yet supported */
|
||||
@ -97,6 +99,19 @@ class NavigationEvent {
|
||||
this._defaultPrevented = true;
|
||||
}
|
||||
|
||||
stopPropagation(): void {
|
||||
this._propagationStopped = true;
|
||||
}
|
||||
|
||||
stop(): void {
|
||||
this.preventDefault();
|
||||
this.stopPropagation();
|
||||
}
|
||||
|
||||
isPropagationStopped(): boolean {
|
||||
return this._propagationStopped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose the event.
|
||||
* NavigationEvent shall be disposed after being emitted by
|
||||
|
Loading…
x
Reference in New Issue
Block a user