Skip to content

Commit 8873337

Browse files
authored
fix: Fix padding on Android browser search (#12665)
<!-- 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** <!-- 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? --> This PR fixes a padding issue on the BrowserUrlModal screen for Android ## **Related issues** Fixes: Thread - https://consensys.slack.com/archives/C02U025CVU4/p1733763228960359 ## **Manual testing steps** 1. On Android, go to browser tab 2. Tap on the address bar 3. Notice that the search bar now respects the top notch for Android ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> <img width="298" alt="image" src="https://github.com/user-attachments/assets/46ca7f2e-8068-42f4-b887-8f1d4e8d810b" /> ### **After** <!-- [screenshots/recordings] --> <img width="271" alt="image" src="https://github.com/user-attachments/assets/911384e2-bc80-4274-8955-57a22b1ea12f" /> ## **Pre-merge author checklist** - [x] 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). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] 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** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] 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.
1 parent 28031f6 commit 8873337

File tree

3 files changed

+63
-65
lines changed

3 files changed

+63
-65
lines changed

app/components/Views/BrowserUrlModal/BrowserUrlModal.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Routes from '../../../constants/navigation/Routes';
2020
import Device from '../../../util/device';
2121

2222
import { BrowserURLBarSelectorsIDs } from '../../../../e2e/selectors/Browser/BrowserURLBar.selectors';
23+
import { SafeAreaView } from 'react-native-safe-area-context';
2324
export interface BrowserUrlParams {
2425
onUrlInputSubmit: (inputValue: string | undefined) => void;
2526
url: string | undefined;
@@ -72,7 +73,7 @@ const BrowserUrlModal = () => {
7273
);
7374

7475
const renderContent = () => (
75-
<>
76+
<SafeAreaView style={styles.screen}>
7677
<View style={styles.urlModalContent}>
7778
<View style={styles.searchWrapper}>
7879
<TextInput
@@ -117,7 +118,7 @@ const BrowserUrlModal = () => {
117118
input={autocompleteValue}
118119
onDismiss={triggerClose}
119120
/>
120-
</>
121+
</SafeAreaView>
121122
);
122123

123124
return (

app/components/Views/BrowserUrlModal/__snapshots__/BrowserUrlModal.test.tsx.snap

+58-53
Original file line numberDiff line numberDiff line change
@@ -9,81 +9,86 @@ exports[`BrowserUrlModal should render correctly 1`] = `
99
}
1010
}
1111
>
12-
<View
12+
<RNCSafeAreaView
1313
style={
1414
{
1515
"backgroundColor": "#ffffff",
16-
"flexDirection": "row",
17-
"height": 87,
18-
"paddingHorizontal": 10,
19-
"paddingTop": 50,
16+
"flex": 1,
2017
}
2118
}
2219
>
2320
<View
2421
style={
2522
{
26-
"backgroundColor": "#f2f4f6",
27-
"borderRadius": 30,
28-
"flex": 1,
23+
"alignItems": "center",
2924
"flexDirection": "row",
30-
"height": 30,
25+
"paddingHorizontal": 10,
3126
}
3227
}
3328
>
34-
<TextInput
35-
autoCapitalize="none"
36-
autoCorrect={false}
37-
autoFocus={true}
38-
keyboardAppearance="light"
39-
keyboardType="web-search"
40-
onChangeText={[Function]}
41-
onSubmitEditing={[Function]}
42-
placeholder="Search or Type URL"
43-
placeholderTextColor="#9fa6ae"
44-
returnKeyType="go"
45-
selectTextOnFocus={true}
29+
<View
4630
style={
4731
{
48-
"color": "#141618",
32+
"backgroundColor": "#f2f4f6",
33+
"borderRadius": 30,
4934
"flex": 1,
50-
"fontFamily": "EuclidCircularB-Regular",
51-
"fontSize": 14,
52-
"fontWeight": "400",
53-
"paddingLeft": 15,
35+
"flexDirection": "row",
5436
}
5537
}
56-
testID="browser-modal-url-input"
57-
/>
58-
</View>
59-
<TouchableOpacity
60-
onPress={[Function]}
61-
style={
62-
{
63-
"justifyContent": "center",
64-
"marginLeft": 10,
65-
"marginTop": -6,
66-
}
67-
}
68-
testID="cancel-url-button"
69-
>
70-
<Text
38+
>
39+
<TextInput
40+
autoCapitalize="none"
41+
autoCorrect={false}
42+
autoFocus={true}
43+
keyboardAppearance="light"
44+
keyboardType="web-search"
45+
onChangeText={[Function]}
46+
onSubmitEditing={[Function]}
47+
placeholder="Search or Type URL"
48+
placeholderTextColor="#9fa6ae"
49+
returnKeyType="go"
50+
selectTextOnFocus={true}
51+
style={
52+
{
53+
"color": "#141618",
54+
"flex": 1,
55+
"fontFamily": "EuclidCircularB-Regular",
56+
"fontSize": 14,
57+
"fontWeight": "400",
58+
"paddingLeft": 15,
59+
"paddingVertical": 6,
60+
}
61+
}
62+
testID="browser-modal-url-input"
63+
/>
64+
</View>
65+
<TouchableOpacity
66+
onPress={[Function]}
7167
style={
7268
{
73-
"color": "#0376c9",
74-
"fontFamily": "EuclidCircularB-Regular",
75-
"fontSize": 14,
76-
"fontWeight": "400",
69+
"marginLeft": 10,
7770
}
7871
}
72+
testID="cancel-url-button"
7973
>
80-
Cancel
81-
</Text>
82-
</TouchableOpacity>
83-
</View>
84-
<Component
85-
onDismiss={[Function]}
86-
onSubmit={[Function]}
87-
/>
74+
<Text
75+
style={
76+
{
77+
"color": "#0376c9",
78+
"fontFamily": "EuclidCircularB-Regular",
79+
"fontSize": 14,
80+
"fontWeight": "400",
81+
}
82+
}
83+
>
84+
Cancel
85+
</Text>
86+
</TouchableOpacity>
87+
</View>
88+
<Component
89+
onDismiss={[Function]}
90+
onSubmit={[Function]}
91+
/>
92+
</RNCSafeAreaView>
8893
</ForwardRef>
8994
`;

app/components/Views/BrowserUrlModal/styles.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,24 @@ export const createStyles = (colors: any) =>
1111
flex: 1,
1212
backgroundColor: colors.background.default,
1313
},
14-
urlModal: {
15-
justifyContent: 'flex-start',
16-
margin: 0,
17-
},
1814
urlModalContent: {
1915
flexDirection: 'row',
20-
paddingTop: Device.isAndroid() ? 10 : Device.isIphoneX() ? 50 : 27,
2116
paddingHorizontal: 10,
22-
height: Device.isAndroid() ? 59 : Device.isIphoneX() ? 87 : 65,
23-
backgroundColor: colors.background.default,
17+
alignItems: 'center',
2418
},
2519
clearButton: { paddingHorizontal: 12, justifyContent: 'center' },
2620
urlInput: {
2721
...fontStyles.normal,
2822
fontSize: Device.isAndroid() ? 16 : 14,
2923
paddingLeft: 15,
24+
paddingVertical: 6,
3025
flex: 1,
3126
color: colors.text.default,
3227
// TODO: Replace "any" with type
3328
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3429
} as any,
3530
cancelButton: {
36-
marginTop: -6,
3731
marginLeft: 10,
38-
justifyContent: 'center',
3932
},
4033
cancelButtonText: {
4134
fontSize: 14,
@@ -48,7 +41,6 @@ export const createStyles = (colors: any) =>
4841
flexDirection: 'row',
4942
borderRadius: 30,
5043
backgroundColor: colors.background.alternative,
51-
height: Device.isAndroid() ? 40 : 30,
5244
flex: 1,
5345
},
5446
});

0 commit comments

Comments
 (0)