public CodePushReactPackage(string deploymentKey, ReactNativeHost host)
        {
            AppVersion    = CodePushUtils.GetAppVersion();
            DeploymentKey = deploymentKey;
            Host          = host;
            UpdateManager = new UpdateManager();

            if (CurrentInstance != null)
            {
                CodePushUtils.Log("More than one CodePush instance has been initialized. Please use the instance method codePush.getBundleUrlInternal() to get the correct bundleURL for a particular instance.");
            }

            CurrentInstance = this;
        }
        public void LoadReact()
        {
            ReactNativeHost host = new ReactNativeHost();

            host.InstanceSettings.MainComponentName        = JSFileName;
            host.InstanceSettings.JavaScriptMainModuleName = JSFileName;
            host.InstanceSettings.UseLiveReload            = true;
            host.InstanceSettings.UseWebDebugger           = true;
            host.InstanceSettings.EnableDeveloperMenu      = true;
            host.ReloadInstance();

            RootElement.ComponentName = JSComponentName;
            JSValue initialProps = new JSValueObject {
                ["one"] = "1", ["two"] = "2"
            };

            RootElement.InitialProps    = (IJSValueWriter writer) => writer.WriteValue(initialProps);
            RootElement.ReactNativeHost = host;
        }
示例#3
0
 public void ReloadInstance()
 {
     ReactNativeHost.FromContext(_reactContext.Handle).ReloadInstance();
 }
示例#4
0
 public static void OnCreate(this ReactRootView rootView, ReactNativeHost host)
 {
     // TODO: add global keyboard shortcuts
 }