mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
1cb0a3342a
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43068 This diff adds `react-native-test-library` package. It contains native module and native component example, and targets both the new and the old architecture. It has structure similar to many OSS React Native libraries, and is supposed to be used to test the integration with third-party libraries. It is integrated with RNTester as the **OSS Library Example** screen. {F1457510909} **Change Background** tests native commands. **Set Opacity** tests native props. **Get Random Number** tests native module. Changelog: [Internal] Reviewed By: RSNara Differential Revision: D50793835 fbshipit-source-id: ff6daefab10e6e9f13049e3013f8f63cfa8a929e
50 lines
1.4 KiB
Objective-C
50 lines
1.4 KiB
Objective-C
/**
|
|
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
*
|
|
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
* once the code is regenerated.
|
|
*
|
|
* @generated by codegen project: GenerateComponentHObjCpp.js
|
|
*/
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import <React/RCTDefines.h>
|
|
#import <React/RCTLog.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@protocol RCTSampleNativeComponentViewProtocol <NSObject>
|
|
- (void)changeBackgroundColor:(NSString *)color;
|
|
@end
|
|
|
|
RCT_EXTERN inline void RCTSampleNativeComponentHandleCommand(
|
|
id<RCTSampleNativeComponentViewProtocol> componentView,
|
|
NSString const *commandName,
|
|
NSArray const *args)
|
|
{
|
|
if ([commandName isEqualToString:@"changeBackgroundColor"]) {
|
|
#if RCT_DEBUG
|
|
if ([args count] != 1) {
|
|
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"SampleNativeComponent", commandName, (int)[args count], 1);
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
NSObject *arg0 = args[0];
|
|
#if RCT_DEBUG
|
|
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSString class], @"string", @"SampleNativeComponent", commandName, @"1st")) {
|
|
return;
|
|
}
|
|
#endif
|
|
NSString * color = (NSString *)arg0;
|
|
|
|
[componentView changeBackgroundColor:color];
|
|
return;
|
|
}
|
|
|
|
#if RCT_DEBUG
|
|
RCTLogError(@"%@ received command %@, which is not a supported command.", @"SampleNativeComponent", commandName);
|
|
#endif
|
|
}
|
|
|
|
NS_ASSUME_NONNULL_END |