Skip to content

Commit 36c3ede

Browse files
CP-13356 - iOS 26 - Broken button on Browser history and Connected sites (#3568)
1 parent 8994d30 commit 36c3ede

File tree

5 files changed

+57
-20
lines changed

5 files changed

+57
-20
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,12 +1,12 @@
11
import { TouchableOpacity, View } from '@avalabs/k2-alpine'
2+
import { isIOS26 } from 'common/utils/isIOS26'
23
import React, { useMemo } from 'react'
34
import {
45
Platform,
56
StyleProp,
67
TouchableOpacityProps,
78
ViewStyle
89
} from 'react-native'
9-
import DeviceInfo from 'react-native-device-info'
1010

1111
interface NavigationBarButtonProps extends TouchableOpacityProps {
1212
onPress?: () => void
@@ -27,7 +27,7 @@ const NavigationBarButton = React.forwardRef<
2727
ref
2828
): JSX.Element => {
2929
const containerStyle: ViewStyle = useMemo(() => {
30-
if (DeviceInfo.getSystemVersion() >= '26' && Platform.OS === 'ios') {
30+
if (isIOS26) {
3131
return {
3232
height: 36,
3333
width: 36,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Platform } from 'react-native'
2+
import DeviceInfo from 'react-native-device-info'
3+
4+
export const isIOS26 =
5+
DeviceInfo.getSystemVersion() >= '26' && Platform.OS === 'ios'

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { getDomainFromUrl } from 'utils/getDomainFromUrl/getDomainFromUrl'
4848
import { isPositiveNumber } from 'utils/isPositiveNumber/isPositiveNumber'
4949
import { formatLargeCurrency } from 'utils/Utils'
5050
import { useDebouncedCallback } from 'use-debounce'
51+
import { isIOS26 } from 'common/utils/isIOS26'
5152
import { useTrackTokenActions } from '../hooks/useTrackTokenActions'
5253

5354
const MAX_VALUE_WIDTH = '80%'
@@ -321,15 +322,19 @@ const TrackTokenDetailScreen = (): JSX.Element => {
321322
<FavoriteBarButton
322323
isFavorite={isFavorite}
323324
onPress={handleFavorite}
324-
style={{ paddingRight: 12 }}
325+
style={isIOS26 ? { paddingHorizontal: 12 } : { paddingRight: 12 }}
325326
/>
326327
)}
327328
<ShareBarButton
328329
onPress={handleShare}
329-
style={{
330-
paddingRight: 12,
331-
paddingLeft: 8
332-
}}
330+
style={
331+
isIOS26
332+
? { paddingHorizontal: 12 }
333+
: {
334+
paddingRight: 12,
335+
paddingLeft: 8
336+
}
337+
}
333338
/>
334339
</View>
335340
)

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +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'
1920

2021
const ConnectedSitesScreen = (): JSX.Element => {
2122
const {
@@ -167,14 +168,23 @@ const ConnectedSitesScreen = (): JSX.Element => {
167168

168169
const renderSeparator = (): JSX.Element => <View sx={{ height: 12 }} />
169170

170-
const renderHeaderRight = (): JSX.Element => {
171+
const renderHeaderRight = (): JSX.Element | null => {
172+
if (allApprovedDapps.length === 0) return null
173+
if (isIOS26)
174+
return (
175+
<TouchableOpacity
176+
onPress={disconnectAll}
177+
style={{
178+
paddingHorizontal: 10
179+
}}>
180+
<Text variant="buttonSmall">Disconnect all</Text>
181+
</TouchableOpacity>
182+
)
171183
return (
172184
<NavigationBarButton>
173-
{allApprovedDapps.length ? (
174-
<Button size="small" onPress={disconnectAll} type="secondary">
175-
Disconnect all
176-
</Button>
177-
) : null}
185+
<Button size="small" onPress={disconnectAll} type="secondary">
186+
Disconnect all
187+
</Button>
178188
</NavigationBarButton>
179189
)
180190
}

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

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
import { Button, SearchBar, showAlert } from '@avalabs/k2-alpine'
1+
import {
2+
Button,
3+
SearchBar,
4+
showAlert,
5+
Text,
6+
TouchableOpacity
7+
} from '@avalabs/k2-alpine'
28
import { useNavigation } from '@react-navigation/native'
39
import { ErrorState } from 'common/components/ErrorState'
410
import { ListScreen } from 'common/components/ListScreen'
511
import NavigationBarButton from 'common/components/NavigationBarButton'
612
import { useBottomTabBarHeight } from 'common/hooks/useBottomTabBarHeight'
13+
import { isIOS26 } from 'common/utils/isIOS26'
714
import { BrowserItem } from 'features/browser/components/BrowserItem'
815
import { useSearchHistory } from 'features/browser/hooks/useSearchHistory'
916
import { prepareFaviconToLoad } from 'features/browser/utils'
@@ -104,14 +111,24 @@ const HistoryScreen = (): JSX.Element => {
104111
)
105112
}
106113

107-
const renderHeaderRight = (): JSX.Element => {
114+
const renderHeaderRight = (): JSX.Element | null => {
115+
if (!hasHistory) return null
116+
if (isIOS26)
117+
return (
118+
<TouchableOpacity
119+
onPress={removeAll}
120+
style={{
121+
paddingHorizontal: 10
122+
}}>
123+
<Text variant="buttonSmall">Clear all</Text>
124+
</TouchableOpacity>
125+
)
126+
108127
return (
109128
<NavigationBarButton>
110-
{hasHistory && (
111-
<Button type="secondary" size="small" onPress={removeAll}>
112-
Clear all
113-
</Button>
114-
)}
129+
<Button type="secondary" size="small" onPress={removeAll}>
130+
Clear all
131+
</Button>
115132
</NavigationBarButton>
116133
)
117134
}

0 commit comments

Comments
 (0)