From b6a23d87930cefef911e15a1da13580c84aa8b80 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Mon, 4 Nov 2019 04:34:45 -0800 Subject: [PATCH] Add excludedPlatform option to CodeSchema Summary: Currently we generate Java ViewManager interfaces and C++ classes for iOS regardless whether the component is supported on platform or it isn't. This adds an option to exclude either iOS to Android in order to avoid this. Changelog: In codegen it is now possible to exclude one or the other platform Reviewed By: rickhanlonii Differential Revision: D18217185 fbshipit-source-id: 1c569b92c92a5b991c96b0abdff6b8ed395e449f --- Libraries/Utilities/codegenNativeComponent.js | 1 + .../react-native-codegen/src/CodegenSchema.js | 3 + .../components/GenerateComponentHObjCpp.js | 4 ++ .../generators/components/GeneratePropsCpp.js | 4 ++ .../generators/components/GeneratePropsH.js | 4 ++ .../components/GeneratePropsJavaDelegate.js | 63 ++++++++++--------- .../components/GeneratePropsJavaInterface.js | 56 ++++++++++------- .../components/__test_fixtures__/fixtures.js | 22 +++++++ .../GenerateComponentDescriptorH-test.js.snap | 26 ++++++++ .../GenerateComponentHObjCpp-test.js.snap | 23 +++++++ .../GenerateEventEmitterCpp-test.js.snap | 23 +++++++ .../GenerateEventEmitterH-test.js.snap | 24 +++++++ .../GeneratePropsCpp-test.js.snap | 29 +++++++++ .../__snapshots__/GeneratePropsH-test.js.snap | 32 ++++++++++ .../GeneratePropsJavaDelegate-test.js.snap | 2 + .../GeneratePropsJavaInterface-test.js.snap | 2 + .../GenerateShadowNodeCpp-test.js.snap | 23 +++++++ .../GenerateShadowNodeH-test.js.snap | 33 ++++++++++ .../__snapshots__/GenerateTests-test.js.snap | 28 +++++++++ .../GenerateViewConfigJs-test.js.snap | 32 ++++++++++ 20 files changed, 381 insertions(+), 53 deletions(-) diff --git a/Libraries/Utilities/codegenNativeComponent.js b/Libraries/Utilities/codegenNativeComponent.js index ed3de783cf0..8e94bb9c2f6 100644 --- a/Libraries/Utilities/codegenNativeComponent.js +++ b/Libraries/Utilities/codegenNativeComponent.js @@ -21,6 +21,7 @@ type Options = $ReadOnly<{| interfaceOnly?: boolean, paperComponentName?: string, paperComponentNameDeprecated?: string, + excludedPlatform?: 'iOS' | 'android', |}>; export type NativeComponentType = HostComponent; diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index ab112fc5e1d..9f5f356fcc2 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -292,6 +292,9 @@ export type OptionsShape = $ReadOnly<{| // Does not check for new name paperComponentName?: string, + // Use for components that are not used on one or the other platform. + excludedPlatform?: 'iOS' | 'android', + // Use for components currently being renamed in paper // Will use new name if it is available and fallback to this name paperComponentNameDeprecated?: string, diff --git a/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js b/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js index e1f76cfb597..d42092d183f 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js @@ -295,6 +295,10 @@ module.exports = { } return Object.keys(components) + .filter(componentName => { + const component = components[componentName]; + return component.excludedPlatform !== 'iOS'; + }) .map(componentName => { return [ generateProtocol(components[componentName], componentName), diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js index 2c190ce179b..dfa114376a7 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js @@ -101,6 +101,10 @@ module.exports = { } return Object.keys(components) + .filter(componentName => { + const component = components[componentName]; + return component.excludedPlatform !== 'iOS'; + }) .map(componentName => { const component = components[componentName]; const newName = `${componentName}Props`; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js index 09e5151affb..8a9bc13f177 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js @@ -772,6 +772,10 @@ module.exports = { } return Object.keys(components) + .filter(componentName => { + const component = components[componentName]; + return component.excludedPlatform !== 'iOS'; + }) .map(componentName => { const component = components[componentName]; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js index fd2598fccdd..8264d85001b 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js @@ -269,38 +269,43 @@ module.exports = { return; } - return Object.keys(components).forEach(componentName => { - const component = components[componentName]; - const className = getDelegateJavaClassName(componentName); - const interfaceClassName = getInterfaceJavaClassName(componentName); - const fileName = `${className}.java`; + return Object.keys(components) + .filter(componentName => { + const component = components[componentName]; + return component.excludedPlatform !== 'android'; + }) + .forEach(componentName => { + const component = components[componentName]; + const className = getDelegateJavaClassName(componentName); + const interfaceClassName = getInterfaceJavaClassName(componentName); + const fileName = `${className}.java`; - const imports = getDelegateImports(component); - const propsString = generatePropCasesString(component, componentName); - const commandsString = generateCommandCasesString( - component, - componentName, - ); - const extendString = getClassExtendString(component); + const imports = getDelegateImports(component); + const propsString = generatePropCasesString(component, componentName); + const commandsString = generateCommandCasesString( + component, + componentName, + ); + const extendString = getClassExtendString(component); - const replacedTemplate = template - .replace( - /::_IMPORTS_::/g, - Array.from(imports) - .sort() - .join('\n'), - ) - .replace(/::_CLASSNAME_::/g, className) - .replace('::_EXTEND_CLASSES_::', extendString) - .replace('::_PROP_CASES_::', propsString) - .replace( - '::_METHODS_::', - generateMethods(propsString, commandsString), - ) - .replace(/::_INTERFACE_CLASSNAME_::/g, interfaceClassName); + const replacedTemplate = template + .replace( + /::_IMPORTS_::/g, + Array.from(imports) + .sort() + .join('\n'), + ) + .replace(/::_CLASSNAME_::/g, className) + .replace('::_EXTEND_CLASSES_::', extendString) + .replace('::_PROP_CASES_::', propsString) + .replace( + '::_METHODS_::', + generateMethods(propsString, commandsString), + ) + .replace(/::_INTERFACE_CLASSNAME_::/g, interfaceClassName); - files.set(fileName, replacedTemplate); - }); + files.set(fileName, replacedTemplate); + }); }); return files; diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js index 64624aedd19..c077532771c 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js @@ -208,33 +208,41 @@ module.exports = { return; } - return Object.keys(components).forEach(componentName => { - const component = components[componentName]; - const className = getInterfaceJavaClassName(componentName); - const fileName = `${className}.java`; + return Object.keys(components) + .filter(componentName => { + const component = components[componentName]; + return component.excludedPlatform !== 'android'; + }) + .forEach(componentName => { + const component = components[componentName]; + const className = getInterfaceJavaClassName(componentName); + const fileName = `${className}.java`; - const imports = getImports(component); - const propsString = generatePropsString(component, imports); - const commandsString = generateCommandsString(component, componentName); - const extendString = getClassExtendString(component); + const imports = getImports(component); + const propsString = generatePropsString(component, imports); + const commandsString = generateCommandsString( + component, + componentName, + ); + const extendString = getClassExtendString(component); - const replacedTemplate = template - .replace( - /::_IMPORTS_::/g, - Array.from(imports) - .sort() - .join('\n'), - ) - .replace(/::_CLASSNAME_::/g, className) - .replace('::_EXTEND_CLASSES_::', extendString) - .replace( - '::_METHODS_::', - [propsString, commandsString].join('\n' + ' ').trimRight(), - ) - .replace('::_COMMAND_HANDLERS_::', commandsString); + const replacedTemplate = template + .replace( + /::_IMPORTS_::/g, + Array.from(imports) + .sort() + .join('\n'), + ) + .replace(/::_CLASSNAME_::/g, className) + .replace('::_EXTEND_CLASSES_::', extendString) + .replace( + '::_METHODS_::', + [propsString, commandsString].join('\n' + ' ').trimRight(), + ) + .replace('::_COMMAND_HANDLERS_::', commandsString); - files.set(fileName, replacedTemplate); - }); + files.set(fileName, replacedTemplate); + }); }); return files; diff --git a/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js index 4f42e7228fc..07d7fae0e0e 100644 --- a/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/generators/components/__test_fixtures__/fixtures.js @@ -1503,6 +1503,27 @@ const COMMANDS_AND_PROPS: SchemaType = { }, }; +const EXCLUDE_ANDROID: SchemaType = { + modules: { + ExcludedAndroid: { + components: { + ExcludedAndroidComponent: { + excludedPlatform: 'android', + extendsProps: [ + { + type: 'ReactNativeBuiltInType', + knownTypeName: 'ReactNativeCoreViewProps', + }, + ], + events: [], + props: [], + commands: [], + }, + }, + }, + }, +}; + module.exports = { NO_PROPS_NO_EVENTS, INTERFACE_ONLY, @@ -1528,4 +1549,5 @@ module.exports = { TWO_COMPONENTS_DIFFERENT_FILES, COMMANDS, COMMANDS_AND_PROPS, + EXCLUDE_ANDROID, }; diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap index 63eb8b4573b..4c64141b0fb 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap @@ -254,6 +254,32 @@ namespace react { +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "ComponentDescriptors.h" => " +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using ExcludedAndroidComponentComponentDescriptor = ConcreteComponentDescriptor; + } // namespace react } // namespace facebook ", diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap index 5db34b255e5..bac54f448e1 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap @@ -345,6 +345,29 @@ NS_ASSUME_NONNULL_END", } `; +exports[`GenerateComponentHObjCpp can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "RCTComponentViewHelpers.h" => "/** +* Copyright (c) Facebook, Inc. and its affiliates. +* +* This source code is licensed under the MIT license found in the +* LICENSE file in the root directory of this source tree. +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTExcludedAndroidComponentViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + exports[`GenerateComponentHObjCpp can generate fixture FLOAT_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap index bfb20e32e71..9fa0d8359c3 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap @@ -281,6 +281,29 @@ void InterfaceOnlyComponentEventEmitter::onDire tChange(InterfaceOnlyComponentOn }); } +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "EventEmitters.cpp" => " +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include + +namespace facebook { +namespace react { + + + } // namespace react } // namespace facebook ", diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap index dc12ee737a0..24434f94dec 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap @@ -306,6 +306,30 @@ class InterfaceOnlyComponentEventEmitter : public ViewEventEmitter { void onDire tChange(InterfaceOnlyComponentOnDire tChangeStruct value) const; }; +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "EventEmitters.h" => " +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + } // namespace react } // namespace facebook ", diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap index c5f7144b53e..2d17c7496dc 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap @@ -306,6 +306,35 @@ InterfaceOnlyComponentProps::InterfaceOnlyComponentProps( } `; +exports[`GeneratePropsCpp can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "Props.cpp" => " +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include +#include + +namespace facebook { +namespace react { + +ExcludedAndroidComponentProps::ExcludedAndroidComponentProps( + const ExcludedAndroidComponentProps &sourceProps, + const RawProps &rawProps): ViewProps(sourceProps, rawProps) + + + {} + +} // namespace react +} // namespace facebook +", +} +`; + exports[`GeneratePropsCpp can generate fixture FLOAT_PROPS 1`] = ` Map { "Props.cpp" => " diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap index 9ce99639af6..86b4dd28d22 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap @@ -540,6 +540,38 @@ class InterfaceOnlyComponentProps final : public ViewProps { #pragma mark - Props +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "Props.h" => " +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +#pragma once + +#include + +namespace facebook { +namespace react { + +class ExcludedAndroidComponentProps final : public ViewProps { + public: + ExcludedAndroidComponentProps() = default; + ExcludedAndroidComponentProps(const ExcludedAndroidComponentProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + }; } // namespace react diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap index b73785b0877..17767543e4c 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap @@ -436,6 +436,8 @@ public class InterfaceOnlyComponentManagerDelegate "/** diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap index 9beaf9edd84..1f52c9c59a8 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap @@ -244,6 +244,8 @@ public interface InterfaceOnlyComponentManagerInterface { } `; +exports[`GeneratePropsJavaInterface can generate fixture EXCLUDE_ANDROID 1`] = `Map {}`; + exports[`GeneratePropsJavaInterface can generate fixture FLOAT_PROPS 1`] = ` Map { "FloatPropNativeComponentManagerInterface.java" => "/** diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap index 8a6a27f1ce6..053638bd5b0 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap @@ -224,6 +224,29 @@ namespace react { +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "ShadowNodes.cpp" => " +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include + +namespace facebook { +namespace react { + +extern const char ExcludedAndroidComponentComponentName[] = \\"ExcludedAndroidComponent\\"; + } // namespace react } // namespace facebook ", diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap index a9978429652..679337e818c 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap @@ -321,6 +321,39 @@ namespace react { +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "ShadowNodes.h" => " +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char ExcludedAndroidComponentComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using ExcludedAndroidComponentShadowNode = ConcreteViewShadowNode< + ExcludedAndroidComponentComponentName, + ExcludedAndroidComponentProps>; + } // namespace react } // namespace facebook ", diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap index 37e5a53ca48..63141765868 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap @@ -326,6 +326,34 @@ TEST(InterfaceOnlyComponentProps_DoesNotDie, etc) { } `; +exports[`GenerateTests can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "Tests.cpp" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include +#include +#include +#include +#include + +using namespace facebook::react; + +TEST(ExcludedAndroidComponentProps_DoesNotDie, etc) { + auto propParser = RawPropsParser(); + propParser.prepare(); + auto const &sourceProps = ExcludedAndroidComponentProps(); + auto const &rawProps = RawProps(folly::dynamic::object(\\"xx_invalid_xx\\", \\"xx_invalid_xx\\")); + rawProps.parse(propParser); + ExcludedAndroidComponentProps(sourceProps, rawProps); +}", +} +`; + exports[`GenerateTests can generate fixture FLOAT_PROPS 1`] = ` Map { "Tests.cpp" => "/** diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap index 57f769d4d52..6a1892f0aa7 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap @@ -447,6 +447,38 @@ export default nativeComponentName; } `; +exports[`GenerateViewConfigJs can generate fixture EXCLUDE_ANDROID 1`] = ` +Map { + "EXCLUDE_ANDROIDNativeViewConfig.js" => " +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ + +'use strict'; + +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); + +const ExcludedAndroidComponentViewConfig = { + uiViewClassName: 'ExcludedAndroidComponent', + validAttributes: {}, +}; + +let nativeComponentName = 'ExcludedAndroidComponent'; + +registerGeneratedViewConfig(nativeComponentName, ExcludedAndroidComponentViewConfig); + +export const __INTERNAL_VIEW_CONFIG = ExcludedAndroidComponentViewConfig; + +export default nativeComponentName; +", +} +`; + exports[`GenerateViewConfigJs can generate fixture FLOAT_PROPS 1`] = ` Map { "FLOAT_PROPSNativeViewConfig.js" => "