Skip to content
Permalink
Browse files

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
  • Loading branch information...
shergin authored and facebook-github-bot committed Jan 12, 2018
1 parent d5e3f08 commit 2afe7d4765ffc0d0c71d233211edd1d21972040e
Showing with 18 additions and 2 deletions.
  1. +18 −2 Libraries/ReactNative/requireNativeComponent.js
@@ -133,18 +133,34 @@ function requireNativeComponent(
}

let baseModuleName = viewConfig.baseModuleName;
let nativeProps = {...viewConfig.NativeProps};
let bubblingEventTypes = viewConfig.bubblingEventTypes;
let directEventTypes = viewConfig.directEventTypes;
let nativeProps = viewConfig.NativeProps;
while (baseModuleName) {
const baseModule = UIManager[baseModuleName];
if (!baseModule) {
warning(false, 'Base module "%s" does not exist', baseModuleName);
baseModuleName = null;
} else {
nativeProps = {...nativeProps, ...baseModule.NativeProps};
bubblingEventTypes = {
...baseModule.bubblingEventTypes,
...bubblingEventTypes,
};
directEventTypes = {
...baseModule.directEventTypes,
...directEventTypes,
};
nativeProps = {
...baseModule.NativeProps,
...nativeProps,
};
baseModuleName = baseModule.baseModuleName;
}
}

viewConfig.bubblingEventTypes = bubblingEventTypes;
viewConfig.directEventTypes = directEventTypes;

for (const key in nativeProps) {
let useAttribute = false;
const attribute = {};

0 comments on commit 2afe7d4

Please sign in to comment.
You can’t perform that action at this time.