Skip to content

fix(iOS): support Unicode tab keys in Fabric events - #563

Draft
thiagobrez wants to merge 1 commit into
mainfrom
codex/fix-560-unicode-tab-key
Draft

fix(iOS): support Unicode tab keys in Fabric events#563
thiagobrez wants to merge 1 commit into
mainfrom
codex/fix-560-unicode-tab-key

Conversation

@thiagobrez

Copy link
Copy Markdown
Collaborator

Fixes #560.

PR Description

On Fabric, the tab selection and long-press event payloads passed the Core Foundation kCFStringEncodingUTF8 constant to -[NSString cStringUsingEncoding:], which expects an NSStringEncoding. Non-ASCII tab keys therefore returned NULL, and constructing the generated event's std::string from that pointer aborted the app.

This changes both event paths to build the event key from -[NSString UTF8String], with an empty-string fallback for a nil receiver. That preserves the existing UTF-8 event payload behavior for ASCII keys while safely supporting arbitrary Unicode. The implementation uses Foundation and C++ APIs already available to the current Objective-C++ source, without raising the supported React Native, iOS, or compiler requirements.

The example now includes a Korean tab key, a focused agent-device/Maestro flow covers selection and long press, and a patch changeset is included.

How to test?

  • corepack yarn build — passed
  • corepack yarn lint — passed (three existing warnings, no errors)
  • corepack yarn typecheck — passed
  • corepack yarn jest --config '{"preset":"react-native","rootDir":"packages/react-native-bottom-tabs"}' src/__tests__/index.test.tsx --runInBand — passed
  • Fabric example iOS build with React Native 0.81.4 — passed
  • Focused agent-device/Maestro flow — passed, 1 test / 0 failures in 33.903 seconds (JUnit report, interaction recording)

corepack yarn test still exits non-zero in the unchanged repository-wide harness because @bottom-tabs/react-navigation has no discovered tests. The focused package Jest command above passes; this known harness condition is separate from the branch.

Device verification

Captured with agent-device 0.20.10 against the Fabric example app (bottomtabs.example):

  • Before: iPhone 17 Pro simulator, iOS 27.0. Selecting 메시지 produced SIGABRT in std::string(char const *) from onPageSelectedWithKey: (selection video, crash report). A long-press attempt reproduced the same abort at the selection boundary (video, crash report).
  • After: iPhone 17 Pro simulator, iOS 26.5 (matching the reported major runtime). Unicode selection rendered the expected screen and repeated long-press gestures left the app alive with no new crash report (video, selected-state screenshot). Selection also passed on iOS 27.0 (screenshot).

XCUITest's synthesized hold selected the tab but did not fire the example's custom UILongPressGestureRecognizer; the same limitation occurred on the existing ASCII tab. The focused flow therefore verifies the original crash boundary by asserting that Unicode selection and long-press gestures keep the app alive and the correct tab visible. Full evidence notes and logs are in artifacts/issue-560.

Screenshots

Before interaction

Unicode tab before interaction

After fix, selected on iOS 26.5

Unicode tab selected

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.

[iOS] Fabric: SIGABRT on tab press when tab key contains non-ASCII characters (kCFStringEncodingUTF8 passed to -cStringUsingEncoding:)

1 participant