-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate code to allow for linking custom Module that conforms to som…
…e protocols (#42923) Summary: Pull Request resolved: #42923 This Diff implement the logic to: - Read some lists of class names provided by libraries that conforms to some protocols we defined as extension points. - Generate a provider in the React-Codegen podspec, whose code lives alongside the app code. - Glue the app and the generated code together, allowing to link custom protocols ## Changelog [iOS][Added] - Allow libraries to provide module which conforms to protocols meant to be extension points. Reviewed By: RSNara Differential Revision: D53441411 fbshipit-source-id: f53bc6ea0417e6122d8918df2614bcb9937a515a
- Loading branch information
1 parent
f9a5b30
commit 46d7f8a
Showing
5 changed files
with
173 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
.../react-native/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface RCTModulesConformingToProtocolsProvider: NSObject | ||
|
||
+(NSArray<NSString *> *)imageURLLoaderClassNames; | ||
|
||
+(NSArray<NSString *> *)imageDataDecoderClassNames; | ||
|
||
+(NSArray<NSString *> *)URLRequestHandlerClassNames; | ||
|
||
@end |
33 changes: 33 additions & 0 deletions
33
...react-native/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#import "RCTModulesConformingToProtocolsProvider.h" | ||
|
||
@implementation RCTModulesConformingToProtocolsProvider | ||
|
||
+(NSArray<NSString *> *)imageURLLoaderClassNames | ||
{ | ||
return @[ | ||
{imageURLLoaderClassNames} | ||
]; | ||
} | ||
|
||
+(NSArray<NSString *> *)imageDataDecoderClassNames | ||
{ | ||
return @[ | ||
{imageDataDecoderClassNames} | ||
]; | ||
} | ||
|
||
+(NSArray<NSString *> *)URLRequestHandlerClassNames | ||
{ | ||
return @[ | ||
{requestHandlersClassNames} | ||
]; | ||
} | ||
|
||
@end |