Skip to content
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

fix(wallet-mobile): Fix keyboard avoiding view #3705

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 11 additions & 6 deletions apps/wallet-mobile/src/AppNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {NavigationContainer, NavigationContainerRef} from '@react-navigation/nat
import {createStackNavigator, TransitionPresets} from '@react-navigation/stack'
import {isString} from '@yoroi/common'
import {supportedPrefixes} from '@yoroi/links'
import {useTheme} from '@yoroi/theme'
import {ThemedPalette, useTheme} from '@yoroi/theme'
import * as React from 'react'
import {defineMessages, useIntl} from 'react-intl'
import {Alert, AppState, AppStateStatus, InteractionManager, Platform} from 'react-native'
Expand Down Expand Up @@ -44,6 +44,13 @@ const Stack = createStackNavigator<AppRoutes>()
const navRef = React.createRef<NavigationContainerRef<ReactNavigation.RootParamList>>()
const prefixes = [...supportedPrefixes]

const changeNavigationBarColor = (colorScheme: 'default-dark' | 'default-light', color: ThemedPalette) => {
const buttonsColor = colorScheme === 'default-dark' ? 'light' : 'dark'
// Using 'transparent' or 'translucent' background breaks KeyboardAvoidingView
// https://github.com/kadiraydinli/react-native-system-navigation-bar/issues/38
SystemNavigationBar.setNavigationColor(color.bg_color_max, buttonsColor, 'navigation')
}

export const AppNavigator = () => {
useDeepLinkWatcher()
const strings = useStrings()
Expand All @@ -53,9 +60,8 @@ export const AppNavigator = () => {
const {atoms, color, colorScheme} = useTheme()

React.useEffect(() => {
const buttonsColor = colorScheme === 'default-dark' ? 'light' : 'dark'
SystemNavigationBar.setNavigationColor('transparent', buttonsColor, 'navigation')
}, [colorScheme])
changeNavigationBarColor(colorScheme, color)
}, [colorScheme, color])

useAutoLogout()

Expand All @@ -64,8 +70,7 @@ export const AppNavigator = () => {
onSuccess: login,
onSettled: async () => {
await RNBootSplash.hide({fade: true})
const buttonsColor = colorScheme === 'default-dark' ? 'light' : 'dark'
SystemNavigationBar.setNavigationColor('transparent', buttonsColor, 'navigation')
changeNavigationBarColor(colorScheme, color)
},
})

Expand Down
32 changes: 16 additions & 16 deletions apps/wallet-mobile/translations/messages/src/AppNavigator.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,59 @@
"defaultMessage": "!!!Enter PIN",
"file": "src/AppNavigator.tsx",
"start": {
"line": 237,
"line": 245,
"column": 17,
"index": 8706
"index": 9103
},
"end": {
"line": 240,
"line": 248,
"column": 3,
"index": 8796
"index": 9193
}
},
{
"id": "components.initialization.custompinscreen.title",
"defaultMessage": "!!!Set PIN",
"file": "src/AppNavigator.tsx",
"start": {
"line": 241,
"line": 249,
"column": 18,
"index": 8816
"index": 9213
},
"end": {
"line": 244,
"line": 252,
"column": 3,
"index": 8914
"index": 9311
}
},
{
"id": "global.actions.dialogs.walletKeysInvalidated.title",
"defaultMessage": "!!!Auth with OS changes",
"file": "src/AppNavigator.tsx",
"start": {
"line": 245,
"line": 253,
"column": 25,
"index": 8941
"index": 9338
},
"end": {
"line": 248,
"line": 256,
"column": 3,
"index": 9055
"index": 9452
}
},
{
"id": "global.actions.dialogs.biometricsChange.message",
"defaultMessage": "!!!Auth with OS changed detected",
"file": "src/AppNavigator.tsx",
"start": {
"line": 249,
"line": 257,
"column": 27,
"index": 9084
"index": 9481
},
"end": {
"line": 252,
"line": 260,
"column": 3,
"index": 9205
"index": 9602
}
}
]
Loading