mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
Fix Flow type that event target can be null (#13124)
We pass null sometimes when the event target has disappeared. E.g. when touches fires on a deleted node.
This commit is contained in:
committed by
GitHub
parent
b4c0788aaa
commit
dfc8e3209d
@@ -167,7 +167,7 @@ export function getListener(inst: Fiber, registrationName: string) {
|
||||
*/
|
||||
function extractEvents(
|
||||
topLevelType: TopLevelType,
|
||||
targetInst: Fiber,
|
||||
targetInst: null | Fiber,
|
||||
nativeEvent: AnyNativeEvent,
|
||||
nativeEventTarget: EventTarget,
|
||||
): Array<ReactSyntheticEvent> | ReactSyntheticEvent | null {
|
||||
@@ -229,7 +229,7 @@ export function runEventsInBatch(
|
||||
|
||||
export function runExtractedEventsInBatch(
|
||||
topLevelType: TopLevelType,
|
||||
targetInst: Fiber,
|
||||
targetInst: null | Fiber,
|
||||
nativeEvent: AnyNativeEvent,
|
||||
nativeEventTarget: EventTarget,
|
||||
) {
|
||||
|
||||
@@ -24,7 +24,7 @@ export type PluginModule<NativeEvent> = {
|
||||
eventTypes: EventTypes,
|
||||
extractEvents: (
|
||||
topLevelType: TopLevelType,
|
||||
targetInst: Fiber,
|
||||
targetInst: null | Fiber,
|
||||
nativeTarget: NativeEvent,
|
||||
nativeEventTarget: EventTarget,
|
||||
) => ?ReactSyntheticEvent,
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@ const SimpleEventPlugin: PluginModule<MouseEvent> & {
|
||||
|
||||
extractEvents: function(
|
||||
topLevelType: TopLevelType,
|
||||
targetInst: Fiber,
|
||||
targetInst: null | Fiber,
|
||||
nativeEvent: MouseEvent,
|
||||
nativeEventTarget: EventTarget,
|
||||
): null | ReactSyntheticEvent {
|
||||
|
||||
@@ -19,11 +19,11 @@ import type {TopLevelType} from 'events/TopLevelEventTypes';
|
||||
export {getListener, registrationNameModules as registrationNames};
|
||||
|
||||
export function dispatchEvent(
|
||||
target: Object,
|
||||
target: null | Object,
|
||||
topLevelType: TopLevelType,
|
||||
nativeEvent: AnyNativeEvent,
|
||||
) {
|
||||
const targetFiber = (target: Fiber);
|
||||
const targetFiber = (target: null | Fiber);
|
||||
batchedUpdates(function() {
|
||||
runExtractedEventsInBatch(
|
||||
topLevelType,
|
||||
|
||||
@@ -31,7 +31,7 @@ const ReactNativeBridgeEventPlugin = {
|
||||
*/
|
||||
extractEvents: function(
|
||||
topLevelType: TopLevelType,
|
||||
targetInst: Object,
|
||||
targetInst: null | Object,
|
||||
nativeEvent: AnyNativeEvent,
|
||||
nativeEventTarget: Object,
|
||||
): ?Object {
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ declare module 'FabricUIManager' {
|
||||
viewName: string,
|
||||
rootTag: number,
|
||||
props: ?Object,
|
||||
instanceHandle: Object,
|
||||
eventTarget: Object,
|
||||
): Object;
|
||||
declare function cloneNode(node: Object, instanceHandle: Object): Object;
|
||||
declare function cloneNodeWithNewChildren(
|
||||
@@ -124,7 +124,7 @@ declare module 'FabricUIManager' {
|
||||
declare function completeRoot(rootTag: number, childSet: Object): void;
|
||||
declare function registerEventHandler(
|
||||
callback: (
|
||||
instanceHandle: Object,
|
||||
eventTarget: null | Object,
|
||||
type: RNTopLevelEventType,
|
||||
payload: Object,
|
||||
) => void,
|
||||
|
||||
Reference in New Issue
Block a user