Esempio n. 1
0
        /// <summary>
        /// Instantiates a <see cref="UIManagerModule"/>.
        /// </summary>
        /// <param name="reactContext">The React context.</param>
        /// <param name="viewManagers">The view managers.</param>
        /// <param name="uiImplementationProvider">The UI implementation provider.</param>
        /// <param name="layoutActionQueue">The layout action queue.</param>
        /// <param name="options">Options for the <see cref="UIManagerModule"/>.</param>
        public UIManagerModule(
            ReactContext reactContext,
            IReadOnlyList <IViewManager> viewManagers,
            UIImplementationProvider uiImplementationProvider,
            IActionQueue layoutActionQueue,
            UIManagerModuleOptions options)
            : base(reactContext, layoutActionQueue)
        {
            if (viewManagers == null)
            {
                throw new ArgumentNullException(nameof(viewManagers));
            }
            if (uiImplementationProvider == null)
            {
                throw new ArgumentNullException(nameof(uiImplementationProvider));
            }
            if (layoutActionQueue == null)
            {
                throw new ArgumentNullException(nameof(layoutActionQueue));
            }

            _eventDispatcher  = new EventDispatcher(reactContext);
            _uiImplementation = uiImplementationProvider.Create(reactContext, viewManagers, _eventDispatcher);
            var lazyViewManagersEnabled = IsLazyViewManagersEnabled(options);

            _customDirectEvents = lazyViewManagersEnabled ? GetDirectEventTypeConstants() : new JObject();
            _moduleConstants    = CreateConstants(viewManagers, null, _customDirectEvents, IsLazyViewManagersEnabled(options));
            _layoutActionQueue  = layoutActionQueue;
            reactContext.AddLifecycleEventListener(this);
        }
Esempio n. 2
0
 private static bool IsLazyViewManagersEnabled(UIManagerModuleOptions options)
 {
     return((options & UIManagerModuleOptions.LazyViewManagers) == UIManagerModuleOptions.LazyViewManagers);
 }