Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/events/EventPluginHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -229,7 +229,7 @@ export function runEventsInBatch(

export function runExtractedEventsInBatch(
topLevelType: TopLevelType,
targetInst: Fiber,
targetInst: null | Fiber,
nativeEvent: AnyNativeEvent,
nativeEventTarget: EventTarget,
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/events/PluginModuleType.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type PluginModule<NativeEvent> = {
eventTypes: EventTypes,
extractEvents: (
topLevelType: TopLevelType,
targetInst: Fiber,
targetInst: null | Fiber,
nativeTarget: NativeEvent,
nativeEventTarget: EventTarget,
) => ?ReactSyntheticEvent,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/SimpleEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const SimpleEventPlugin: PluginModule<MouseEvent> & {

extractEvents: function(
topLevelType: TopLevelType,
targetInst: Fiber,
targetInst: null | Fiber,
nativeEvent: MouseEvent,
nativeEventTarget: EventTarget,
): null | ReactSyntheticEvent {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-renderer/src/ReactFabricEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import type {TopLevelType} from 'events/TopLevelEventTypes';
export {getListener, registrationNameModules as registrationNames};

export function dispatchEvent(
target: Object,
target: null | Object,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what cases is target not a Fiber? Like could this type be null | Fiber?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's never not a Fiber, hence the case below, but the caller cannot guarantee it right now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately it is because the "internalInstanceHandle" is supposed to be an opaque object as far as the host configs are concerned. So it should really be using opaque types instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. This makes sense.

topLevelType: TopLevelType,
nativeEvent: AnyNativeEvent,
) {
const targetFiber = (target: Fiber);
const targetFiber = (target: null | Fiber);
batchedUpdates(function() {
runExtractedEventsInBatch(
topLevelType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ReactNativeBridgeEventPlugin = {
*/
extractEvents: function(
topLevelType: TopLevelType,
targetInst: Object,
targetInst: null | Object,
nativeEvent: AnyNativeEvent,
nativeEventTarget: Object,
): ?Object {
Expand Down
4 changes: 2 additions & 2 deletions scripts/flow/react-native-host-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down