-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add tab navigator #5027
feat: add tab navigator #5027
Conversation
1 build increased size
Celo (test) 1.80.0 (145)
|
Item | Install Size Change |
---|---|
main.jsbundle | ⬆️ 32.8 kB |
🛸 Powered by Emerge Tools
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5027 +/- ##
==========================================
- Coverage 85.55% 85.55% -0.01%
==========================================
Files 723 723
Lines 29448 29460 +12
Branches 5078 5082 +4
==========================================
+ Hits 25195 25205 +10
- Misses 4020 4022 +2
Partials 233 233
Continue to review full report in Codecov by Sentry.
|
@@ -238,7 +240,9 @@ export function navigateHome(options?: NavigateHomeOptions) { | |||
setTimeout(() => { | |||
navigationRef.current?.reset({ | |||
index: 0, | |||
routes: [{ name: Screens.DrawerNavigator, params }], | |||
routes: getFeatureGate(StatsigFeatureGates.USE_TAB_NAVIGATOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Android I am getting the error: The action 'RESET' with payload {"index":0,"routes":[{"name":"TabNavigator"}]} was not handled by any navigator.
likely form here. When testing the non tab navigator path no error is served. On iOS I have not observed this same issue. Perhaps this should be fixed the follow up ACT-1110.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm confused by your PR comment and the comment in the code: the code says there's a TODO to handle undefined/falsey, the code seems to handle it by reverting to previous behavior (DrawerNavigator), and you PR comment seems to imply that addresses act-1110 will solve a related (unrelated?) problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Act-1110 is the feature gate ticket. As this relates to the feature gate not being defined when the navigation service is initialized, we try to initialize Statsig as early as possible, it seems appropriate to lump it into that work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment seems misleading, it doesn't say anything about the error you ran into. It seems like we need to handle undefined
return value from the gate, which is already handled. Any false-y value just picks the DrawerNavigator screen.
# Conflicts: # package.json # yarn.lock
<Tab.Screen | ||
// TODO(act-1104) new assets screen | ||
name={Screens.Assets} | ||
// @ts-expect-error Type '{}' is missing the following properties from type 'Props': navigation, route |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid using @ts-expect-error
here? I worry (in general) that will forget about suppressed errors and they eventually surface as errors to the user experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just linking to the existing assets screen, but that screen be redone in act-1104 which should resolve this todo.
@@ -238,7 +240,9 @@ export function navigateHome(options?: NavigateHomeOptions) { | |||
setTimeout(() => { | |||
navigationRef.current?.reset({ | |||
index: 0, | |||
routes: [{ name: Screens.DrawerNavigator, params }], | |||
routes: getFeatureGate(StatsigFeatureGates.USE_TAB_NAVIGATOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm confused by your PR comment and the comment in the code: the code says there's a TODO to handle undefined/falsey, the code seems to handle it by reverting to previous behavior (DrawerNavigator), and you PR comment seems to imply that addresses act-1110 will solve a related (unrelated?) problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The padding on the tab bar looks off compared to figma
This reverts commit 1daa4b5.
@satish-ravi added some padding in to better match styles in c5bc02d. It's a bit of a compromise as getting it pixel perfect on one screen can lead to some strange display on smaller screens; I've updated the screenshots in the description. |
@@ -238,7 +240,9 @@ export function navigateHome(options?: NavigateHomeOptions) { | |||
setTimeout(() => { | |||
navigationRef.current?.reset({ | |||
index: 0, | |||
routes: [{ name: Screens.DrawerNavigator, params }], | |||
routes: getFeatureGate(StatsigFeatureGates.USE_TAB_NAVIGATOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment seems misleading, it doesn't say anything about the error you ran into. It seems like we need to handle undefined
return value from the gate, which is already handled. Any false-y value just picks the DrawerNavigator screen.
src/navigator/TabNavigator.tsx
Outdated
> | ||
<Tab.Screen | ||
// TODO(act-1104) new assets screen | ||
name={Screens.Assets} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any risk of collision with the actual Assets/Home/Dapps screens here? i.e., is there a possibility that any component that says navigate(Screens.Assets) navigates to this Tab screen instead of the original Assets screen while this feature is off? Maybe we should just use unique names to be safe? We can fill in with the actual tab screens in the follow up tickets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine to leave these as navigating as is. I've tested the navigation when StatsigFeatureGates.USE_TAB_NAVIGATOR
is false and the existing navigation is tested in the e2e tests.
@@ -224,7 +226,7 @@ export async function isBottomSheetVisible(screen: Screens) { | |||
} | |||
|
|||
interface NavigateHomeOptions { | |||
params?: StackParamList[Screens.DrawerNavigator] | |||
params?: StackParamList[Screens.DrawerNavigator] | StackParamList[Screens.TabNavigator] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type is kind of a problem, as it masks a potential issue. The initialScreenName
accepted by the two screens are actually going to be different. What if a caller passes an initialScreenName
that only applies to the DrawerNavigator. E.g., we have a the CYA screen passing DAppsExplorerScreen
and ExchangeHomeScreen
, would it be on the caller to also get the gate and pass the appropriate screen name? I wonder if we should make the typing more strict so we can catch these potential issues that may be hidden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like react-navigation handles internally. I've tested navigating from the CYA screen to each option and the correct screen is served for both paths for the use_tab_navigator
feature gate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess this might be broken now with changing the screen names, but we can fix it in ACT-1110
# Conflicts: # src/navigator/Screens.tsx # test/RootStateSchema.json
@@ -224,7 +226,7 @@ export async function isBottomSheetVisible(screen: Screens) { | |||
} | |||
|
|||
interface NavigateHomeOptions { | |||
params?: StackParamList[Screens.DrawerNavigator] | |||
params?: StackParamList[Screens.DrawerNavigator] | StackParamList[Screens.TabNavigator] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess this might be broken now with changing the screen names, but we can fix it in ACT-1110
Co-authored-by: Satish Ravi <satish.ravi@valoraapp.com>
Co-authored-by: Satish Ravi <satish.ravi@valoraapp.com>
### Description Adds the tab navigator and associated icons. Behavior is enabled with the `use_tab_navigator` feature gate. Please disregard the header display as this will be covered in ACT-1108. | Android | iOS 15 Pro Max - Large Font | iOS SE (3rd Generation) | | ----- | ----- | ----- | | ![](https://github.com/valora-inc/wallet/assets/26950305/e65dbbd2-c449-4b17-8b7b-904bfa3463f9 "Android Assets") | ![](https://github.com/valora-inc/wallet/assets/26950305/d74ae00e-4ae8-4ae2-9a4b-bb54377da375 "iOS 15 Pro Max Assets") | ![](https://github.com/valora-inc/wallet/assets/26950305/ee815632-29ee-46de-9145-8a9c420ac01a "iOS SE (3rd Generation) Assets") | ### Test plan - [x] Tested locally on iOS with feature flag enabled and disabled - [x] Tested locally on Android with feature flag enabled and disabled - [x] Unit tests updated ### Related issues - Fixes ACT-1103 ### Backwards compatibility Yes - behind the `use_tab_navigator` feature gate. ### Network scalability N/A --------- Co-authored-by: Satish Ravi <satish.ravi@valoraapp.com>
Description
Adds the tab navigator and associated icons. Behavior is enabled with the
use_tab_navigator
feature gate. Please disregard the header display as this will be covered in ACT-1108.Test plan
Related issues
Backwards compatibility
Yes - behind the
use_tab_navigator
feature gate.Network scalability
N/A