Skip to content

Commit

Permalink
mark init as designated initializer for RCTNetworking
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal]

let's add compile time safety so that `RCTNetworking` will always be initialized via `initWithDisabledObservation`.

Differential Revision: D50764524
  • Loading branch information
philIip authored and facebook-github-bot committed Oct 30, 2023
1 parent 4655f20 commit bffa3f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/react-native/Libraries/Network/RCTNetworking.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

@interface RCTNetworking : RCTEventEmitter

- (instancetype)init NS_DESIGNATED_INITIALIZER;

/**
* Allows RCTNetworking instances to be initialized with handlers.
* The handlers will be requested via the bridge's moduleForName method when required.
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/Libraries/Network/RCTNetworking.mm
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ - (instancetype)init
- (instancetype)initWithHandlersProvider:
(NSArray<id<RCTURLRequestHandler>> * (^)(RCTModuleRegistry *moduleRegistry))getHandlers
{
if (self = [super initWithDisabledObservation]) {
if (self = [self init]) {
_handlersProvider = getHandlers;
}
return self;
Expand Down

0 comments on commit bffa3f5

Please sign in to comment.