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

Fixes can't go back after disallowing camera access #205

Merged
merged 1 commit into from
Sep 11, 2023
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
3 changes: 2 additions & 1 deletion src/components/Empty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ interface IEmptyProps {
hasOk?: boolean
pressable?: boolean
onPress?: () => void
nav?: NativeStackNavigationProp<RootStackParamList, 'nostrReceive', 'MyStack'>
nav?: NativeStackNavigationProp<RootStackParamList, 'nostrReceive', 'MyStack'> |
NativeStackNavigationProp<RootStackParamList, 'qr scan', 'MyStack'>
}

export default function Empty({ txt, hasOk, pressable, onPress, nav }: IEmptyProps) {
Expand Down
17 changes: 7 additions & 10 deletions src/screens/QRScan/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getDecodedLnInvoice } from '@cashu/cashu-ts'
import Empty from '@comps/Empty'
import useLoading from '@comps/hooks/Loading'
import useCashuToken from '@comps/hooks/Token'
import { CloseIcon, FlashlightOffIcon } from '@comps/Icons'
Expand Down Expand Up @@ -223,7 +224,11 @@ export default function QRScanPage({ navigation, route }: TQRScanPageProps) {
}, [isFocused])

return (
<View style={[globals(color).container, styles.container]}>
<View style={[
globals(color).container,
styles.container,
isFocused && hasPermission ? { justifyContent: 'center' } : {}
]}>
{isFocused && hasPermission ?
<>
<Camera
Expand Down Expand Up @@ -262,9 +267,7 @@ export default function QRScanPage({ navigation, route }: TQRScanPageProps) {
</TouchableOpacity>
</>
:
<Text style={styles.noAccess}>
{t('noCamAccess')}
</Text>
<Empty txt={t('noCamAccess')} hasOk nav={navigation} />
}
{/* Question modal for mint trusting */}
{trustModal &&
Expand All @@ -283,12 +286,6 @@ const styles = StyleSheet.create({
container: {
paddingTop: 0,
alignItems: 'center',
justifyContent: 'center',
},
noAccess: {
fontSize: 16,
fontWeight: '500',
color: mainColors.WHITE
},
flashOn: {
position: 'absolute',
Expand Down
Loading