Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
57ad8f2
Fix header transition to defi protocol details screen
Cal-L Apr 9, 2026
6ee3461
Consolidate SafeAreaView and add shim to fix top inset
Cal-L Apr 9, 2026
ef03d8f
Pass through mode
Cal-L Apr 10, 2026
5d1c4a2
Account for user specified padding or margin
Cal-L Apr 10, 2026
8d50181
Only set bottom inset for wallet actions
Cal-L Apr 10, 2026
111408c
Account for max mode for top
Cal-L Apr 10, 2026
6645095
Format files
Cal-L Apr 10, 2026
7fcbb1b
Remove duplicate Android padding
Cal-L Apr 10, 2026
f338bdb
Update snapshots
Cal-L Apr 10, 2026
b334a37
Merge branch 'main' of github.com:MetaMask/metamask-mobile into fix/r…
Cal-L Apr 10, 2026
719da29
Remove platform specific test for OAuthRehydration
Cal-L Apr 10, 2026
b8b1b56
Update react native safe area context mocks
Cal-L Apr 10, 2026
bdd9b41
Clean up tests
Cal-L Apr 10, 2026
fe0bfac
Merge branch 'main' of github.com:MetaMask/metamask-mobile into fix/r…
Cal-L Apr 10, 2026
4a90ac1
Remove unused safe area mocks
Cal-L Apr 10, 2026
810c551
Fix cursor comments
Cal-L Apr 10, 2026
aa808b7
Update Root test
Cal-L Apr 10, 2026
eca7bc9
Remove unused safe area provider
Cal-L Apr 10, 2026
e71ead9
Update snapshots
Cal-L Apr 10, 2026
062ce00
Fix failing unit tests
Cal-L Apr 10, 2026
6f762d3
Mock SafeAreaInsetsContext
Cal-L Apr 10, 2026
acc210f
Merge branch 'main' of github.com:MetaMask/metamask-mobile into fix/r…
Cal-L Apr 10, 2026
aa9bc7e
Fix formatting issues
Cal-L Apr 10, 2026
fda7a22
Fix snapshot
Cal-L Apr 10, 2026
2309d6d
Update snapshots
Cal-L Apr 10, 2026
f3cb26b
Merge from main
Cal-L Apr 10, 2026
cda2e23
Fix snapshot
Cal-L Apr 10, 2026
f88a0cf
Add unit test for safe area view with hook top
Cal-L Apr 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import { IconName } from '@metamask/design-system-react-native';
// Internal dependencies.
import HeaderRoot from './HeaderRoot';

jest.mock('react-native-safe-area-context', () => ({
useSafeAreaInsets: () => ({ top: 44, bottom: 34, left: 0, right: 0 }),
}));

const CONTAINER_TEST_ID = 'header-root-container';
const LEFT_CHILDREN_TEST_ID = 'header-root-left-children';
const END_ACCESSORY_TEST_ID = 'header-root-end-accessory';
Expand Down Expand Up @@ -250,7 +246,7 @@ describe('HeaderRoot', () => {
expect(container.props.style).toEqual(
expect.arrayContaining([
expect.anything(),
expect.objectContaining({ marginTop: 44 }),
expect.objectContaining({ marginTop: expect.any(Number) }),
]),
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ jest.mock('react-native-reanimated', () => {
return Reanimated;
});

jest.mock('react-native-safe-area-context', () => ({
useSafeAreaInsets: () => ({ top: 44, bottom: 34, left: 0, right: 0 }),
}));

const CONTAINER_TEST_ID = 'header-standard-animated-container';
const TITLE_TEST_ID = 'header-standard-animated-title';
const SUBTITLE_TEST_ID = 'header-standard-animated-subtitle';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Third party dependencies.
import React, { Fragment, useCallback, useMemo } from 'react';
import { SafeAreaView } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { useNavigation } from '@react-navigation/native';

// External dependencies.
Expand Down Expand Up @@ -85,7 +85,7 @@ const MultichainAddWalletActions = ({
);

return (
<SafeAreaView>
<SafeAreaView edges={['bottom']}>
<Fragment>
{actionConfigs.map(
(config) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@ jest.mock('react-native', () => {
};
});

jest.mock('react-native-safe-area-context', () => {
// using disting digits for mock rects to make sure they are not mixed up
const inset = { top: 1, right: 2, bottom: 3, left: 4 };
const frame = { width: 5, height: 6, x: 7, y: 8 };
return {
SafeAreaProvider: jest.fn().mockImplementation(({ children }) => children),
SafeAreaConsumer: jest
.fn()
.mockImplementation(({ children }) => children(inset)),
useSafeAreaInsets: jest.fn().mockImplementation(() => inset),
useSafeAreaFrame: jest.fn().mockImplementation(() => frame),
};
});

jest.mock('@react-navigation/native', () => {
const actualNav = jest.requireActual('@react-navigation/native');
return {
Expand Down
4 changes: 0 additions & 4 deletions app/component-library/components/Toast/Toast.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ jest.mock('react-native-reanimated', () => ({
}));

// Mock safe area context
jest.mock('react-native-safe-area-context', () => ({
useSafeAreaInsets: () => ({ bottom: 0, top: 0, left: 0, right: 0 }),
}));

describe('Toast', () => {
let toastRef: React.RefObject<ToastRef>;

Expand Down
3 changes: 2 additions & 1 deletion app/components/Base/InfoModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { StyleSheet, View, TouchableOpacity, SafeAreaView } from 'react-native';
import { StyleSheet, View, TouchableOpacity } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import Modal from 'react-native-modal';
import IonicIcon from 'react-native-vector-icons/Ionicons';
import Text from './Text';
Expand Down
15 changes: 0 additions & 15 deletions app/components/Nav/App/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -453,21 +453,6 @@ describe('App', () => {
};

beforeAll(() => {
jest.mock('react-native-safe-area-context', () => {
const inset = { top: 0, right: 0, bottom: 0, left: 0 };
const frame = { width: 0, height: 0, x: 0, y: 0 };
return {
SafeAreaProvider: jest
.fn()
.mockImplementation(({ children }) => children),
SafeAreaConsumer: jest
.fn()
.mockImplementation(({ children }) => children(inset)),
useSafeAreaInsets: jest.fn().mockImplementation(() => inset),
useSafeAreaFrame: jest.fn().mockImplementation(() => frame),
};
});

// Mock the storage item to simulate existing user and bypass onboarding
jest.spyOn(StorageWrapper, 'getItem').mockImplementation(async (key) => {
if (key === EXISTING_USER) {
Expand Down
6 changes: 5 additions & 1 deletion app/components/Nav/Main/MainNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ import CampaignTourStepView from '../../UI/Rewards/Views/CampaignTourStepView';
import { selectRewardsSubscriptionId } from '../../../selectors/rewards';
import SitesFullView from '../../Views/SitesFullView/SitesFullView';
import { TokenDetails } from '../../UI/TokenDetails/Views/TokenDetails';
import { getDeFiProtocolPositionDetailsNavbarOptions } from '../../UI/Navbar';

const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
Expand Down Expand Up @@ -1310,7 +1311,10 @@ const MainNavigator = () => {
<Stack.Screen
name="DeFiProtocolPositionDetails"
component={DeFiProtocolPositionDetails}
options={{ headerShown: true, ...slideFromRightAnimation }}
options={({ navigation }) => ({
...slideFromRightAnimation,
...getDeFiProtocolPositionDetailsNavbarOptions(navigation),
})}
/>
{
///: BEGIN:ONLY_INCLUDE_IF(sample-feature)
Expand Down
24 changes: 3 additions & 21 deletions app/components/Nav/Main/__snapshots__/MainNavigator.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,7 @@ exports[`MainNavigator Tab Bar Visibility hides tab bar when browser is active 1
<Screen
component={[Function]}
name="DeFiProtocolPositionDetails"
options={
{
"animationEnabled": true,
"cardStyleInterpolator": [Function],
"headerShown": true,
}
}
options={[Function]}
/>
<Screen
component={[Function]}
Expand Down Expand Up @@ -816,13 +810,7 @@ exports[`MainNavigator Tab Bar Visibility shows tab bar when not in browser 1`]
<Screen
component={[Function]}
name="DeFiProtocolPositionDetails"
options={
{
"animationEnabled": true,
"cardStyleInterpolator": [Function],
"headerShown": true,
}
}
options={[Function]}
/>
<Screen
component={[Function]}
Expand Down Expand Up @@ -1245,13 +1233,7 @@ exports[`MainNavigator matches rendered snapshot 1`] = `
<Screen
component={[Function]}
name="DeFiProtocolPositionDetails"
options={
{
"animationEnabled": true,
"cardStyleInterpolator": [Function],
"headerShown": true,
}
}
options={[Function]}
/>
<Screen
component={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ exports[`AccountNetworkIndicator should render correctly 1`] = `
}
}
>
<RNCSafeAreaProvider
onInsetsChange={[Function]}
<View
style={
[
{
Expand Down Expand Up @@ -440,6 +439,6 @@ exports[`AccountNetworkIndicator should render correctly 1`] = `
</RNSScreen>
</RNSScreenContainer>
</View>
</RNCSafeAreaProvider>
</View>
</View>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ exports[`AccountRightButton should render account avatar when selectedAddress is
}
}
>
<RNCSafeAreaProvider
onInsetsChange={[Function]}
<View
style={
[
{
Expand Down Expand Up @@ -387,7 +386,7 @@ exports[`AccountRightButton should render account avatar when selectedAddress is
</RNSScreen>
</RNSScreenContainer>
</View>
</RNCSafeAreaProvider>
</View>
</View>
`;

Expand All @@ -399,8 +398,7 @@ exports[`AccountRightButton should render correct network name for non-EVM netwo
}
}
>
<RNCSafeAreaProvider
onInsetsChange={[Function]}
<View
style={
[
{
Expand Down Expand Up @@ -784,7 +782,7 @@ exports[`AccountRightButton should render correct network name for non-EVM netwo
</RNSScreen>
</RNSScreenContainer>
</View>
</RNCSafeAreaProvider>
</View>
</View>
`;

Expand All @@ -796,8 +794,7 @@ exports[`AccountRightButton should render correctly 1`] = `
}
}
>
<RNCSafeAreaProvider
onInsetsChange={[Function]}
<View
style={
[
{
Expand Down Expand Up @@ -1175,7 +1172,7 @@ exports[`AccountRightButton should render correctly 1`] = `
</RNSScreen>
</RNSScreenContainer>
</View>
</RNCSafeAreaProvider>
</View>
</View>
`;

Expand All @@ -1187,8 +1184,7 @@ exports[`AccountRightButton should render correctly when a EVM network is select
}
}
>
<RNCSafeAreaProvider
onInsetsChange={[Function]}
<View
style={
[
{
Expand Down Expand Up @@ -1566,7 +1562,7 @@ exports[`AccountRightButton should render correctly when a EVM network is select
</RNSScreen>
</RNSScreenContainer>
</View>
</RNCSafeAreaProvider>
</View>
</View>
`;

Expand All @@ -1578,8 +1574,7 @@ exports[`AccountRightButton should render correctly when a non-EVM network is se
}
}
>
<RNCSafeAreaProvider
onInsetsChange={[Function]}
<View
style={
[
{
Expand Down Expand Up @@ -1957,7 +1952,7 @@ exports[`AccountRightButton should render correctly when a non-EVM network is se
</RNSScreen>
</RNSScreenContainer>
</View>
</RNCSafeAreaProvider>
</View>
</View>
`;

Expand All @@ -1969,8 +1964,7 @@ exports[`AccountRightButton should render network avatar when selectedAddress is
}
}
>
<RNCSafeAreaProvider
onInsetsChange={[Function]}
<View
style={
[
{
Expand Down Expand Up @@ -2354,7 +2348,7 @@ exports[`AccountRightButton should render network avatar when selectedAddress is
</RNSScreen>
</RNSScreenContainer>
</View>
</RNCSafeAreaProvider>
</View>
</View>
`;

Expand All @@ -2366,8 +2360,7 @@ exports[`AccountRightButton should render network avatar when selectedAddress is
}
}
>
<RNCSafeAreaProvider
onInsetsChange={[Function]}
<View
style={
[
{
Expand Down Expand Up @@ -2751,6 +2744,6 @@ exports[`AccountRightButton should render network avatar when selectedAddress is
</RNSScreen>
</RNSScreenContainer>
</View>
</RNCSafeAreaProvider>
</View>
</View>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,6 @@ const mockInitialState = {
},
};

jest.mock('react-native-safe-area-context', () => {
const inset = { top: 0, right: 0, bottom: 0, left: 0 };
const frame = { width: 0, height: 0, x: 0, y: 0 };
return {
SafeAreaProvider: jest.fn().mockImplementation(({ children }) => children),
SafeAreaConsumer: jest
.fn()
.mockImplementation(({ children }) => children(inset)),
useSafeAreaInsets: jest.fn().mockImplementation(() => inset),
useSafeAreaFrame: jest.fn().mockImplementation(() => frame),
};
});

jest.mock('@react-navigation/native', () => {
const actualReactNavigation = jest.requireActual('@react-navigation/native');
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ exports[`ApprovalTooltip renders correctly with given props 1`] = `
}
}
>
<RNCSafeAreaProvider
onInsetsChange={[Function]}
<View
style={
[
{
Expand Down Expand Up @@ -377,6 +376,6 @@ exports[`ApprovalTooltip renders correctly with given props 1`] = `
</RNSScreen>
</RNSScreenContainer>
</View>
</RNCSafeAreaProvider>
</View>
</View>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ jest.mock('@react-navigation/native', () => ({
}));

// Mock safe area context (required for BottomSheet)
jest.mock('react-native-safe-area-context', () => ({
useSafeAreaInsets: () => ({ top: 0, right: 0, bottom: 0, left: 0 }),
useSafeAreaFrame: () => ({ x: 0, y: 0, width: 390, height: 844 }),
SafeAreaProvider: ({ children }: { children: React.ReactNode }) => children,
}));

// Mock strings
jest.mock('../../../../../../locales/i18n', () => ({
strings: jest.fn((key: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,6 @@ jest.mock('../TokenSelectorItem', () => ({
},
}));

jest.mock('react-native-safe-area-context', () => ({
SafeAreaView: ({ children }: { children: React.ReactNode }) => (
<>{children}</>
),
}));
jest.mock('react-native-gesture-handler', () => {
const { FlatList, ScrollView } = jest.requireActual('react-native');
return { FlatList, ScrollView };
Expand Down
Loading
Loading