React native, singleton bridge for android? -


https://www.raywenderlich.com/136047/react-native-existing-app mentions it's best use single bridge react views. although doesn't why.

i not sure if need similar android react native. couldn't find example/tutorial it.
need use single bridge rn android? if i'd know reason behind well..

import foundation import react  class mixerreactmodule: nsobject {   var bridge: rctbridge?   static let sharedinstance = mixerreactmodule()     func createbridgeifneeded() -> rctbridge {     if bridge == nil {       bridge = rctbridge.init(delegate: self, launchoptions: nil)     }     return bridge!   }    func viewformodule(_ modulename: string, initialproperties: [string : any]?) -> rctrootview {     let viewbridge = createbridgeifneeded()     let rootview: rctrootview = rctrootview(       bridge: viewbridge,       modulename: modulename,       initialproperties: initialproperties)     return rootview   } }  extension mixerreactmodule: rctbridgedelegate {   func sourceurl(for bridge: rctbridge!) -> url! {     // return url below during development     return url(string: "http://localhost:8081/index.ios.bundle?platform=ios")      // return bundle below if using pre-bundled file on disk     //return bundle.main.url(forresource: "main", withextension: "jsbundle")   } } 


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -