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
This commit is contained in:
parent
d5e3f081c6
commit
2afe7d4765
|
@ -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 = {};
|
||||
|
|
Loading…
Reference in New Issue