From 6ebaa470b1d4cf4b81f6ff64bd2909378d7b0891 Mon Sep 17 00:00:00 2001 From: Luis Perrone Date: Fri, 22 Nov 2024 11:16:38 -0600 Subject: [PATCH] Fix keyboard in iot onboarding --- .../HotspotService/pages/ExplorerPage.tsx | 4 +- .../screens/iot/ScanHotspots.tsx | 10 ++ .../screens/iot/WifiSetup.tsx | 112 +++++++++--------- 3 files changed, 70 insertions(+), 56 deletions(-) diff --git a/src/app/services/HotspotService/pages/ExplorerPage.tsx b/src/app/services/HotspotService/pages/ExplorerPage.tsx index 79fb4c87..712b544e 100644 --- a/src/app/services/HotspotService/pages/ExplorerPage.tsx +++ b/src/app/services/HotspotService/pages/ExplorerPage.tsx @@ -66,7 +66,7 @@ const ExplorerPage = () => { { userLocation?.coords.latitude || 0, ]} > - + {hotspotsWithMeta.map((hotspot) => { diff --git a/src/features/hotspot-onboarding/screens/iot/ScanHotspots.tsx b/src/features/hotspot-onboarding/screens/iot/ScanHotspots.tsx index a389be12..856171eb 100644 --- a/src/features/hotspot-onboarding/screens/iot/ScanHotspots.tsx +++ b/src/features/hotspot-onboarding/screens/iot/ScanHotspots.tsx @@ -158,6 +158,11 @@ const ScanHotspots = () => { } }, [scannedDevices.length, scanning, startScan, stopScan]) + useEffect(() => { + handleScanPress() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) + const navNext = useCallback( () => carouselRef?.current?.snapToNext(), [carouselRef], @@ -166,6 +171,11 @@ const ScanHotspots = () => { const [connecting, setConnecting] = useState(false) const connectDevice = useCallback( (d: Device) => async () => { + if (MOCK) { + navNext() + return + } + try { setConnecting(true) await connect(d) diff --git a/src/features/hotspot-onboarding/screens/iot/WifiSetup.tsx b/src/features/hotspot-onboarding/screens/iot/WifiSetup.tsx index 9e80ff16..eeda4c46 100644 --- a/src/features/hotspot-onboarding/screens/iot/WifiSetup.tsx +++ b/src/features/hotspot-onboarding/screens/iot/WifiSetup.tsx @@ -6,7 +6,7 @@ import React, { useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import ScrollBox from '@components/ScrollBox' import { useColors, useSpacing } from '@config/theme/themeHooks' -import { ViewStyle, StyleProp } from 'react-native' +import { ViewStyle, StyleProp, KeyboardAvoidingView } from 'react-native' import Visibility from '@assets/svgs/visibility.svg' import VisibilityOff from '@assets/svgs/visibilityOff.svg' import TouchableOpacityBox from '@components/TouchableOpacityBox' @@ -85,61 +85,65 @@ const WifiSetup = () => { return ( }> - - - - {t('hotspotOnboarding.wifiSetup.title')} - - - {t('hotspotOnboarding.wifiSetup.subtitle', { network })} - - {error && ( - - {error} - - )} - - - - - {secureTextEntry ? ( - - ) : ( - + + + + {t('hotspotOnboarding.wifiSetup.title')} + + + {t('hotspotOnboarding.wifiSetup.subtitle', { network })} + + {error && ( + + {error} + )} - - - + + + + + {secureTextEntry ? ( + + ) : ( + + )} + + + {!loading && } {loading && }