private void ApplyUpdatesRecursive(
            ReactShadowNode cssNode,
            float absoluteX,
            float absoluteY)
        {
            cssNode.BeforeDispatchUpdatesToDescendants();

            if (!cssNode.HasUpdates)
            {
                return;
            }

            if (!cssNode.IsVirtualAnchor)
            {
                for (var i = 0; i < cssNode.ChildCount; ++i)
                {
                    ApplyUpdatesRecursive(
                        cssNode.GetChildAt(i),
                        absoluteX + cssNode.LayoutX,
                        absoluteY + cssNode.LayoutY);
                }
            }

            var tag = cssNode.ReactTag;

            if (!_shadowNodeRegistry.IsRootNode(tag))
            {
                var frameDidChange = cssNode.DispatchUpdates(
                    absoluteX,
                    absoluteY,
                    _operationsQueue,
                    _nativeViewHierarchyOptimizer);

                if (frameDidChange && cssNode.ShouldNotifyOnLayout)
                {
                    // Dispatch event from non-layout thread to avoid queueing
                    // main dispatcher callbacks from the layout thread
                    var task = Task.Run(() =>
                                        _eventDispatcher.DispatchEvent(
                                            OnLayoutEvent.Obtain(
                                                tag,
                                                cssNode.ScreenX,
                                                cssNode.ScreenY,
                                                cssNode.ScreenWidth,
                                                cssNode.ScreenHeight)));
                }
            }

            cssNode.MarkUpdateSeen();
        }
        private void ApplyUpdatesRecursive(
            ReactShadowNode cssNode,
            double absoluteX,
            double absoluteY,
            EventDispatcher eventDispatcher)
        {
            if (!cssNode.HasUpdates)
            {
                return;
            }

            if (!cssNode.IsVirtualAnchor)
            {
                for (var i = 0; i < cssNode.ChildCount; ++i)
                {
                    ApplyUpdatesRecursive(
                        cssNode.GetChildAt(i),
                        absoluteX + cssNode.LayoutX,
                        absoluteY + cssNode.LayoutY,
                        eventDispatcher);
                }
            }

            var tag = cssNode.ReactTag;

            if (!_shadowNodeRegistry.IsRootNode(tag))
            {
                cssNode.DispatchUpdates(
                    absoluteX,
                    absoluteY,
                    _operationsQueue,
                    _nativeViewHierarchyOptimizer);

                if (cssNode.ShouldNotifyOnLayout)
                {
                    eventDispatcher.DispatchEvent(
                        OnLayoutEvent.Obtain(
                            tag,
                            cssNode.ScreenX,
                            cssNode.ScreenY,
                            cssNode.ScreenWidth,
                            cssNode.ScreenHeight));
                }
            }

            cssNode.MarkUpdateSeen();
        }
示例#3
0
        private void ApplyUpdatesRecursive(
            ReactShadowNode cssNode,
            float absoluteX,
            float absoluteY)
        {
            if (!cssNode.HasUpdates)
            {
                return;
            }

            if (!cssNode.IsVirtualAnchor)
            {
                for (var i = 0; i < cssNode.ChildCount; ++i)
                {
                    ApplyUpdatesRecursive(
                        cssNode.GetChildAt(i),
                        absoluteX + cssNode.LayoutX,
                        absoluteY + cssNode.LayoutY);
                }
            }

            var tag = cssNode.ReactTag;

            if (!_shadowNodeRegistry.IsRootNode(tag))
            {
                cssNode.DispatchUpdates(
                    absoluteX,
                    absoluteY,
                    _operationsQueue,
                    _nativeViewHierarchyOptimizer);

                if (cssNode.ShouldNotifyOnLayout)
                {
                    Log.Info(ReactConstants.Tag, $"ShouldNotifyOnLayout: tag:[{tag}], X:{cssNode.LayoutX}, Y:{cssNode.LayoutY}, Width:{cssNode.LayoutWidth}, Height:{cssNode.LayoutHeight}");
                    _eventDispatcher.DispatchEvent(
                        OnLayoutEvent.Obtain(
                            tag,
                            cssNode.ScreenX,
                            cssNode.ScreenY,
                            cssNode.ScreenWidth,
                            cssNode.ScreenHeight));
                }
            }

            cssNode.MarkUpdateSeen();
        }