mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 21:46:07 +08: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:
committed by
facebook-github-bot-9
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
|
||||
|
||||
Reference in New Issue
Block a user