-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSandboxReactNativeDelegate.h
More file actions
48 lines (38 loc) · 1.6 KB
/
SandboxReactNativeDelegate.h
File metadata and controls
48 lines (38 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// SandboxReactNativeDelegate.h
// react-native-multinstance
//
// Created by Aliaksandr Babrykovich on 25/06/2025.
//
#import <Foundation/Foundation.h>
#import <React-RCTAppDelegate/RCTDefaultReactNativeFactoryDelegate.h>
#import <React/RCTComponent.h>
#import <react/renderer/components/RNMultInstanceSpec/EventEmitters.h>
NS_ASSUME_NONNULL_BEGIN
/**
* A React Native delegate that provides sandboxed environments with filtered module access.
* This delegate uses RCTFilteredAppDependencyProvider to restrict which native modules
* are available to the JavaScript runtime, enhancing security in multi-instance scenarios.
*/
@interface SandboxReactNativeDelegate : RCTDefaultReactNativeFactoryDelegate
@property (nonatomic) std::shared_ptr<const facebook::react::SandboxReactNativeViewEventEmitter> eventEmitter;
@property (nonatomic, assign) BOOL hasOnMessageHandler;
@property (nonatomic, assign) BOOL hasOnErrorHandler;
/**
* Sets the list of allowed TurboModules for this sandbox instance.
* Only modules in this list will be accessible to the JavaScript runtime.
*/
@property (nonatomic, copy) NSArray<NSString *> *allowedTurboModules;
/**
* Initializes the delegate with a specific JS bundle source.
* @param jsBundleSource The source for the JavaScript bundle (file path or URL)
* @return Initialized delegate instance with filtered module access
*/
- (instancetype)initWithJSBundleSource:(NSString *)jsBundleSource;
/**
* Posts a message to the JavaScript runtime.
* @param message String containing the JSON.stringified message
*/
- (void)postMessage:(NSString *)message;
@end
NS_ASSUME_NONNULL_END