mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
REF: ScanQRCode moved to its own stack nav
This commit is contained in:
parent
f7af083254
commit
fd3d54d044
2 changed files with 57 additions and 46 deletions
|
@ -58,6 +58,12 @@ const ReorderWalletsStackNavigator = createStackNavigator({
|
|||
},
|
||||
});
|
||||
|
||||
const ScanQRCodeStackNavigator = createStackNavigator({
|
||||
ScanQRCode: {
|
||||
screen: ScanQRCode,
|
||||
},
|
||||
});
|
||||
|
||||
const WalletsStackNavigator = createStackNavigator(
|
||||
{
|
||||
Wallets: {
|
||||
|
@ -283,7 +289,10 @@ const HandleOffchainAndOnChainStackNavigator = createStackNavigator(
|
|||
},
|
||||
},
|
||||
ScanQRCode: {
|
||||
screen: ScanQRCode,
|
||||
screen: ScanQRCodeStackNavigator,
|
||||
navigationOptions: {
|
||||
header: null,
|
||||
},
|
||||
},
|
||||
SendDetails: {
|
||||
screen: CreateTransactionStackNavigator,
|
||||
|
@ -352,7 +361,10 @@ const MainBottomTabs = createStackNavigator(
|
|||
},
|
||||
},
|
||||
ScanQRCode: {
|
||||
screen: ScanQRCode,
|
||||
screen: ScanQRCodeStackNavigator,
|
||||
navigationOptions: {
|
||||
header: null,
|
||||
},
|
||||
},
|
||||
LappBrowser: {
|
||||
screen: LappBrowser,
|
||||
|
|
|
@ -11,7 +11,6 @@ const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
|
|||
const createHash = require('create-hash');
|
||||
|
||||
const ScanQRCode = () => {
|
||||
const showCloseButton = useNavigationParam('showCloseButton') || true;
|
||||
const showFileImportButton = useNavigationParam('showFileImportButton') || false;
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const { navigate } = useNavigation();
|
||||
|
@ -38,7 +37,7 @@ const ScanQRCode = () => {
|
|||
if (!isLoading) {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
if (showCloseButton && launchedBy) {
|
||||
if (launchedBy) {
|
||||
navigate(launchedBy);
|
||||
}
|
||||
if (ret.additionalProperties) {
|
||||
|
@ -77,55 +76,7 @@ const ScanQRCode = () => {
|
|||
setIsLoading(false);
|
||||
};
|
||||
|
||||
const dismiss = () => {
|
||||
navigate(launchedBy);
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={{ flex: 1, backgroundColor: '#000000' }}>
|
||||
{!isLoading && isFocused && (
|
||||
<RNCamera
|
||||
captureAudio={false}
|
||||
androidCameraPermissionOptions={{
|
||||
title: 'Permission to use camera',
|
||||
message: 'We need your permission to use your camera',
|
||||
buttonPositive: 'OK',
|
||||
buttonNegative: 'Cancel',
|
||||
}}
|
||||
style={{ flex: 1 }}
|
||||
onBarCodeRead={onBarCodeRead}
|
||||
barCodeTypes={[RNCamera.Constants.BarCodeType.qr]}
|
||||
/>
|
||||
)}
|
||||
{showCloseButton && (
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
width: 40,
|
||||
height: 40,
|
||||
backgroundColor: 'rgba(0,0,0,0.4)',
|
||||
justifyContent: 'center',
|
||||
borderRadius: 20,
|
||||
position: 'absolute',
|
||||
right: 16,
|
||||
top: 44,
|
||||
}}
|
||||
onPress={dismiss}
|
||||
>
|
||||
<Image style={{ alignSelf: 'center' }} source={require('../../img/close-white.png')} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
width: 40,
|
||||
height: 40,
|
||||
backgroundColor: 'rgba(0,0,0,0.4)',
|
||||
justifyContent: 'center',
|
||||
borderRadius: 20,
|
||||
position: 'absolute',
|
||||
left: 24,
|
||||
bottom: 48,
|
||||
}}
|
||||
onPress={() => {
|
||||
const showImagePicker = () => {
|
||||
if (!isLoading) {
|
||||
setIsLoading(true);
|
||||
ImagePicker.launchImageLibrary(
|
||||
|
@ -149,7 +100,55 @@ const ScanQRCode = () => {
|
|||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const dismiss = () => {
|
||||
navigate(launchedBy);
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={{ flex: 1, backgroundColor: '#000000' }}>
|
||||
{!isLoading && isFocused && (
|
||||
<RNCamera
|
||||
captureAudio={false}
|
||||
androidCameraPermissionOptions={{
|
||||
title: 'Permission to use camera',
|
||||
message: 'We need your permission to use your camera',
|
||||
buttonPositive: 'OK',
|
||||
buttonNegative: 'Cancel',
|
||||
}}
|
||||
style={{ flex: 1 }}
|
||||
onBarCodeRead={onBarCodeRead}
|
||||
barCodeTypes={[RNCamera.Constants.BarCodeType.qr]}
|
||||
/>
|
||||
)}
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
width: 40,
|
||||
height: 40,
|
||||
backgroundColor: 'rgba(0,0,0,0.4)',
|
||||
justifyContent: 'center',
|
||||
borderRadius: 20,
|
||||
position: 'absolute',
|
||||
right: 16,
|
||||
top: 44,
|
||||
}}
|
||||
onPress={dismiss}
|
||||
>
|
||||
<Image style={{ alignSelf: 'center' }} source={require('../../img/close-white.png')} />
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
width: 40,
|
||||
height: 40,
|
||||
backgroundColor: 'rgba(0,0,0,0.4)',
|
||||
justifyContent: 'center',
|
||||
borderRadius: 20,
|
||||
position: 'absolute',
|
||||
left: 24,
|
||||
bottom: 48,
|
||||
}}
|
||||
onPress={showImagePicker}
|
||||
>
|
||||
<Icon name="image" type="font-awesome" color="#ffffff" />
|
||||
</TouchableOpacity>
|
||||
|
|
Loading…
Add table
Reference in a new issue