Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ final class HybridVerticalBarModule: HybridVerticalBarModuleSpec {
private var listeners: [UUID: (VerticalBarEdge) -> Void] = [:]
private var isObserving = false

override init() {
super.init()
// JS creates this object when the bundle loads, long before the tab bar first reads the edge. Reading the window
// now means that read gets the real edge, so the bar doesn't first draw its items for a horizontal bar.
DispatchQueue.main.async { MainActor.assumeIsolated { self.startObservingIfNeeded() } }
}

var edge: VerticalBarEdge {
// Never hop to the main thread synchronously from here: the main thread may be waiting on JS. The listeners get the first real value.
if !isObserving {
Expand Down
7 changes: 7 additions & 0 deletions patches/react-native-screens/details.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,10 @@
- Upstream PR/issue: not reported yet. The crash comes from the removals that [software-mansion/react-native-screens#5074](https://github.com/software-mansion/react-native-screens/pull/5074), the upstream PR of patch 008, lets reach the host, and that PR does not include this fix, so it belongs there.
- E/App issue: [#105631](https://github.com/Expensify/App/issues/105631)
- PR introducing patch: [#106500](https://github.com/Expensify/App/pull/106500)

### [react-native-screens+4.28.0+010+no-off-screen-tab-selection-animation.patch](react-native-screens+4.28.0+010+no-off-screen-tab-selection-animation.patch)

- Reason: On iOS, the first mount selects the restored tab through `setSelectedViewController:` before the tab bar is in a window, and UIKit animates that selection change. The animation is set up for the layout the bar has outside the window, which is a bottom bar. On a foldable iPhone the bar moves into the vertical bar column once it is in the window, so the still running animation morphs the liquid glass selection from the bottom bar's less rounded shape into the column's capsule, which shows as a squarer bubble on the selected tab right after launch. The patch selects the tab without animation while the controller's view has no window, the same way UIKit's own `setSelectedIndex:` in `setViewControllers:animated:` already does.
- Upstream PR/issue: not reported yet.
- E/App issue: [#107266](https://github.com/Expensify/App/issues/107266)
- PR introducing patch: [#107282](https://github.com/Expensify/App/pull/107282)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/node_modules/react-native-screens/ios/tabs/host/RNSTabBarController.mm b/node_modules/react-native-screens/ios/tabs/host/RNSTabBarController.mm
index 3c2acf0..3565fe5 100644
--- a/node_modules/react-native-screens/ios/tabs/host/RNSTabBarController.mm
+++ b/node_modules/react-native-screens/ios/tabs/host/RNSTabBarController.mm
@@ -320,6 +320,13 @@ static void rns_pushViewController(__unsafe_unretained id self,
self.tabBarItemSelectionHidden = NO;
[self.tabBar layoutIfNeeded];
}];
+ } else if (self.view.window == nil) {
+ // Before the bar is on screen there is nothing to animate, and UIKit would set the selection animation up for
+ // the layout the bar has outside the window. A foldable iPhone moves the bar into a column once it is in the
+ // window, so that animation would morph the selection from the bottom bar's shape into the column's.
+ [UIView performWithoutAnimation:^{
+ [self updateSelectedViewControllerIfNeeded];
+ }];
} else {
[self updateSelectedViewControllerIfNeeded];
}
Loading