Commit be64b6d
authored
feat(iOS, Tabs): partially implement RFC-1028 for Tabs on iOS (#3781)
## Description
Partially implements
[RFC-1028](#3702)
for the Tabs component on iOS. This mirrors what was already done for
Android in #3776, adapting the iOS native implementation to the new
communication model.
Two things are explicitly out of scope for this PR and will be addressed
in follow-up PRs:
- **State conflict resolution** logic (as described in RFC-1028)
- **`moreNavigationController` support** — it is currently handicapped
and will be brought up to speed separately
Related to #3702.
## Changes
### iOS (native)
- **Introduced `RNSTabsNavigationState`**: A new struct/class that
follows the RFC-1028 model — `selectedScreenKey` + `provenance`. It
carries the information about which tab is selected and whether the
change originated from the native side or from JS.
- **Refactored container update logic**: JS-initiated and
native-initiated tab changes now have separate entry paths that converge
into a common set of helper methods to update the state. Native
navigation is slightly special — `UITabBarController` manages
`selectedViewController` internally, so the state update path for
native-initiated changes differs slightly from the JS-initiated path.
- **Moved `UITabBarControllerDelegate` methods into
`RNSTabBarController`**: Previously handled by an external
`RNSTabBarControllerDelegate`. Since the controller needs to update
navigation state on user actions (which only the delegate is aware of),
inlining the delegate into the controller is a cleaner fit. The external
`RNSTabBarControllerDelegate` class has been removed entirely.
- **Removed `RNSTabBarControllerSelectionObserving` protocol**: No
longer needed after the delegate consolidation.
- **Replaced `OnNativeFocusChange` with `OnTabChange` event**: The new
event follows RFC-1028 and carries the extended `RNSTabsNavigationState`
payload. Aligns with the Android implementation from #3776.
- **`TabsScreen` no longer exposes `isFocused`**: Screen-level selection
awareness has been removed on iOS, consistent with the Android changes.
- **Renamed `needsUpdateOfReactChildrenControllers` →
`needsUpdateOfChildViewControllers`**: Cleanup rename for accuracy.
### JS / TypeScript
- **Updated `TabsHost.ios.tsx`**: Wired up the new `navState` prop and
`onTabChange` event, aligning iOS JS bindings with the updated native
interface and with the Android implementation.
- **Updated `TabsHostIOSNativeComponent.ts`**: Reflects the new native
props and events (`navState`, `onTabChange`, removal of
`onNativeFocusChange`).
- **Removed `isFocused` from `TabsScreen.ios.tsx`**: Consistent with the
screen no longer managing its own selection state.
## Test plan
- Tested manually using the existing tabs example app on iOS.
- Verified basic tab navigation works for both native-initiated (user
tap) and JS-initiated tab changes.
## Checklist
- [x] Included code example that can be used to test this change.
- [ ] Updated / created local changelog entries in relevant test files.
- [ ] For visual changes, included screenshots / GIFs / recordings
documenting the change.
- [x] For API changes, updated relevant public types.
- [ ] Ensured that CI passes1 parent 6e825ea commit be64b6d
17 files changed
Lines changed: 457 additions & 242 deletions
File tree
- ios/tabs
- host
- screen
- src
- components/tabs
- host
- screen
- fabric/tabs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
53 | 65 | | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
57 | 69 | | |
58 | 70 | | |
59 | 71 | | |
60 | | - | |
| 72 | + | |
61 | 73 | | |
62 | 74 | | |
63 | 75 | | |
| |||
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
71 | | - | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
| |||
77 | 89 | | |
78 | 90 | | |
79 | 91 | | |
80 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
81 | 95 | | |
82 | 96 | | |
83 | 97 | | |
| |||
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
164 | | - | |
165 | | - | |
| 178 | + | |
166 | 179 | | |
167 | | - | |
| 180 | + | |
168 | 181 | | |
169 | | - | |
| 182 | + | |
170 | 183 | | |
171 | 184 | | |
172 | 185 | | |
173 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
174 | 190 | | |
175 | | - | |
| 191 | + | |
176 | 192 | | |
177 | 193 | | |
178 | 194 | | |
| |||
0 commit comments