Repository navigation
fix(view): preserve native behavior when flattening layout-only views - #3172
Open
Jason Morse (JasonVMo) wants to merge 1 commit into
Open
Jason Morse (JasonVMo) wants to merge 1 commit into
Jason Morse (JasonVMo) wants to merge 1 commit into
Conversation
Require native window-dragging boundaries for mouseDownCanMoveWindow=false instead of its true default, and preserve native-only tooltip, drag and key behavior when ordinary views flatten. Cover prop transitions and native requirements in the existing stacking-context tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 33ea5c72-8bbd-448d-aa21-c9b99dd03c96
Author
|
Additional validation: the six independent main fixes (#3170–#3175) were combined at e9667492e9 in an isolated worktree. After regenerating Pods from packages/rn-tester, RNTester-macOS and RNTester for arm64/x86_64 iOS simulators both built successfully. Exact commands, corrected codegen invocation, and limitations are recorded in #3175 (integration validation comment). This is build evidence, not live UI or sanitizer qualification; no PR was merged. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
The macOS Fabric trait initializer currently treats
mouseDownCanMoveWindow=trueas requiring a native stacking context, although true is the default in both the C++ props and native view. Consequently every otherwise layout-only View materializes, while an explicit false can lose the native boundary that is meant to prevent window dragging.AppKit documents true as permitting mouse-down propagation through superviews. The false override was deliberately added for Pressable cancellation in #1857. This macOS-specific predicate/default mismatch was introduced in #2730; it is not an upstream React Native change. Current main and the pending #3058/#3104/#3105 release-stack trait headers were checked; none contains this correction.
Test Plan:
Built a temporary standalone GoogleTest runner from this branch's actual
ViewShadowNode.cpp, existingStackingContextTest.cpp, mounting stubs and component builder. Existing native support libraries/generated headers were reused read-only; no Pods or Xcode build was run. The temporary harness is not part of this PR.bash .flattening-validation/compile_stacking_tests.sh fixed— passed, compiled and linked the runner..flattening-validation/stacking-tests-fixed --gtest_filter='StackingContextTest.*'— passed all 9 tests, covering both tree builders and incremental mounting mutations.bash .flattening-validation/compile_stacking_tests.sh baseline— passed compilation against the original trait header from0b569f1497..flattening-validation/stacking-tests-baseline --gtest_filter='StackingContextTest.defaultPropsMakeEverythingFlattened:StackingContextTest.windowDraggingBoundarySurvivesFlattening:StackingContextTest.macOSNativeBehaviorPreventsFlattening'— expected failure: all 3 fail. Default props produce 10 native stub views instead of 1.bash .flattening-validation/compile_stacking_tests.sh negation-only— passed compilation against a mutation that only negates the mouse-down predicate..flattening-validation/stacking-tests-negation-only --gtest_filter='StackingContextTest.defaultPropsMakeEverythingFlattened:StackingContextTest.windowDraggingBoundarySurvivesFlattening:StackingContextTest.macOSNativeBehaviorPreventsFlattening'— expected failure: 2 pass, native-prop regression fails, demonstrating why tooltip/drag/key requirements must be retained.bash .flattening-validation/compile_stacking_tests.sh syntax-cxx— passed syntax compilation of production/test sources using cxx host props and-UTARGET_OS_OSX -DTARGET_OS_OSX=0; this is not an iOS runtime/build claim.xcrun clang-format --dry-run --Werror packages/react-native/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewTraitsInitializer.h packages/react-native/ReactCommon/react/renderer/mounting/tests/StackingContextTest.cpp— passed.git --no-pager diff --check— passed.Not run: a fresh RNTester-macOS/Pods/Xcode integration build; live window-background dragging and Pressable cancellation; live tooltip/drag-and-drop/keyboard interactions; iOS/visionOS or Paper builds. No screenshots or AppKit runtime verification are claimed. Jest, Flow and ESLint were not run because no JavaScript changed.