Skip to content

fix(0.83, view): bridge safe-area inset changes on macOS - #3182

Open
Jason Morse (JasonVMo) wants to merge 2 commits into
0.83/user/jasonvmo/native-test-hostfrom
0.83/user/jasonvmo/safe-area-callback
Open

Jason Morse (JasonVMo) wants to merge 2 commits into
0.83/user/jasonvmo/native-test-hostfrom
0.83/user/jasonvmo/safe-area-callback

Conversation

@JasonVMo

Copy link
Copy Markdown

Summary:

The generated-app integration jobs on both stable branches currently fail in
react-native-safe-area-context@5.11.1:

no visible @interface for 'RCTViewComponentView' declares the selector 'safeAreaInsetsDidChange'

AppKit exposes safeAreaInsets but not UIKit's overridable callback.
Supply that API in the fork's existing RCTUIView compatibility class and
deliver notifications when its effective insets actually change during
attachment/layout. Record the new value before invoking subclasses, and do
not send duplicate notifications for unchanged layouts. UIKit/iOS behavior
is untouched.

The branch adapters use their existing UIKit implementation locations:
the modular RCTUIKit files on main/0.83, and the monolithic implementation
on 0.81. They register and extend the existing macOS XCTest source.
Release metadata follows the target branch: none on main, Nx on 0.81, and
a Changeset on 0.83.

This is deliberately separate from #3176/#3177/#3178's renderer
synchronization. No FURN input/layout/window-sizing code, dependency pin,
retry, CI workflow, or renderer mutex implementation changes are included.
No equivalent callback was found in the inspected future merge heads or
existing open PRs.

The stable adapters are middle layers above native-host repairs #3180
(0.81) and #3179 (0.83). Main reuses existing host repair #3095 rather than
opening a duplicate.

Test Plan:

Red/green: with the regression source actually registered in the macOS
Sources phase, the baseline fails compiling its superclass callback, matching
the integration failure. With the shim, both native callback tests pass.
The early zero-test invocation was not counted as coverage; source membership
was fixed before the red/green run.

  • Modern implementation: 2/2 tests passed in the existing 0.83 host.
  • Branch-specific 0.81 implementation: 11/11 passed, comprising both
    callback tests plus six existing Paper layout and three gzip regressions.
  • Scoped native formatting, project plutil -lint, and git diff --check
    passed for all three adapters.
  • NX_DAEMON=false yarn nx release plan:check --base=0.81/user/jasonvmo/native-test-host
    passed for the 0.81 middle layer.

Exact modern native command from its isolated qualification root
(NATIVE_PROPS_EVIDENCE denotes the local artifact directory):

RCT_NO_LAUNCH_PACKAGER=1 xcodebuild -workspace packages/rn-tester/RNTesterPods.xcworkspace -scheme RNTester-macOS -sdk macosx -destination 'platform=macOS,arch=arm64' -configuration Debug -jobs 2 -derivedDataPath "$NATIVE_PROPS_EVIDENCE/build-patched083-clean" -resultBundlePath "$NATIVE_PROPS_EVIDENCE/results-safe-area-patched.xcresult" CODE_SIGNING_ALLOWED=NO -enableAddressSanitizer NO -enableThreadSanitizer NO -enableUndefinedBehaviorSanitizer NO -parallel-testing-enabled NO -only-testing:RNTester-macOSUnitTests/RNTesterUnitTests_macOS test
# PASSED: TEST SUCCEEDED, 2 tests, 0 failures.

Exact legacy-port command:

RCT_NO_LAUNCH_PACKAGER=1 xcodebuild -workspace packages/rn-tester/RNTesterPods.xcworkspace -scheme RNTester-macOS -sdk macosx -destination 'platform=macOS,arch=arm64' -configuration Debug -jobs 2 -derivedDataPath "$NATIVE_PROPS_EVIDENCE/build-patched081-paper-app" -resultBundlePath "$NATIVE_PROPS_EVIDENCE/results-safe-area081.xcresult" CODE_SIGNING_ALLOWED=NO -enableAddressSanitizer NO -enableThreadSanitizer NO -enableUndefinedBehaviorSanitizer NO -parallel-testing-enabled NO -only-testing:RNTester-macOSUnitTests/RNTesterUnitTests_macOS -only-testing:RNTester-macOSUnitTests/RCTShadowViewTests -only-testing:RNTester-macOSUnitTests/RCTGzipTests test
# PASSED: TEST SUCCEEDED, 11 tests, 0 failures.

Qualification uses local-only single-run profiles, without the pre-existing
retry default; no test-plan changes are committed. These ordinary callback
tests are not sanitizer/race-freedom evidence. The separately instrumented
native-props comparisons belong to the renderer PRs.

Not run here: the entire native unit suite, a separate main callback execution,
iOS/device runtime, real notched-screen transitions, or FURN smokes. Hosted
CI will validate the generated-app failure path; no PR is merged.

Supply the missing UIKit-compatible callback and deliver it after actual AppKit inset changes. This separately fixes the initializer CI failure in react-native-safe-area-context without disabling that dependency or its assertions. Both registered native regressions pass; iOS remains on UIKit.

This layer is based on the separate native test-host repair. The renderer synchronization fix remains a separate top layer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 33ea5c72-8bbd-448d-aa21-c9b99dd03c96
After the safe-area compiler blocker is removed, initializer CI reaches a pre-existing Swift definite-initialization error. Assign both immutable stored properties before NSObject.init; do not make them mutable or weaken validation. The exact extracted template class fails actual compilation before this change and passes afterward.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 33ea5c72-8bbd-448d-aa21-c9b99dd03c96
@JasonVMo

Copy link
Copy Markdown
Author

CI follow-up: after the separate safe-area blocker was fixed, the 0.83
generated-app job reached an existing Swift template error:

immutable value 'self.reactNativeFactory' may only be initialized once
immutable value 'self.reactNativeDelegate' may only be initialized once
property 'self.reactNativeDelegate' not initialized at super.init call

The template's two immutable stored properties were assigned after
NSObject.init. Keep them immutable and move only super.init() after
their assignments. This is a separate initializer prerequisite, not a change
to the reviewed renderer mutex implementation.

The exact template class, compiled with lightweight dependency interfaces,
reproduces all three errors before the fix and compiles after it. An initial
swiftc -typecheck did not exercise definite-initialization analysis and was
not counted as validation; actual xcrun swiftc -c ... -o /dev/null - did.
The full generated application remains covered by the hosted init job.

Main prerequisite commit: eee401ea2f in #3183.
0.83 prerequisite commit: a1de6d1000 in #3182.
The existing 0.83 top #3178 incorporates it by ordinary merge
bf859537d83abfdbeb4fb3b563295d2a24a56612; stack 3185 and its complete
membership are preserved. No force-push or PR merge occurred. No retry,
assertion, dependency, sanitizer, or integration job was removed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant