Integrating React Native into exsting app -
integration existing apps shows
rctrootview *rootview = [[rctrootview alloc] initwithbundleurl: jscodelocation modulename: @"rnhighscores" initialproperties: nil launchoptions: nil]; uiviewcontroller *vc = [[uiviewcontroller alloc] init]; vc.view = rootview; [self presentviewcontroller:vc animated:yes completion:nil];
that construct rn view presenting view controller, not in presented view controller.
whereas android, doc shows way create reactrootview presented(created) activity.
public class myreactactivity extends activity implements defaulthardwarebackbtnhandler { private reactrootview mreactrootview; private reactinstancemanager mreactinstancemanager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mreactrootview = new reactrootview(this); mreactinstancemanager = reactinstancemanager.builder() .setapplication(getapplication()) .setbundleassetname("index.android.bundle") .setjsmainmodulename("index.android") .addpackage(new mainreactpackage()) .setusedevelopersupport(buildconfig.debug) .setinitiallifecyclestate(lifecyclestate.resumed) .build(); mreactrootview.startreactapplication(mreactinstancemanager, "helloworld", null); setcontentview(mreactrootview); } }
would possible ios app similar above android code do? create custom view controller , instantiate rctrootview in viewdidload.
there drawback doing that?
yes work. although don't know if there's drawback.
Comments
Post a Comment