forked from MetaMask/metamask-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adjusting the 'add network screen' in network bottom sheet, for…
… network UI redesign (MetaMask#10005) <!-- 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** This PR shows the 'Add custom network' form directly after clicking the button, where the user can add and connect to a custom network. A demo can be viewed here: https://www.loom.com/share/bd380aca1065428ea584b0421ce69fb9 Here is a link to the figma: https://www.figma.com/design/76R5BvAVubUhWaN2Ld7MAv/Default-Networks?node-id=1303-34400&m=dev <!-- 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? --> ## **Related issues** Ensures that the form is displayed directly after clicking since the list of popular networks are now integrated in the list. ## **Manual testing steps** 1. From the home page, click the network selector at the top of the screen, a bottom sheet comes up with a list of networks 2. At the bottom of the bottom sheet, click Add custom network button, a form should show up allowing to add a network 3. Fill the form with relevant information and add the network ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [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.
- Loading branch information
1 parent
789846e
commit 51a1a30
Showing
9 changed files
with
128 additions
and
48 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
app/components/Views/NetworkSelector/NetworkSearchTextInput/NetworkSearchTextInput.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { StyleSheet } from 'react-native'; | ||
import { fontStyles } from '../../../../styles/common'; | ||
import { Colors } from '../../../../util/theme/models'; | ||
|
||
const createStyles = (colors: Colors) => | ||
StyleSheet.create({ | ||
inputWrapper: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
paddingHorizontal: 10, | ||
paddingVertical: 10, | ||
borderRadius: 5, | ||
borderWidth: 1, | ||
borderColor: colors.border.default, | ||
color: colors.text.default, | ||
}, | ||
input: { | ||
flex: 1, | ||
fontSize: 14, | ||
color: colors.text.default, | ||
...fontStyles.normal, | ||
paddingLeft: 10, | ||
}, | ||
}); | ||
|
||
export default createStyles; |
54 changes: 54 additions & 0 deletions
54
app/components/Views/NetworkSelector/NetworkSearchTextInput/NetworkSearchTextInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Third party dependencies. | ||
import React from 'react'; | ||
import { TextInput, View } from 'react-native'; | ||
|
||
// External dependencies. | ||
import { strings } from '../../../../../locales/i18n'; | ||
import { mockTheme, useTheme } from '../../../../util/theme'; | ||
|
||
// Internal dependencies | ||
import Icon from 'react-native-vector-icons/Ionicons'; | ||
import createStyles from './NetworkSearchTextInput.styles'; | ||
import { NetworksViewSelectorsIDs } from '../../../../../e2e/selectors/Settings/NetworksView.selectors'; | ||
|
||
interface NetworkSearchTextInputProps { | ||
searchString: string; | ||
handleSearchTextChange: (text: string) => void; | ||
clearSearchInput: () => void; | ||
testIdSearchInput: string; | ||
testIdCloseIcon: string; | ||
} | ||
function NetworkSearchTextInput({ | ||
searchString, | ||
handleSearchTextChange, | ||
clearSearchInput, | ||
}: NetworkSearchTextInputProps) { | ||
const theme = useTheme(); | ||
const { colors } = theme; | ||
const styles = createStyles(colors || mockTheme.colors); | ||
|
||
return ( | ||
<View style={styles.inputWrapper}> | ||
<Icon name="ios-search" size={20} color={colors.icon.default} /> | ||
<TextInput | ||
style={styles.input} | ||
placeholder={strings('networks.search')} | ||
placeholderTextColor={colors.text.default} | ||
value={searchString} | ||
onChangeText={handleSearchTextChange} | ||
testID={NetworksViewSelectorsIDs.SEARCH_NETWORK_INPUT_BOX_ID} | ||
/> | ||
{searchString.length > 0 && ( | ||
<Icon | ||
name="ios-close" | ||
size={20} | ||
color={colors.icon.default} | ||
onPress={clearSearchInput} | ||
testID={NetworksViewSelectorsIDs.CLOSE_ICON} | ||
/> | ||
)} | ||
</View> | ||
); | ||
} | ||
|
||
export default NetworkSearchTextInput; |
1 change: 1 addition & 0 deletions
1
app/components/Views/NetworkSelector/NetworkSearchTextInput/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './NetworkSearchTextInput'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters