From 36612a8060993b7ffabdd0ec39cbe8f57fca0779 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Tue, 9 Nov 2021 00:27:31 -0800 Subject: [PATCH] Default {bubbling,direct}EventTypes to {} in Native VCs Summary: ## Rationale **Consistency with Static View Configs:** Static view config will default bubblingEventTypes or directEventTypesto to an empty object, if the any of them are undefined. https://www.internalfb.com/code/fbsource/[a73d46ab4052838e46e0f3aab8508025795aec1f]/xplat/js/react-native-github/Libraries/NativeComponent/ViewConfig.js?lines=20-23%2C26-33%2C41%2C43-50 Changelog: [Internal] Reviewed By: yungsters Differential Revision: D32159393 fbshipit-source-id: fefb3509b9b7c7374d2c3d8962afa5402daf6f72 --- Libraries/ReactNative/getNativeComponentAttributes.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/ReactNative/getNativeComponentAttributes.js b/Libraries/ReactNative/getNativeComponentAttributes.js index 6f2bd8a8ae2..1359c9901a8 100644 --- a/Libraries/ReactNative/getNativeComponentAttributes.js +++ b/Libraries/ReactNative/getNativeComponentAttributes.js @@ -35,6 +35,10 @@ function getNativeComponentAttributes(uiViewClassName: string): any { // native component that can be either avoided or simplified. let {baseModuleName, bubblingEventTypes, directEventTypes} = viewConfig; let nativeProps = viewConfig.NativeProps; + + bubblingEventTypes = bubblingEventTypes ?? {}; + directEventTypes = directEventTypes ?? {}; + while (baseModuleName) { const baseModule = UIManager.getViewManagerConfig(baseModuleName); if (!baseModule) {