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 e1d36d9ecb..84a9ffaf28 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 @@ -930,7 +930,7 @@ const COMMANDS: SchemaType = { }, }, { - name: 'hotspotUpdate', + name: 'allTypes', optional: false, typeAnnotation: { type: 'FunctionTypeAnnotation', @@ -941,27 +941,6 @@ const COMMANDS: SchemaType = { type: 'Int32TypeAnnotation', }, }, - { - name: 'y', - typeAnnotation: { - type: 'Int32TypeAnnotation', - }, - }, - ], - }, - }, - { - name: 'scrollTo', - optional: false, - typeAnnotation: { - type: 'FunctionTypeAnnotation', - params: [ - { - name: 'y', - typeAnnotation: { - type: 'Int32TypeAnnotation', - }, - }, { name: 'animated', typeAnnotation: { 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 7732177b6a..03707d2a32 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 @@ -86,8 +86,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol CommandNativeComponentViewProtocol - (void)flashScrollIndicators; -- (void)hotspotUpdate:(NSInteger)x y:(NSInteger)y; -- (void)scrollTo:(NSInteger)y animated:(BOOL)animated; +- (void)allTypes:(NSInteger)x animated:(BOOL)animated; @end RCT_EXTERN inline void CommandNativeComponentHandleCommand( @@ -109,7 +108,7 @@ RCT_EXTERN inline void CommandNativeComponentHandleCommand( return; } -if ([commandName isEqualToString:@\\"hotspotUpdate\\"]) { +if ([commandName isEqualToString:@\\"allTypes\\"]) { #if RCT_DEBUG if ([args count] != 2) { RCTLogError(@\\"%@ command %@ received %d arguments, expected %d.\\", @\\"CommandNativeComponent\\", commandName, (int)[args count], 2); @@ -125,34 +124,6 @@ if ([commandName isEqualToString:@\\"hotspotUpdate\\"]) { #endif NSInteger x = [(NSNumber *)arg0 intValue]; -#if RCT_DEBUG - NSObject *arg1 = args[1]; - if (!RCTValidateTypeOfViewCommandArgument(arg1, [NSNumber class], @\\"number\\", @\\"CommandNativeComponent\\", commandName, @\\"2nd\\")) { - return; - } -#endif - NSInteger y = [(NSNumber *)arg1 intValue]; - - [componentView hotspotUpdate:x y:y] - return; -} - -if ([commandName isEqualToString:@\\"scrollTo\\"]) { -#if RCT_DEBUG - if ([args count] != 2) { - RCTLogError(@\\"%@ command %@ received %d arguments, expected %d.\\", @\\"CommandNativeComponent\\", commandName, (int)[args count], 2); - return; - } -#endif - -#if RCT_DEBUG - NSObject *arg0 = args[0]; - if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @\\"number\\", @\\"CommandNativeComponent\\", commandName, @\\"1st\\")) { - return; - } -#endif - NSInteger y = [(NSNumber *)arg0 intValue]; - #if RCT_DEBUG NSObject *arg1 = args[1]; if (!RCTValidateTypeOfViewCommandArgument(arg1, [NSNumber class], @\\"boolean\\", @\\"CommandNativeComponent\\", commandName, @\\"2nd\\")) { @@ -161,7 +132,7 @@ if ([commandName isEqualToString:@\\"scrollTo\\"]) { #endif BOOL animated = [(NSNumber *)arg1 boolValue]; - [componentView scrollTo:y animated:animated] + [componentView allTypes:x animated:animated] return; } 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 7298736e26..13d5a9bd04 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 @@ -99,11 +99,8 @@ public class CommandNativeComponentViewManagerDelegate { case \\"flashScrollIndicators\\": viewManager.flashScrollIndicators(view); break; - case \\"hotspotUpdate\\": - viewManager.hotspotUpdate(view, args.getInt(0), args.getInt(1)); - break; - case \\"scrollTo\\": - viewManager.scrollTo(view, args.getInt(0), args.getBoolean(1)); + case \\"allTypes\\": + viewManager.allTypes(view, args.getInt(0), args.getBoolean(1)); break; } } 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 c61813c939..cc7b4feca8 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 @@ -62,8 +62,7 @@ import android.view.View; public interface CommandNativeComponentViewManagerInterface { // No props void flashScrollIndicators(T view); - void hotspotUpdate(T view, int x, int y); - void scrollTo(T view, int y, boolean animated); + void allTypes(T view, int x, boolean animated); } ", } 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 11d15d3c57..b4897e9f69 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 @@ -152,19 +152,11 @@ export const Commands = { ); }, - hotspotUpdate(ref, x, y) { + allTypes(ref, x, animated) { UIManager.dispatchViewCommand( findNodeHandle(ref), - UIManager.getViewManagerConfig(\\"CommandNativeComponent\\").Commands.hotspotUpdate, - [x, y] - ); - }, - - scrollTo(ref, y, animated) { - UIManager.dispatchViewCommand( - findNodeHandle(ref), - UIManager.getViewManagerConfig(\\"CommandNativeComponent\\").Commands.scrollTo, - [y, animated] + UIManager.getViewManagerConfig(\\"CommandNativeComponent\\").Commands.allTypes, + [x, animated] ); } };