Skip to content

Commit

Permalink
remove navigation event that exits app
Browse files Browse the repository at this point in the history
  • Loading branch information
KKA11010 committed Nov 19, 2023
1 parent 24a2e95 commit c72d5af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ function _App() {
}

const handlePinForeground = async () => {
// check if app has pw
const pw = await secureStore.get(SECURESTORE_KEY)
if (isNull(pw)) { return }
// check if app is locked
const now = Math.ceil(Date.now() / 1000)
const lockData = await store.getObj<ILockData>(STORE_KEYS.lock)
Expand Down
9 changes: 1 addition & 8 deletions src/screens/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { claimToken, getMintsForPayment } from '@wallet'
import { getTokenInfo } from '@wallet/proofs'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { BackHandler, StyleSheet, TouchableOpacity, View } from 'react-native'
import { StyleSheet, TouchableOpacity, View } from 'react-native'

export default function Dashboard({ navigation, route }: TDashboardPageProps) {
const { t } = useTranslation([NS.common])
Expand Down Expand Up @@ -284,13 +284,6 @@ export default function Dashboard({ navigation, route }: TDashboardPageProps) {
return focusHandler
}, [navigation])

// prevent back navigation - https://reactnavigation.org/docs/preventing-going-back/
useEffect(() => {
const backHandler = () => BackHandler.exitApp()
navigation.addListener('beforeRemove', backHandler)
return () => navigation.removeListener('beforeRemove', backHandler)
}, [navigation])

return (
<View style={[styles.container, { backgroundColor: color.BACKGROUND }]}>
{/* Balance, Disclaimer & History */}
Expand Down

0 comments on commit c72d5af

Please sign in to comment.