Skip to content

Commit 25571ec

Browse files
alloyfacebook-github-bot
authored andcommitted
Make C++ requirement opt-in (#27730)
Summary: When building as a framework these headers get automatically added to the framework umbrella header for React-Core. Instead of converting all the React sources to ObjC++ files and still forcing external users that build native source (and link against a framework build) to also compile as ObjC++, this makes the attribution related methods that were added in fdcdca4 opt-in to ObjC++ builds. This is also the reason for the current failure of the CI `test_ios_frameworks` run. ## Changelog I’m unsure if this change really warrants an entry in the CHANGELOG, as it’s more of an amendment of the (afaik) unreleased [change](fdcdca4). [iOS] [Fixed] - Make framework builds work again by making `RCTImageLoader` C++ requirement opt-in Pull Request resolved: #27730 Test Plan: I tested static and dynamic (framework) builds and ran the test suite. This change should make the `test_ios_frameworks` CI run _build_ again, ~~but it may still fail overall as in my local testing one of the tests leads to a segfault (which I will try to address separately)~~. Reviewed By: PeteTheHeat Differential Revision: D19348846 Pulled By: fkgozali fbshipit-source-id: 8a74e6f7ad3ddce2cf10b080b9a5d7b399bd5fc0
1 parent f8a75d5 commit 25571ec

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Libraries/Image/RCTImageLoaderWithAttributionProtocol.h

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ RCT_EXTERN void RCTEnableImageLoadingPerfInstrumentation(BOOL enabled);
1717

1818
@protocol RCTImageLoaderWithAttributionProtocol<RCTImageLoaderProtocol>
1919

20+
// TODO (T61325135): Remove C++ checks
21+
#ifdef __cplusplus
2022
/**
2123
* Same as the variant in RCTImageURLLoaderProtocol, but allows passing attribution
2224
* information that each image URL loader can process.
@@ -30,6 +32,8 @@ RCT_EXTERN void RCTEnableImageLoadingPerfInstrumentation(BOOL enabled);
3032
progressBlock:(RCTImageLoaderProgressBlock)progressBlock
3133
partialLoadBlock:(RCTImageLoaderPartialLoadBlock)partialLoadBlock
3234
completionBlock:(RCTImageLoaderCompletionBlock)completionBlock;
35+
#endif
36+
3337
/**
3438
* Image instrumentation - notify that the image content (UIImage) has been set on the native view.
3539
*/

Libraries/Image/RCTImageURLLoaderWithAttribution.h

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#import <React/RCTImageURLLoader.h>
99

10+
// TODO (T61325135): Remove C++ checks
11+
#ifdef __cplusplus
1012
namespace facebook {
1113
namespace react {
1214

@@ -17,6 +19,7 @@ struct ImageURLLoaderAttribution {
1719

1820
} // namespace react
1921
} // namespace facebook
22+
#endif
2023

2124
@interface RCTImageURLLoaderRequest : NSObject
2225

@@ -35,6 +38,8 @@ struct ImageURLLoaderAttribution {
3538
*/
3639
@protocol RCTImageURLLoaderWithAttribution <RCTImageURLLoader>
3740

41+
// TODO (T61325135): Remove C++ checks
42+
#ifdef __cplusplus
3843
/**
3944
* Same as the RCTImageURLLoader variant above, but allows optional `attribution` information.
4045
* Caller may also specify a preferred requestId for tracking purpose.
@@ -48,6 +53,7 @@ struct ImageURLLoaderAttribution {
4853
progressHandler:(RCTImageLoaderProgressBlock)progressHandler
4954
partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler
5055
completionHandler:(RCTImageLoaderCompletionBlock)completionHandler;
56+
#endif
5157

5258
/**
5359
* Image instrumentation - notify that the image content (UIImage) has been set on the native view.

0 commit comments

Comments
 (0)