From 842c7bd3c33782e8d8bce89854f20182bd7fce78 Mon Sep 17 00:00:00 2001 From: marcosrdz Date: Sun, 28 Feb 2021 00:48:35 -0500 Subject: [PATCH] FIX: Catalyst on Big Sur would not show drawer --- Navigation.js | 5 +++-- blue_modules/environment.js | 3 ++- screen/wallets/list.js | 7 +++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Navigation.js b/Navigation.js index ee17159f7..56d9643fa 100644 --- a/Navigation.js +++ b/Navigation.js @@ -76,7 +76,7 @@ import LnurlPaySuccess from './screen/lnd/lnurlPaySuccess'; import LoadingScreen from './LoadingScreen'; import UnlockWith from './UnlockWith'; import DrawerList from './screen/wallets/drawerList'; -import { isTablet } from 'react-native-device-info'; +import { isCatalyst, isTablet } from './blue_modules/environment'; import SettingsPrivacy from './screen/settings/SettingsPrivacy'; import LNDViewAdditionalInvoicePreImage from './screen/lnd/lndViewAdditionalInvoicePreImage'; @@ -348,7 +348,8 @@ const ReorderWalletsStackRoot = () => { const Drawer = createDrawerNavigator(); function DrawerRoot() { const dimensions = useWindowDimensions(); - const isLargeScreen = Platform.OS === 'android' ? isTablet() : dimensions.width >= Dimensions.get('screen').width / 2 && isTablet(); + const isLargeScreen = + Platform.OS === 'android' ? isTablet() : dimensions.width >= Dimensions.get('screen').width / 2 && (isTablet() || isCatalyst); const drawerStyle = { width: '0%' }; return ( diff --git a/blue_modules/environment.js b/blue_modules/environment.js index 4b3b30e37..e708f0db4 100644 --- a/blue_modules/environment.js +++ b/blue_modules/environment.js @@ -1,7 +1,8 @@ -import { getSystemName } from 'react-native-device-info'; +import { getSystemName, isTablet } from 'react-native-device-info'; import isCatalyst from 'react-native-is-catalyst'; const isMacCatalina = getSystemName() === 'Mac OS X'; module.exports.isMacCatalina = isMacCatalina; module.exports.isCatalyst = isCatalyst; +module.exports.isTablet = isTablet; diff --git a/screen/wallets/list.js b/screen/wallets/list.js index 63be55554..7743fae2c 100644 --- a/screen/wallets/list.js +++ b/screen/wallets/list.js @@ -25,10 +25,9 @@ import ActionSheet from '../ActionSheet'; import Clipboard from '@react-native-community/clipboard'; import loc from '../../loc'; import { FContainer, FButton } from '../../components/FloatButtons'; -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, isMacCatalina } from '../../blue_modules/environment'; +import { isCatalyst, isMacCatalina, isTablet } from '../../blue_modules/environment'; const A = require('../../blue_modules/analytics'); const fs = require('../../blue_modules/fs'); @@ -46,7 +45,7 @@ const WalletsList = () => { const [isLoading, setIsLoading] = useState(false); const [itemWidth, setItemWidth] = useState(width * 0.82 > 375 ? 375 : width * 0.82); const [isLargeScreen, setIsLargeScreen] = useState( - Platform.OS === 'android' ? isTablet() : width >= Dimensions.get('screen').width / 2 && isTablet(), + Platform.OS === 'android' ? isTablet() : width >= Dimensions.get('screen').width / 2 && (isTablet() || isCatalyst), ); const [carouselData, setCarouselData] = useState([]); const dataSource = getTransactions(null, 10); @@ -433,7 +432,7 @@ const WalletsList = () => { }; const onLayout = _e => { - setIsLargeScreen(Platform.OS === 'android' ? isTablet() : width >= Dimensions.get('screen').width / 2 && isTablet()); + setIsLargeScreen(Platform.OS === 'android' ? isTablet() : width >= Dimensions.get('screen').width / 2 && (isTablet() || isCatalyst)); setItemWidth(width * 0.82 > 375 ? 375 : width * 0.82); };