public IReadOnlyList <INativeModule> CreateNativeModules(ReactContext reactContext) { var uiManagerModule = default(INativeModule); using (Tracer.Trace(Tracer.TRACE_TAG_REACT_BRIDGE, "createUIManagerModule")) { var viewManagerList = _reactInstanceManager.CreateAllViewManagers(reactContext); uiManagerModule = new UIManagerModule( reactContext, viewManagerList, _uiImplementationProvider.Create( reactContext, viewManagerList)); } return(new List <INativeModule> { //new AnimationsDebugModule( // reactContext, // _reactInstanceManager.DevSupportManager.DevSettings), //new SystemInfoModule(), new DeviceEventManagerModule(reactContext, _hardwareBackButtonHandler), new ExceptionsManagerModule(_reactInstanceManager.DevSupportManager), new Timing(reactContext), new SourceCodeModule( _reactInstanceManager.SourceUrl, _reactInstanceManager.DevSupportManager.SourceMapUrl), uiManagerModule, //new DebugComponentOwnershipModule(reactContext), }); }
public IReadOnlyList <INativeModule> CreateNativeModules(ReactContext reactContext) { var uiManagerModule = default(INativeModule); using (Tracer.Trace(Tracer.TRACE_TAG_REACT_BRIDGE, "createUIManagerModule").Start()) { var layoutActionQueue = new LayoutActionQueue(reactContext.HandleException); var options = _lazyViewManagersEnabled ? UIManagerModuleOptions.LazyViewManagers : UIManagerModuleOptions.None; uiManagerModule = new UIManagerModule( reactContext, _reactInstanceManager.CreateAllViewManagers(reactContext), _uiImplementationProvider, layoutActionQueue, options); } return(new List <INativeModule> { //new AnimationsDebugModule( // reactContext, // _reactInstanceManager.DevSupportManager.DevSettings), new DeviceEventManagerModule(reactContext, _hardwareBackButtonHandler), new DeviceInfoModule(reactContext), new ExceptionsManagerModule(_reactInstanceManager.DevSupportManager), new PlatformConstantsModule(), new SourceCodeModule( _reactInstanceManager.SourceUrl, _reactInstanceManager.DevSupportManager.SourceMapUrl), new Timing(reactContext), uiManagerModule, //new DebugComponentOwnershipModule(reactContext), }); }
public static void UT_DropView(object obj) { for (int i = 1; i <= 15; i++) { Log.Info(ReactConstants.Tag, "## UT_DropView ## thread is Waiting>>>>>>>>>>>>>>>[" + i + " sec]"); Thread.Sleep(1000 * 1); } ReactInstanceManager RCTIntance = (ReactInstanceManager)obj; var currentReactContext = RCTIntance._currentReactContext; Log.Info(ReactConstants.Tag, " ## UT_DropView-2 ## ThreadID=" + Thread.CurrentThread.ManagedThreadId.ToString() + ", RCTIntance=" + RCTIntance); if (currentReactContext != null) { UIManagerModule uiMgrModule = currentReactContext.ReactInstance.GetNativeModule <UIManagerModule>(); Log.Info(ReactConstants.Tag, "### [BGN-2] Destroy a button view ### "); int[] szTagDel = { 0 }; int[] szIndicesDel = { 0, }; uiMgrModule.manageChildren(1, null, null, null, null, szTagDel); uiMgrModule.OnBatchComplete(); Log.Info(ReactConstants.Tag, "### [END-2] Destroy a button view ### "); } }
public void captureRef(int tag, JObject options, IPromise promise) { string format = options["format"] != null?options.Value <string>("format") : "png"; double quality = options["quality"] != null?options.Value <double>("quality") : 1.0; int?width = options["width"] != null?options.Value <int?>("width") : null; int?height = options["height"] != null?options.Value <int?>("height") : null; string result = options["result"] != null?options.Value <string>("result") : "file"; string path = options["path"] != null?options.Value <string>("path") : null; if (format != "png" && format != "jpg" && format != "jpeg") { promise.Reject(ViewShot.ErrorUnableToSnapshot, "Unsupported image format: " + format + ". Try one of: png | jpg | jpeg"); return; } UIManagerModule uiManager = this._reactContext.GetNativeModule <UIManagerModule>(); var viewShot = new ViewShot(tag, format, quality, width, height, path, result, promise); uiManager.AddUIBlock(viewShot); }
/// <summary> /// Called after the creation of a <see cref="IReactInstance"/>, in /// order to initialize native modules that require the React or /// JavaScript modules. /// </summary> public override void Initialize() { Log.Info(ReactConstants.Tag, "## NativeAnimatedModule Initialize ##"); //var ctx = Context; //var uiManager = ctx.GetNativeModule<UIManagerModule>(); //var nodesManager = new NativeAnimatedNodesManager(uiManager); var ctx = Context; _uiMgrModule = ctx.GetNativeModule <UIManagerModule>(); _nativeAnimnodeMgr = new NativeAnimatedNodesManager(_uiMgrModule); /* * // Register the frame callback, instead of relevant cb of EFL * _animatedFrameCallback = (sender, args) => * { * try * { * var renderingArgs = args as RenderingEventArgs; * if (renderingArgs == null) * { * return; * } * * var operations = default(List<Action<NativeAnimatedNodesManager>>); * lock (_operationsGate) * { * operations = _readyOperations; * _readyOperations = null; * } * * if (operations != null) * { * foreach (var operation in operations) * { * operation(nodesManager); * } * } * * if (nodesManager.HasActiveAnimations) * { * nodesManager.RunUpdates(renderingArgs.RenderingTime); * } * } * catch (Exception ex) * { * Context.HandleException(ex); * } * }; */ ctx.AddLifecycleEventListener(this); }
private void Awake() { inst = this; module = new UIManagerModule( (blackhatUI, UIConditions.isBlackHat), (graph, UIConditions.isGraph), (whitehatUI, UIConditions.isWhitehat), (lobbyUI, UIConditions.isLobbyUI), (countdownUI, UIConditions.isCountDownUI), (gameOver, UIConditions.isGameOver), (pauseMenu, UIConditions.isPause)); }
public IReadOnlyList <INativeModule> CreateNativeModules(ReactContext reactContext) { var uiManagerModule = default(INativeModule); using (RNTracer.Trace(RNTracer.TRACE_TAG_REACT_BRIDGE, "createUIManagerModule").Start()) { var viewManagerList = _reactInstanceManager.CreateAllViewManagers(reactContext); #if WINDOWS_UWP uiManagerModule = new UIManagerModule( reactContext, viewManagerList, _uiImplementationProvider.Create( reactContext, viewManagerList)); #else uiManagerModule = new UIManagerModule( reactContext, viewManagerList, _uiImplementationProvider.Create( reactContext, viewManagerList, new EventDispatcher(reactContext)), ReactProgram.RctWindow); #endif } return(new List <INativeModule> { /*new AnimationsDebugModule( * reactContext, * _reactInstanceManager.DevSupportManager.DevSettings),*/ //new SystemInfoModule(), new DeviceEventManagerModule(reactContext, _hardwareBackButtonHandler), new ExceptionsManagerModule(_reactInstanceManager.DevSupportManager), new Timing(reactContext), new TVNavigationEventEmitter(reactContext), new SourceCodeModule( _reactInstanceManager.SourceUrl, _reactInstanceManager.DevSupportManager.SourceMapUrl), uiManagerModule, //new DebugComponentOwnershipModule(reactContext), }); }
public static void UT_CreateView(object obj) { ReactInstanceManager RCTIntance = (ReactInstanceManager)obj; var currentReactContext = RCTIntance._currentReactContext; Log.Info(ReactConstants.Tag, " ## UT_CreateView-1 ## ThreadID=" + Thread.CurrentThread.ManagedThreadId.ToString() + ", RCTIntance=" + RCTIntance); if (currentReactContext != null) { UIManagerModule uiMgrModule = currentReactContext.ReactInstance.GetNativeModule <UIManagerModule>(); Log.Info(ReactConstants.Tag, "### [BGN-1] Create a button view ### "); var prop1 = default(JObject); uiMgrModule.createView(3, "RCTButton", 1, prop1); uiMgrModule.OnBatchComplete(); int[] szTag1 = { 3, }; int[] szIndices1 = { 0, }; uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null); uiMgrModule.OnBatchComplete(); Log.Info(ReactConstants.Tag, "### [END-1] Create a button view ### "); } }
private static IReadOnlyDictionary <string, object> GetEventTypes(UIManagerModule uiManager) { return((IReadOnlyDictionary <string, object>)uiManager.Constants["customDirectEventTypes"]); }
public NativeAnimatedNodesManager(UIManagerModule uiManager) { _uiImplementation = uiManager.UIImplementation; uiManager.EventDispatcher.AddListener(this); _customEventTypes = GetEventTypes(uiManager); }
private static JObject GetEventTypes(UIManagerModule uiManager) { return((JObject)uiManager.ModuleConstants["customDirectEventTypes"]); }
public NativeAnimatedNodesManager(UIManagerModule uiManager) { _uiImplementation = uiManager.UIImplementation; uiManager.EventDispatcher.AddListener(this); _customEventNamesResolver = uiManager.ResolveCustomEventName; }
/// <summary> /// ## UIManagerModule TEST-STUB ## /// </summary> //public static void UT_UIManagerModuleTest(object obj) public void UT_UIManagerModuleTest(object obj) { Log.Info(ReactConstants.Tag, "<<<<<<<<<<<<<<<<<<<< UT_UIManagerModuleTest in thread "); //ReactInstanceManager RCTIntance = (ReactInstanceManager)obj; //var currentReactContext = RCTIntance._currentReactContext; var currentReactContext = _currentReactContext; Log.Info(ReactConstants.Tag, "### UT_UIManagerModuleTest ### " + (currentReactContext != null)); if (currentReactContext != null) { Log.Info(ReactConstants.Tag, "### [BGN] UT_UIManagerModuleTest ### "); UIManagerModule uiMgrModule = currentReactContext.ReactInstance.GetNativeModule <UIManagerModule>(); // /* * //Log.Info(ReactConstants.Tag, ">>>>>>>>>>>>>>> [UT] Network BGN <<<<<<<<<<<<<<<<< "); * NetworkingModule module = currentReactContext.ReactInstance.GetNativeModule<NetworkingModule>(); * * var method = "GET"; * * var passed = false; * var waitHandle = new AutoResetEvent(false); * * module.sendRequest(method, new Uri("www.baidu.com"), 1, null, null, "", false, 1000); * waitHandle.WaitOne(); */ //Assert.IsTrue(passed); //Log.Info(ReactConstants.Tag, ">>>>>>>>>>>>>>> [UT] Network BGN <<<<<<<<<<<<<<<<< "); // //2. TEXT //Log.Info(ReactConstants.Tag, "### [UT] Create a Text view ### "); //var prop = default(JObject); //uiMgrModule.createView(6, "RCTText", 1, prop); //uiMgrModule.OnBatchComplete(); //int[] szTag = { 6, }; //int[] szIndices = { 0, }; //uiMgrModule.manageChildren(1, null, null, szTag, szIndices, null); //int[] szChildren = { 6, }; //uiMgrModule.setChildren(1, szChildren); //uiMgrModule.OnBatchComplete(); // grid //Log.Info(ReactConstants.Tag, "### [UT] Create a grid view ### "); //uiMgrModule.createView(2, "RCTGridView", 1, prop); /* * //2. button * Log.Info(ReactConstants.Tag, "### [BGN] Create a button view ### "); * var prop1 = default(JObject); * uiMgrModule.createView(3, "RCTButton", 1, prop1); * uiMgrModule.OnBatchComplete(); * * int[] szTag1 = { 3, }; * int[] szIndices1 = { 0, }; * uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null); * uiMgrModule.OnBatchComplete(); * Log.Info(ReactConstants.Tag, "### [END] Create a button view ### "); * * for (int i = 1; i <= 10; i++) * { * Log.Info(ReactConstants.Tag, "Count >>>> "+i+" sec"); * Thread.Sleep(1000*1); * } * * Log.Info(ReactConstants.Tag, "### [BGN] Destroy a button view ### "); * int[] szTagDel = { 0 }; * int[] szIndicesDel = { 0, }; * uiMgrModule.manageChildren(1, null, null, null, null, szTagDel); * uiMgrModule.OnBatchComplete(); * Log.Info(ReactConstants.Tag, "### [END] Destroy a button view ### "); */ // scroll Log.Info(ReactConstants.Tag, "### [UT] Create a RCTScrollView ### "); var propScroll = default(JObject); int[] szScrollViewTag = { 10, }; int[] szScrollViewIndices = { 0, }; uiMgrModule.createView(10, "RCTScrollView", 1, propScroll); uiMgrModule.manageChildren(1, null, null, szScrollViewTag, szScrollViewIndices, null); // View var propView = default(JObject); uiMgrModule.createView(11, "RCTView", 1, propView); int[] szViewTag = { 11, }; int[] szViewIndices = { 0, }; uiMgrModule.manageChildren(10, null, null, szViewTag, szViewIndices, null); // image Log.Info(ReactConstants.Tag, "### [UT] Create a RCTImageView ### "); var propImage = default(JObject); uiMgrModule.createView(8, "RCTImageView", 1, propImage); int[] szImageTag = { 8, }; int[] szImageIndices = { 0, }; uiMgrModule.manageChildren(11, null, null, szImageTag, szImageIndices, null); uiMgrModule.OnBatchComplete(); //int[] childrenTag = { 8, }; //uiMgrModule.setChildren(1, childrenTag); //uiMgrModule.OnBatchComplete(); //int[] szTag1 = { 8,}; //int[] szIndices1 = { 0,}; //uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null); //Log.Info(ReactConstants.Tag, "### [END] Manage RCTImageView ### "); //uiMgrModule.OnBatchComplete(); /* * //2. Scroll * Log.Info(ReactConstants.Tag, "### [UT] Create a Scroll view ### "); * //var prop = default(JObject); * uiMgrModule.createView(6, "RCTScrollView", 1, prop); * * //int[] szTag = { 21, }; * //int[] szIndices = { 0, }; * //uiMgrModule.manageChildren(1, null, null, szTag, szIndices, null); * * // Layout * Log.Info(ReactConstants.Tag, "### [UT] Create a Layout view ### "); * uiMgrModule.createView(10, "RCTView", 1, prop); * * int[] szTag1 = { 6, }; * int[] szIndices1 = { 0, }; * uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null); * * //Log.Info(ReactConstants.Tag, "### [UT] Create Image view ### "); * uiMgrModule.createView(11, "RCTImageView", 1, prop); * uiMgrModule.createView(12, "RCTImageView", 1, prop); * int[] szTag = { 11, 12}; * int[] szIndices = { 0, 1 }; * uiMgrModule.manageChildren(6, null, null, szTag, szIndices, null); */ //Log.Info(ReactConstants.Tag, "### [UT] Create MyText view ### "); //uiMgrModule.createView(12, "RCTMyText", 1, prop); //uiMgrModule.createView(12, "RCTImageView", 1, prop); //int[] szTag1 = { 12, }; //int[] szIndices1 = { 0, }; //uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null); // grid //Log.Info(ReactConstants.Tag, "### [UT] Create a grid view ### "); //uiMgrModule.createView(13, "RCTGridView", 1, prop); //int[] szTag5 = { 13, }; //int[] szIndices5 = { 0, }; //uiMgrModule.manageChildren(1, null, null, szTag5, szIndices5, null); //3. Image ////Log.Info(ReactConstants.Tag, "### [UT] Create two Image view ### "); //uiMgrModule.createView(23, "RCTImageView", 1, prop); //uiMgrModule.createView(24, "RCTImageView", 1, prop); // button //Log.Info(ReactConstants.Tag, "### [UT] Create a button view ### "); //uiMgrModule.createView(3, "RCTButton", 1, prop); //int[] szTag2 = { 23, 24 }; //int[] szIndices2 = { 0, 1}; //uiMgrModule.manageChildren(22, null, null, szTag2, szIndices2, null); // wait for 5 sec // Thread.Sleep(5000); // test for dispatchCommand of view //Log.Info(ReactConstants.Tag, "### [UT] Generate a command to the given view ### "); //var args = new JArray("Focus"); //uiMgrModule.dispatchViewManagerCommand(3, 1, args); //uiMgrModule.dispatchViewManagerCommand(3, 2, args); Log.Info(ReactConstants.Tag, "### [END] UT_UIManagerModuleTest ### "); } // End UT }