/// <summary>
        /// Dispatches the view updates.
        /// </summary>
        /// <param name="batchId">The batch identifier.</param>
        internal void DispatchViewUpdates(int batchId)
        {
            var nonBatchedOperations = default(Action[]);

            lock (_nonBatchedGate)
            {
                if (_nonBatchedOperations.Count > 0)
                {
                    nonBatchedOperations = _nonBatchedOperations.ToArray();
                    _nonBatchedOperations.Clear();
                    _reactChoreographer.DeactivateCallback(NonBatchedChoreographerKey);
                }
            }

            lock (_gate)
            {
                var operations = _operations.Count == 0 ? null : _operations;
                if (operations != null)
                {
                    _operations = new List <Action>();
                }

                _batches.Add(() =>
                {
                    using (Tracer.Trace(Tracer.TRACE_TAG_REACT_BRIDGE, "DispatchUI")
                           .With("BatchId", batchId)
                           .Start())
                    {
                        if (nonBatchedOperations != null)
                        {
                            foreach (var operation in nonBatchedOperations)
                            {
                                operation();
                            }
                        }

                        if (operations != null)
                        {
                            foreach (var operation in operations)
                            {
                                operation();
                            }
                        }

                        _nativeViewHierarchyManager.OnBatchComplete();
                    }
                });
            }

            // Dispatch event from non-layout thread to avoid queueing
            // main dispatcher callbacks from the layout thread
            Task.Run(() => _reactChoreographer.ActivateCallback(nameof(UIViewOperationQueueInstance)));
        }