mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Pass context through to all prop parser (props structs changes)
Summary: See previous diffs for context. This updates all of the relevant props structs. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D29855426 fbshipit-source-id: 30177c3380ef82ecf8f2a4321f128cfbe8a576e0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
09b9422516
commit
5d33e65694
+4
-2
@@ -40,6 +40,7 @@ namespace react {
|
||||
|
||||
const componentTemplate = `
|
||||
::_CLASSNAME_::::::_CLASSNAME_::(
|
||||
const PropsParserContext &context,
|
||||
const ::_CLASSNAME_:: &sourceProps,
|
||||
const RawProps &rawProps):::_EXTEND_CLASSES_::
|
||||
|
||||
@@ -51,7 +52,7 @@ function generatePropsString(componentName: string, component: ComponentShape) {
|
||||
return component.props
|
||||
.map(prop => {
|
||||
const defaultValue = convertDefaultTypeToString(componentName, prop);
|
||||
return `${prop.name}(convertRawProp(rawProps, "${prop.name}", sourceProps.${prop.name}, {${defaultValue}}))`;
|
||||
return `${prop.name}(convertRawProp(context, rawProps, "${prop.name}", sourceProps.${prop.name}, {${defaultValue}}))`;
|
||||
})
|
||||
.join(',\n' + ' ');
|
||||
}
|
||||
@@ -65,7 +66,7 @@ function getClassExtendString(component): string {
|
||||
case 'ReactNativeBuiltInType':
|
||||
switch (extendProps.knownTypeName) {
|
||||
case 'ReactNativeCoreViewProps':
|
||||
return 'ViewProps(sourceProps, rawProps)';
|
||||
return 'ViewProps(context, sourceProps, rawProps)';
|
||||
default:
|
||||
(extendProps.knownTypeName: empty);
|
||||
throw new Error('Invalid knownTypeName');
|
||||
@@ -91,6 +92,7 @@ module.exports = {
|
||||
const fileName = 'Props.cpp';
|
||||
const allImports: Set<string> = new Set([
|
||||
'#include <react/renderer/core/propsConversions.h>',
|
||||
'#include <react/renderer/core/PropsParserContext.h>',
|
||||
]);
|
||||
|
||||
const componentProps = Object.keys(schema.modules)
|
||||
|
||||
Reference in New Issue
Block a user