@@ -4,28 +4,57 @@ import ReactAppDependencyProvider
44
55@objc public class ReactNativeBrownfield : RCTDefaultReactNativeFactoryDelegate {
66 @objc public static let shared = ReactNativeBrownfield ( )
7-
8- @objc public var entryFile : String
9- @objc public var fallbackResource : String ?
10- @objc public var bundlePath : String
11- @objc public var reactNativeFactory : RCTReactNativeFactory ?
127 private var onBundleLoaded : ( ( ) -> Void ) ?
13-
14- private override init ( ) {
15- self . entryFile = " index "
16- self . fallbackResource = nil
17- self . bundlePath = " main.jsbundle "
18- super. init ( )
19- }
20-
8+
9+ /**
10+ * Path to JavaScript root.
11+ * Default value: "index"
12+ */
13+ @objc public var entryFile : String = " index "
14+ /**
15+ * Path to bundle fallback resource.
16+ * Default value: nil
17+ */
18+ @objc public var fallbackResource : String ? = nil
19+ /**
20+ * Path to JavaScript bundle file.
21+ * Default value: "main.jsbundle"
22+ */
23+ @objc public var bundlePath : String = " main.jsbundle "
24+ /**
25+ * React Native factory instance created when starting React Native.
26+ * Default value: nil
27+ */
28+ @objc public var reactNativeFactory : RCTReactNativeFactory ? = nil
29+ /**
30+ * Root view factory used to create React Native views.
31+ */
32+ @objc lazy public var rootViewFactory : RCTRootViewFactory ? = {
33+ return reactNativeFactory? . rootViewFactory
34+ } ( )
35+
36+ /**
37+ * Starts React Native with default parameters.
38+ */
2139 @objc public func startReactNative( ) {
2240 startReactNative ( onBundleLoaded: nil )
2341 }
2442
43+ /**
44+ * Starts React Native with optional callback when bundle is loaded.
45+ *
46+ * @param onBundleLoaded Optional callback invoked after JS bundle is fully loaded.
47+ */
2548 @objc public func startReactNative( onBundleLoaded: ( ( ) -> Void ) ? ) {
2649 startReactNative ( onBundleLoaded: onBundleLoaded, launchOptions: nil )
2750 }
2851
52+ /**
53+ * Starts React Native with optional callback and launch options.
54+ *
55+ * @param onBundleLoaded Optional callback invoked after JS bundle is fully loaded.
56+ * @param launchOptions Launch options, typically passed from AppDelegate.
57+ */
2958 @objc public func startReactNative( onBundleLoaded: ( ( ) -> Void ) ? , launchOptions: [ AnyHashable : Any ] ? ) {
3059 guard reactNativeFactory == nil else { return }
3160
@@ -58,7 +87,7 @@ import ReactAppDependencyProvider
5887 NotificationCenter . default. removeObserver ( self )
5988 }
6089
61- // MARK: - RCTBridgeDelegate Methods
90+ // MARK: - RCTReactNativeFactoryDelegate Methods
6291
6392 @objc public override func sourceURL( for bridge: RCTBridge ) -> URL ? {
6493 return bundleURL ( )
@@ -79,6 +108,12 @@ import ReactAppDependencyProvider
79108}
80109
81110extension Notification . Name {
111+ /**
112+ * Notification sent when React Native wants to navigate back to native screen.
113+ */
82114 public static let popToNative = Notification . Name ( " PopToNativeNotification " )
115+ /**
116+ * Notification sent to enable/disable the pop gesture recognizer.
117+ */
83118 public static let togglePopGestureRecognizer = Notification . Name ( " TogglePopGestureRecognizerNotification " )
84119}
0 commit comments