FIX: Dont use SafeAreaView on non-macOS

This commit is contained in:
marcosrdz 2021-01-02 14:53:02 -05:00
parent e26ca8372d
commit 878efbd265

View File

@ -24,15 +24,14 @@ import ActionSheet from '../ActionSheet';
import Clipboard from '@react-native-community/clipboard';
import loc from '../../loc';
import { FContainer, FButton } from '../../components/FloatButtons';
import { getSystemName, isTablet } from 'react-native-device-info';
import { isTablet } from 'react-native-device-info';
import { useFocusEffect, useNavigation, useRoute, useTheme } from '@react-navigation/native';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import isCatalyst from 'react-native-is-catalyst';
import { isCatalyst, isMacCatalina } from '../../blue_modules/environment';
const A = require('../../blue_modules/analytics');
const fs = require('../../blue_modules/fs');
const WalletsListSections = { CAROUSEL: 'CAROUSEL', LOCALTRADER: 'LOCALTRADER', TRANSACTIONS: 'TRANSACTIONS' };
const isDesktop = getSystemName() === 'Mac OS X';
const WalletsList = () => {
const walletsCarousel = useRef();
@ -324,7 +323,7 @@ const WalletsList = () => {
<FContainer>
<FButton
onPress={onScanButtonPressed}
onLongPress={isDesktop ? undefined : sendButtonLongPress}
onLongPress={isMacCatalina ? undefined : sendButtonLongPress}
icon={<Image resizeMode="stretch" source={scanImage} />}
text={loc.send.details_scan}
/>
@ -340,7 +339,7 @@ const WalletsList = () => {
};
const onScanButtonPressed = () => {
if (isDesktop) {
if (isMacCatalina) {
fs.showActionSheet().then(onBarScanned);
} else {
navigate('ScanQRCodeRoot', {
@ -368,7 +367,7 @@ const WalletsList = () => {
const sendButtonLongPress = async () => {
const isClipboardEmpty = (await Clipboard.getString()).replace(' ', '').length === 0;
if (Platform.OS === 'ios') {
if (isDesktop) {
if (isMacCatalina) {
fs.showActionSheet().then(onBarScanned);
} else {
const options = [loc._.cancel, loc.wallets.list_long_choose, loc.wallets.list_long_scan];
@ -435,10 +434,13 @@ const WalletsList = () => {
setItemWidth(width * 0.82 > 375 ? 375 : width * 0.82);
};
const ContainerView = props =>
isCatalyst ? <SafeAreaView style={styles.root} onLayout={onLayout} {...props} /> : <View style={styles.root} {...props} />;
return (
<SafeAreaView style={styles.root} onLayout={onLayout}>
<ContainerView style={styles.root}>
<StatusBar barStyle="default" />
<View style={[styles.walletsListWrapper, stylesHook.walletsListWrapper]}>
<View style={[styles.walletsListWrapper, stylesHook.walletsListWrapper]} onLayout={onLayout}>
<SectionList
onRefresh={refreshTransactions}
refreshing={isLoading}
@ -456,7 +458,7 @@ const WalletsList = () => {
/>
{renderScanButton()}
</View>
</SafeAreaView>
</ContainerView>
);
};