Skip to content

Commit 2afe7d4

Browse files
sherginfacebook-github-bot
authored andcommitted
Support for inherited events in view managers
Summary: We currently support inherited view props but not event handlers, this diff fixes it. This change will allow to unify set of supported events for single- and multli-line <TextInput>s and avoid code duplication. Reviewed By: sahrens Differential Revision: D6690281 fbshipit-source-id: f142828bd7deae92fb306914b7cefd10da8b43f7
1 parent d5e3f08 commit 2afe7d4

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Libraries/ReactNative/requireNativeComponent.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,34 @@ function requireNativeComponent(
133133
}
134134

135135
let baseModuleName = viewConfig.baseModuleName;
136-
let nativeProps = {...viewConfig.NativeProps};
136+
let bubblingEventTypes = viewConfig.bubblingEventTypes;
137+
let directEventTypes = viewConfig.directEventTypes;
138+
let nativeProps = viewConfig.NativeProps;
137139
while (baseModuleName) {
138140
const baseModule = UIManager[baseModuleName];
139141
if (!baseModule) {
140142
warning(false, 'Base module "%s" does not exist', baseModuleName);
141143
baseModuleName = null;
142144
} else {
143-
nativeProps = {...nativeProps, ...baseModule.NativeProps};
145+
bubblingEventTypes = {
146+
...baseModule.bubblingEventTypes,
147+
...bubblingEventTypes,
148+
};
149+
directEventTypes = {
150+
...baseModule.directEventTypes,
151+
...directEventTypes,
152+
};
153+
nativeProps = {
154+
...baseModule.NativeProps,
155+
...nativeProps,
156+
};
144157
baseModuleName = baseModule.baseModuleName;
145158
}
146159
}
147160

161+
viewConfig.bubblingEventTypes = bubblingEventTypes;
162+
viewConfig.directEventTypes = directEventTypes;
163+
148164
for (const key in nativeProps) {
149165
let useAttribute = false;
150166
const attribute = {};

0 commit comments

Comments
 (0)