-
Notifications
You must be signed in to change notification settings - Fork 12
CP-13356 - iOS 26 - Broken button on Browser history and Connected sites #3568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { Platform } from 'react-native' | ||
| import DeviceInfo from 'react-native-device-info' | ||
|
|
||
| export const isIOS26 = | ||
| DeviceInfo.getSystemVersion() >= '26' && Platform.OS === 'ios' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ import React, { useCallback, useMemo, useState } from 'react' | |
| import { DappLogo } from 'common/components/DappLogo' | ||
| import { ErrorState } from 'common/components/ErrorState' | ||
| import NavigationBarButton from 'common/components/NavigationBarButton' | ||
| import { isIOS26 } from 'common/utils/isIOS26' | ||
|
|
||
| const ConnectedSitesScreen = (): JSX.Element => { | ||
| const { | ||
|
|
@@ -167,14 +168,23 @@ const ConnectedSitesScreen = (): JSX.Element => { | |
|
|
||
| const renderSeparator = (): JSX.Element => <View sx={{ height: 12 }} /> | ||
|
|
||
| const renderHeaderRight = (): JSX.Element => { | ||
| const renderHeaderRight = (): JSX.Element | null => { | ||
| if (allApprovedDapps.length === 0) return null | ||
| if (isIOS26) | ||
| return ( | ||
| <TouchableOpacity | ||
| onPress={disconnectAll} | ||
| style={{ | ||
| paddingHorizontal: 10 | ||
| }}> | ||
|
Comment on lines
+177
to
+179
|
||
| <Text variant="buttonSmall">Disconnect all</Text> | ||
| </TouchableOpacity> | ||
|
Comment on lines
+175
to
+181
|
||
| ) | ||
| return ( | ||
| <NavigationBarButton> | ||
| {allApprovedDapps.length ? ( | ||
| <Button size="small" onPress={disconnectAll} type="secondary"> | ||
| Disconnect all | ||
| </Button> | ||
| ) : null} | ||
| <Button size="small" onPress={disconnectAll} type="secondary"> | ||
| Disconnect all | ||
| </Button> | ||
| </NavigationBarButton> | ||
| ) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,16 @@ | ||
| import { Button, SearchBar, showAlert } from '@avalabs/k2-alpine' | ||
| import { | ||
| Button, | ||
| SearchBar, | ||
| showAlert, | ||
| Text, | ||
| TouchableOpacity | ||
| } from '@avalabs/k2-alpine' | ||
| import { useNavigation } from '@react-navigation/native' | ||
| import { ErrorState } from 'common/components/ErrorState' | ||
| import { ListScreen } from 'common/components/ListScreen' | ||
| import NavigationBarButton from 'common/components/NavigationBarButton' | ||
| import { useBottomTabBarHeight } from 'common/hooks/useBottomTabBarHeight' | ||
| import { isIOS26 } from 'common/utils/isIOS26' | ||
| import { BrowserItem } from 'features/browser/components/BrowserItem' | ||
| import { useSearchHistory } from 'features/browser/hooks/useSearchHistory' | ||
| import { prepareFaviconToLoad } from 'features/browser/utils' | ||
|
|
@@ -104,14 +111,24 @@ const HistoryScreen = (): JSX.Element => { | |
| ) | ||
| } | ||
|
|
||
| const renderHeaderRight = (): JSX.Element => { | ||
| const renderHeaderRight = (): JSX.Element | null => { | ||
| if (!hasHistory) return null | ||
| if (isIOS26) | ||
| return ( | ||
| <TouchableOpacity | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. curious why we haven't just defaulted to using TouchableOpacity instead of if else'ing it here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. iOS 26 has default buttons for navigation, had to restyle them and remove the gray background from those buttons |
||
| onPress={removeAll} | ||
| style={{ | ||
| paddingHorizontal: 10 | ||
| }}> | ||
|
Comment on lines
+120
to
+122
|
||
| <Text variant="buttonSmall">Clear all</Text> | ||
| </TouchableOpacity> | ||
|
Comment on lines
+118
to
+124
|
||
| ) | ||
|
|
||
| return ( | ||
| <NavigationBarButton> | ||
| {hasHistory && ( | ||
| <Button type="secondary" size="small" onPress={removeAll}> | ||
| Clear all | ||
| </Button> | ||
| )} | ||
| <Button type="secondary" size="small" onPress={removeAll}> | ||
| Clear all | ||
| </Button> | ||
| </NavigationBarButton> | ||
| ) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String comparison is used for version checking, which is not semantically correct and could lead to incorrect results in edge cases. For example, if the system version were '3.0' (unlikely but possible in edge cases), it would incorrectly evaluate to true since '3' > '2' lexicographically. The version should be parsed as a number before comparison. Consider using parseFloat(DeviceInfo.getSystemVersion()) >= 26 for more robust version checking.