Skip to content

Commit 53c49df

Browse files
iOS 26 - Update modal animation (#3646)
1 parent ada36ee commit 53c49df

File tree

7 files changed

+34
-26
lines changed

7 files changed

+34
-26
lines changed

packages/core-mobile/app/new/common/components/NavigationBarButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TouchableOpacity, View } from '@avalabs/k2-alpine'
2-
import { isIOS26 } from 'common/utils/isIOS26'
2+
import { isIOS26AndAbove } from 'common/utils/isIOS26AndAbove'
33
import React, { useMemo } from 'react'
44
import {
55
Platform,
@@ -27,7 +27,7 @@ const NavigationBarButton = React.forwardRef<
2727
ref
2828
): JSX.Element => {
2929
const containerStyle: ViewStyle = useMemo(() => {
30-
if (isIOS26) {
30+
if (isIOS26AndAbove) {
3131
return {
3232
height: 36,
3333
width: 36,

packages/core-mobile/app/new/common/components/ScrollScreen.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,12 @@ export const ScrollScreen = ({
169169

170170
const renderHeaderContent = useCallback(() => {
171171
if (title || subtitle || renderHeader) {
172+
const hasTitle = Boolean(title || subtitle)
172173
return (
173174
<View>
174175
<View
175176
ref={headerRef}
176-
style={[
177-
headerStyle,
178-
{
179-
gap: 8
180-
}
181-
]}>
177+
style={[headerStyle, hasTitle ? { gap: 8 } : undefined]}>
182178
{title ? (
183179
<Animated.View style={[animatedHeaderStyle]}>
184180
<ScreenHeader
@@ -190,9 +186,10 @@ export const ScrollScreen = ({
190186
) : null}
191187

192188
{subtitle ? <Text variant="body1">{subtitle}</Text> : null}
189+
{!hasTitle && renderHeader?.()}
193190
</View>
194191

195-
{renderHeader?.()}
192+
{hasTitle && renderHeader?.()}
196193
</View>
197194
)
198195
} else {

packages/core-mobile/app/new/common/consts/screenOptions.tsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AccountSettingBarButton } from 'common/components/AccountSettingBarButt
44
import BackBarButton from 'common/components/BackBarButton'
55
import { ConnectButton } from 'common/components/ConnectButton'
66
import { ConnectedNotificationBarButton } from 'common/components/ConnectedNotificationBarButton'
7+
import { isIOS26AndAbove } from 'common/utils/isIOS26AndAbove'
78
import React from 'react'
89
import { Platform } from 'react-native'
910
import { useSafeAreaInsets } from 'react-native-safe-area-context'
@@ -32,10 +33,13 @@ export const stackScreensOptions: NativeStackNavigationOptions | undefined = {
3233
// Modals
3334
export const modalScreensOptions: NativeStackNavigationOptions = {
3435
...commonNavigatorScreenOptions,
35-
presentation: Platform.OS === 'ios' ? 'pageSheet' : 'formSheet',
36+
presentation:
37+
Platform.OS === 'ios' && !isIOS26AndAbove ? 'pageSheet' : 'formSheet',
3638
sheetElevation: 0,
3739
sheetInitialDetentIndex: 0,
38-
sheetAllowedDetents: [Platform.OS === 'android' ? 0.93 : 0.99],
40+
sheetAllowedDetents: [
41+
Platform.OS === 'android' ? 0.93 : isIOS26AndAbove ? 0.98 : 0.99
42+
],
3943
headerLeft: () => <BackBarButton />,
4044
gestureEnabled: true,
4145
headerTransparent: true
@@ -53,25 +57,28 @@ export function useModalScreensOptions(): {
5357
contentStyle: {
5458
// Android formsheet in native-stack has a default top padding of insets.top
5559
// by removing the insets.top this we adjust the navigation bar position
56-
marginTop: Platform.OS === 'android' ? -insets.top + 8 : undefined
60+
marginTop: Platform.OS === 'android' ? -insets.top + 8 : undefined,
61+
height: '100%'
5762
}
5863
},
5964
secondaryModalScreensOptions: {
60-
...modalScreensOptions,
65+
...secondaryModalScreensOptions,
6166
freezeOnBlur: true,
6267
contentStyle: {
6368
// Android formsheet in native-stack has a default top padding of insets.top
6469
// by removing the insets.top this we adjust the navigation bar position
65-
marginTop: Platform.OS === 'android' ? -insets.top + 8 : undefined
66-
},
67-
sheetAllowedDetents: [Platform.OS === 'android' ? 0.92 : 0.99]
70+
marginTop: Platform.OS === 'android' ? -insets.top + 8 : undefined,
71+
height: '100%'
72+
}
6873
}
6974
}
7075
}
7176

7277
export const secondaryModalScreensOptions: NativeStackNavigationOptions = {
7378
...modalScreensOptions,
74-
sheetAllowedDetents: [Platform.OS === 'android' ? 0.92 : 0.99]
79+
sheetAllowedDetents: [
80+
Platform.OS === 'android' ? 0.92 : isIOS26AndAbove ? 0.97 : 0.99
81+
]
7582
}
7683

7784
/**
@@ -88,7 +95,9 @@ export const secondaryModalScreensOptions: NativeStackNavigationOptions = {
8895
export const ledgerModalScreensOptions: NativeStackNavigationOptions = {
8996
...modalScreensOptions,
9097
freezeOnBlur: Platform.OS === 'ios' ? false : undefined,
91-
sheetAllowedDetents: [Platform.OS === 'android' ? 0.92 : 0.99]
98+
sheetAllowedDetents: [
99+
Platform.OS === 'android' ? 0.92 : isIOS26AndAbove ? 0.97 : 0.98
100+
]
92101
}
93102

94103
export const modalStackNavigatorScreenOptions: NativeStackNavigationOptions = {

packages/core-mobile/app/new/common/utils/isIOS26.ts renamed to packages/core-mobile/app/new/common/utils/isIOS26AndAbove.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Platform } from 'react-native'
22
import DeviceInfo from 'react-native-device-info'
33

4-
export const isIOS26 =
4+
export const isIOS26AndAbove =
55
parseInt(DeviceInfo.getSystemVersion().split('.')[0] || '') >= 26 &&
66
Platform.OS === 'ios'

packages/core-mobile/app/new/features/track/screens/TrackTokenDetailScreen.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { AVAX_TOKEN_ID } from 'common/consts/swap'
2626
import { useFormatCurrency } from 'common/hooks/useFormatCurrency'
2727
import { useTokenDetails } from 'common/hooks/useTokenDetails'
2828
import { copyToClipboard } from 'common/utils/clipboard'
29-
import { isIOS26 } from 'common/utils/isIOS26'
29+
import { isIOS26AndAbove } from 'common/utils/isIOS26AndAbove'
3030
import { AVAX_COINGECKO_ID } from 'consts/coingecko'
3131
import { format } from 'date-fns'
3232
import { useBuy } from 'features/meld/hooks/useBuy'
@@ -324,13 +324,15 @@ const TrackTokenDetailScreen = (): JSX.Element => {
324324
<FavoriteBarButton
325325
isFavorite={isFavorite}
326326
onPress={handleFavorite}
327-
style={isIOS26 ? { paddingHorizontal: 12 } : { paddingRight: 12 }}
327+
style={
328+
isIOS26AndAbove ? { paddingHorizontal: 12 } : { paddingRight: 12 }
329+
}
328330
/>
329331
)}
330332
<ShareBarButton
331333
onPress={handleShare}
332334
style={
333-
isIOS26
335+
isIOS26AndAbove
334336
? { paddingHorizontal: 12 }
335337
: {
336338
paddingRight: 12,

packages/core-mobile/app/new/routes/(signedIn)/(modals)/accountSettings/connectedSites.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import React, { useCallback, useMemo, useState } from 'react'
1616
import { DappLogo } from 'common/components/DappLogo'
1717
import { ErrorState } from 'common/components/ErrorState'
1818
import NavigationBarButton from 'common/components/NavigationBarButton'
19-
import { isIOS26 } from 'common/utils/isIOS26'
19+
import { isIOS26AndAbove } from 'common/utils/isIOS26AndAbove'
2020

2121
const ConnectedSitesScreen = (): JSX.Element => {
2222
const {
@@ -170,7 +170,7 @@ const ConnectedSitesScreen = (): JSX.Element => {
170170

171171
const renderHeaderRight = (): JSX.Element | null => {
172172
if (allApprovedDapps.length === 0) return null
173-
if (isIOS26)
173+
if (isIOS26AndAbove)
174174
return (
175175
<TouchableOpacity
176176
onPress={disconnectAll}

packages/core-mobile/app/new/routes/(signedIn)/(tabs)/browser/history.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ErrorState } from 'common/components/ErrorState'
1010
import { ListScreen } from 'common/components/ListScreen'
1111
import NavigationBarButton from 'common/components/NavigationBarButton'
1212
import { useBottomTabBarHeight } from 'common/hooks/useBottomTabBarHeight'
13-
import { isIOS26 } from 'common/utils/isIOS26'
13+
import { isIOS26AndAbove } from 'common/utils/isIOS26AndAbove'
1414
import { BrowserItem } from 'features/browser/components/BrowserItem'
1515
import { useSearchHistory } from 'features/browser/hooks/useSearchHistory'
1616
import { prepareFaviconToLoad } from 'features/browser/utils'
@@ -112,7 +112,7 @@ const HistoryScreen = (): JSX.Element => {
112112

113113
const renderHeaderRight = (): JSX.Element | null => {
114114
if (!hasHistory) return null
115-
if (isIOS26)
115+
if (isIOS26AndAbove)
116116
return (
117117
<TouchableOpacity
118118
onPress={removeAll}

0 commit comments

Comments
 (0)