Skip to content
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

Merged
merged 34 commits into from
Mar 8, 2024
Merged

feat: add tab navigator #5027

merged 34 commits into from
Mar 8, 2024

Conversation

MuckT
Copy link
Collaborator

@MuckT MuckT commented Mar 4, 2024

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)

Test plan

  • Tested locally on iOS with feature flag enabled and disabled
  • Tested locally on Android with feature flag enabled and disabled
  • Unit tests updated

Related issues

Backwards compatibility

Yes - behind the use_tab_navigator feature gate.

Network scalability

N/A

Copy link

emerge-tools bot commented Mar 4, 2024

1 build increased size

Name Version Download Change Install Change Approval
Celo (test)
org.celo.mobile.test
1.80.0 (145) 24.2 MB ⬆️ 16.6 kB (0.07%) 60.3 MB ⬆️ 32.8 kB (0.05%) N/A

Celo (test) 1.80.0 (145)
org.celo.mobile.test

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 32.8 kB (0.05%)
Total download size change: ⬆️ 16.6 kB (0.07%)

Largest size changes

Item Install Size Change
main.jsbundle ⬆️ 32.8 kB

🛸 Powered by Emerge Tools

Copy link

codecov bot commented Mar 4, 2024

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 85.55%. Comparing base (df00a4d) to head (fae031b).

Additional details and impacted files

Impacted file tree graph

@@            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              
Files Coverage Δ
src/navigator/Screens.tsx 100.00% <100.00%> (ø)
src/navigator/initialRoute.tsx 97.36% <100.00%> (+0.22%) ⬆️
src/statsig/constants.ts 100.00% <ø> (ø)
src/statsig/types.ts 100.00% <100.00%> (ø)
src/tokens/Assets.tsx 81.90% <ø> (ø)
src/navigator/NavigationService.ts 23.28% <50.00%> (+0.75%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df00a4d...fae031b. Read the comment docs.

@MuckT MuckT marked this pull request as ready for review March 5, 2024 00:50
@@ -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)
Copy link
Collaborator Author

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.

Copy link
Collaborator

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?

Copy link
Collaborator Author

@MuckT MuckT Mar 5, 2024

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.

Copy link
Contributor

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.

<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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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)
Copy link
Collaborator

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?

Copy link
Contributor

@satish-ravi satish-ravi left a 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

src/icons/AccountCircle.tsx Outdated Show resolved Hide resolved
locales/base/translation.json Outdated Show resolved Hide resolved
src/navigator/DrawerTopBar.tsx Outdated Show resolved Hide resolved
src/navigator/Navigator.tsx Outdated Show resolved Hide resolved
src/navigator/types.tsx Show resolved Hide resolved
@MuckT
Copy link
Collaborator Author

MuckT commented Mar 5, 2024

@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.

src/navigator/types.tsx Show resolved Hide resolved
@@ -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)
Copy link
Contributor

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.

>
<Tab.Screen
// TODO(act-1104) new assets screen
name={Screens.Assets}
Copy link
Contributor

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

Copy link
Collaborator Author

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]
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

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

src/navigator/TabNavigator.tsx Outdated Show resolved Hide resolved
@@ -224,7 +226,7 @@ export async function isBottomSheetVisible(screen: Screens) {
}

interface NavigateHomeOptions {
params?: StackParamList[Screens.DrawerNavigator]
params?: StackParamList[Screens.DrawerNavigator] | StackParamList[Screens.TabNavigator]
Copy link
Contributor

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>
@MuckT MuckT added this pull request to the merge queue Mar 8, 2024
Merged via the queue into main with commit d2ae03d Mar 8, 2024
16 checks passed
@MuckT MuckT deleted the tomm/act-1103 branch March 8, 2024 21:31
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
### 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>
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.

None yet

3 participants