Ejemplo n.º 1
0
        public ReactView(bool usePreloadedWebView = true)
        {
            if (usePreloadedWebView)
            {
                view = CreateReactViewInstance();
            }
            else
            {
                view = new ReactViewRender(false);
            }
            SetResourceReference(StyleProperty, typeof(ReactView)); // force styles to be inherited, must be called after view is created otherwise view might be null
            Content = view;
            Dispatcher.BeginInvoke(DispatcherPriority.Send, (Action)(() => {
                if (!view.IsDisposing)
                {
                    if (EnableHotReload)
                    {
                        view.EnableHotReload(Source);
                    }
                    view.LoadComponent(this);
                }
            }));

            FocusManager.SetIsFocusScope(this, true);
            FocusManager.SetFocusedElement(this, view.FocusableElement);
        }
Ejemplo n.º 2
0
 public ReactView(bool usePreloadedWebView = true)
 {
     if (usePreloadedWebView)
     {
         view = CreateReactViewInstance();
     }
     else
     {
         view = new ReactViewRender();
     }
     SetResourceReference(StyleProperty, typeof(ReactView)); // force styles to be inherited, must be called after view is created otherwise view might be null
     Content = view;
     Dispatcher.BeginInvoke(DispatcherPriority.Send, (Action)(() => {
         if (EnableHotReload)
         {
             view.EnableHotReload(Source);
         }
         view.LoadComponent(JavascriptSource, JavascriptName, CreateNativeObject());
     }));
 }