Skip to content

Commit 3d3f9c3

Browse files
fix: token import flow is broken (#21911)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** After the merge of [this](https://github.com/MetaMask/metamask-mobile/pull/21628/files) PR, the navigation broke and now we are not able to import tokens. @brianacnguyen I have not tested `TokensFullView` for this since I am not 100% sure on how to enable this and we need to fix this import issue ASAP <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: fix broken token import flow ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1557 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/148686bf-e8f0-4482-b2c3-5be815eac073 <!-- [screenshots/recordings] --> ### **After** https://github.com/user-attachments/assets/eed8825a-7a8e-414d-a69c-0d430b40b3ae <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Registers `ConfirmAddAsset` in the main stack (header shown) and updates the confirm screen to use `SafeAreaView` with styling tweaks; updates snapshots. > > - **Navigation**: > - Registers `ConfirmAddAsset` in the root `MainNavigator` stack with `headerShown: true` (moved from wallet tab stack). > - **UI**: > - `app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx`: Wraps content with `SafeAreaView` and adjusts layout. > - `app/components/UI/ConfirmAddAsset/styles.ts`: Adds `flex: 1` and background color to `rowWrapper`; minor style tweaks. > - **Tests**: > - Updates snapshots for `MainNavigator` and `ConfirmAddAsset` to reflect route registration and SafeAreaView/layout changes. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 42d26de. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Brian Nguyen <brianacnguyen@gmail.com>
1 parent cdad5de commit 3d3f9c3

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

app/components/Nav/Main/MainNavigator.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,6 @@ const WalletTabStackFlow = () => (
203203
component={Collectible}
204204
options={Collectible.navigationOptions}
205205
/>
206-
<Stack.Screen
207-
name="ConfirmAddAsset"
208-
component={ConfirmAddAsset}
209-
options={ConfirmAddAsset.navigationOptions}
210-
/>
211206
<Stack.Screen
212207
name={Routes.SETTINGS.REVEAL_PRIVATE_CREDENTIAL}
213208
component={RevealPrivateCredential}
@@ -945,6 +940,11 @@ const MainNavigator = () => {
945940
component={AddAsset}
946941
options={{ headerShown: false }}
947942
/>
943+
<Stack.Screen
944+
name="ConfirmAddAsset"
945+
component={ConfirmAddAsset}
946+
options={{ headerShown: true }}
947+
/>
948948
{isRewardsEnabled && (
949949
<Stack.Screen
950950
name={Routes.SETTINGS_VIEW}

app/components/Nav/Main/__snapshots__/MainNavigator.test.tsx.snap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ exports[`MainNavigator matches rendered snapshot 1`] = `
5656
}
5757
}
5858
/>
59+
<Screen
60+
component={[Function]}
61+
name="ConfirmAddAsset"
62+
options={
63+
{
64+
"headerShown": true,
65+
}
66+
}
67+
/>
5968
<Screen
6069
component={[Function]}
6170
name="Asset"

app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback, useEffect } from 'react';
2-
import { View } from 'react-native';
2+
import { View, SafeAreaView } from 'react-native';
33
import Text, {
44
TextVariant,
55
} from '../../../component-library/components/Texts/Text';
@@ -157,7 +157,7 @@ const ConfirmAddAsset = () => {
157157
);
158158

159159
return (
160-
<View
160+
<SafeAreaView
161161
style={styles.rowWrapper}
162162
testID={ImportTokenViewSelectorsIDs.ADD_CONFIRM_CUSTOM_ASSET}
163163
>
@@ -233,7 +233,7 @@ const ConfirmAddAsset = () => {
233233
/>
234234
</View>
235235
{renderImportModal()}
236-
</View>
236+
</SafeAreaView>
237237
);
238238
};
239239
export default ConfirmAddAsset;

app/components/UI/ConfirmAddAsset/__snapshots__/ConfirmAddAsset.test.tsx.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`ConfirmAddAsset render matches previous snapshot 1`] = `
4-
<View
4+
<RCTSafeAreaView
55
style={
66
{
7+
"backgroundColor": "#ffffff",
8+
"flex": 1,
79
"paddingVertical": 16,
810
}
911
}
@@ -375,5 +377,5 @@ exports[`ConfirmAddAsset render matches previous snapshot 1`] = `
375377
</View>
376378
</View>
377379
<View />
378-
</View>
380+
</RCTSafeAreaView>
379381
`;

app/components/UI/ConfirmAddAsset/styles.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { Colors } from 'app/util/theme/models';
55
const createStyles = (colors: Colors) =>
66
StyleSheet.create({
77
rowWrapper: {
8+
flex: 1,
89
paddingVertical: 16,
10+
backgroundColor: colors.background.default,
911
},
1012
root: {
1113
backgroundColor: colors.background.default,

0 commit comments

Comments
 (0)