From e3993c9c9c32fd0be74857c5e4c97711fe972131 Mon Sep 17 00:00:00 2001 From: Kathy Luo Date: Fri, 10 Feb 2023 14:53:25 +0100 Subject: [PATCH 1/3] chore: upgrade react-native-gesture-handler to v2 --- .../java/org/celo/mobile/MainActivity.java | 6 --- ios/Podfile.lock | 4 +- package.json | 2 +- src/components/BottomSheet.tsx | 23 +++++----- src/components/TokenBottomSheetLegacy.tsx | 3 +- src/fiatExchanges/FiatExchangeCurrency.tsx | 12 +++-- src/onboarding/registration/PictureInput.tsx | 28 ++++++------ .../detailContent/RewardReceivedContent.tsx | 6 +-- src/walletConnect/screens/Sessions.tsx | 45 +++++++++---------- yarn.lock | 39 +++------------- 10 files changed, 70 insertions(+), 98 deletions(-) diff --git a/android/app/src/main/java/org/celo/mobile/MainActivity.java b/android/app/src/main/java/org/celo/mobile/MainActivity.java index d00f2bb8ca6..3f97fbfab1b 100644 --- a/android/app/src/main/java/org/celo/mobile/MainActivity.java +++ b/android/app/src/main/java/org/celo/mobile/MainActivity.java @@ -13,7 +13,6 @@ import com.facebook.react.ReactRootView; import com.facebook.react.bridge.ReactContext; import com.facebook.react.modules.core.DeviceEventManagerModule; -import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; import java.util.Date; import org.devio.rn.splashscreen.SplashScreen; @@ -76,11 +75,6 @@ public void onNewIntent(Intent intent) { @Override protected ReactActivityDelegate createReactActivityDelegate() { return new ReactActivityDelegate(this, getMainComponentName()) { - @Override - protected ReactRootView createRootView() { - return new RNGestureHandlerEnabledRootView(MainActivity.this); - } - @Override protected Bundle getLaunchOptions() { // This is used to pass props (in this case app start time) to React diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 5797f94400c..83e0d6e86f4 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -586,7 +586,7 @@ PODS: - RNFBApp - RNFS (2.20.0): - React-Core - - RNGestureHandler (1.9.0): + - RNGestureHandler (2.9.0): - React-Core - RNImageCropPicker (0.35.2): - React-Core @@ -1097,7 +1097,7 @@ SPEC CHECKSUMS: RNFBMessaging: b05aa2a76ed2b9fd50f05f036c96b26189a1fce2 RNFBRemoteConfig: e8d462f46e1759a5921d0e4b76d0ab89aef9baee RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 - RNGestureHandler: 9b7e605a741412e20e13c512738a31bd1611759b + RNGestureHandler: 071d7a9ad81e8b83fe7663b303d132406a7d8f39 RNImageCropPicker: 9e0bf18cf4184a846fed55747c8e622208b39947 RNKeychain: 4f63aada75ebafd26f4bc2c670199461eab85d94 RNLocalize: f567ea0e35116a641cdffe6683b0d212d568f32a diff --git a/package.json b/package.json index 3d5e4dc1656..db9147ba5b1 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "react-native-exit-app": "^1.1.0", "react-native-fast-crypto": "^2.2.0", "react-native-fs": "^2.20.0", - "react-native-gesture-handler": "^1.9.0", + "react-native-gesture-handler": "^2.9.0", "react-native-get-random-values": "^1.8.0", "react-native-image-crop-picker": "^0.35.1", "react-native-keychain": "8.0.0", diff --git a/src/components/BottomSheet.tsx b/src/components/BottomSheet.tsx index 086a570b754..90369be0c83 100644 --- a/src/components/BottomSheet.tsx +++ b/src/components/BottomSheet.tsx @@ -1,6 +1,11 @@ import React, { useState } from 'react' -import { Dimensions, LayoutChangeEvent, StyleSheet, View } from 'react-native' -import { TouchableWithoutFeedback } from 'react-native-gesture-handler' +import { + Dimensions, + LayoutChangeEvent, + StyleSheet, + TouchableWithoutFeedback, + View, +} from 'react-native' import Animated, { useAnimatedStyle, useSharedValue } from 'react-native-reanimated' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useShowOrHideAnimation } from 'src/components/useShowOrHideAnimation' @@ -58,13 +63,9 @@ function BottomSheet({ children, isVisible, onBackgroundPress }: Props) { return ( - - - + + + = maxHeight ? styles.fullHeightScrollView : undefined} @@ -93,10 +94,6 @@ const styles = StyleSheet.create({ width: '100%', height: '100%', }, - backgroundTouchable: { - width: '100%', - height: '100%', - }, contentContainer: { position: 'absolute', bottom: 0, diff --git a/src/components/TokenBottomSheetLegacy.tsx b/src/components/TokenBottomSheetLegacy.tsx index d67a3f3b4e9..a0716a422b3 100644 --- a/src/components/TokenBottomSheetLegacy.tsx +++ b/src/components/TokenBottomSheetLegacy.tsx @@ -1,8 +1,7 @@ import BigNumber from 'bignumber.js' import React, { useState } from 'react' import { useTranslation } from 'react-i18next' -import { LayoutChangeEvent, StyleSheet, Text, View } from 'react-native' -import { TouchableWithoutFeedback } from 'react-native-gesture-handler' +import { LayoutChangeEvent, StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native' import Animated, { useAnimatedStyle, useSharedValue } from 'react-native-reanimated' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { SendEvents } from 'src/analytics/Events' diff --git a/src/fiatExchanges/FiatExchangeCurrency.tsx b/src/fiatExchanges/FiatExchangeCurrency.tsx index f5b6d8477ba..5c0ff9e4bc2 100644 --- a/src/fiatExchanges/FiatExchangeCurrency.tsx +++ b/src/fiatExchanges/FiatExchangeCurrency.tsx @@ -2,8 +2,15 @@ import { RouteProp } from '@react-navigation/native' import { NativeStackScreenProps } from '@react-navigation/native-stack' import React, { useState } from 'react' import { useTranslation } from 'react-i18next' -import { SafeAreaView, ScrollView, StyleSheet, Text, View, ViewStyle } from 'react-native' -import { TouchableWithoutFeedback } from 'react-native-gesture-handler' +import { + SafeAreaView, + ScrollView, + StyleSheet, + Text, + TouchableWithoutFeedback, + View, + ViewStyle, +} from 'react-native' import { FiatExchangeEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' import BackButton from 'src/components/BackButton' @@ -70,7 +77,6 @@ function CurrencyRadioItem({ return ( - - {picture ? ( - - ) : ( - - {t('addPhoto')} - - )} - - - - + <> + {picture ? ( + + ) : ( + + {t('addPhoto')} + + )} + + + + + } testID="RewardReceived" /> - + {t('learnMore')} - + + @@ -44,7 +45,7 @@ const Dapp = ({ {t('tapToDisconnect')} - + ) } @@ -82,7 +83,7 @@ function Sessions() { : highlighted?.peerMeta?.name return ( - + - - {t('sessionsTitle')} - {t('sessionsSubTitle')} - + {t('sessionsTitle')} + {t('sessionsSubTitle')} - - {sessionsV1.map((s) => ( - - ))} - {sessionsV2.map((s) => ( - - ))} - + {sessionsV1.map((s) => ( + + ))} + {sessionsV2.map((s) => ( + + ))} ) } @@ -135,19 +132,21 @@ const styles = StyleSheet.create({ }, title: { ...fontStyles.h2, - marginTop: 16, + paddingVertical: Spacing.Regular16, }, subTitle: { ...fontStyles.regular, color: colors.dark, - paddingVertical: 16, - }, - appsContainer: { - paddingVertical: 24, + paddingBottom: Spacing.Thick24, }, // connected apps - row: { display: 'flex', flexDirection: 'row', alignItems: 'center', paddingBottom: 24 }, + row: { + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + paddingVertical: Spacing.Small12, + }, icon: { height: 40, width: 40 }, rowContent: { paddingLeft: 12, diff --git a/yarn.lock b/yarn.lock index 6b255f208c4..7d72d9a977d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6455,7 +6455,7 @@ arrify@^2.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== -asap@^2.0.0, asap@~2.0.3, asap@~2.0.6: +asap@^2.0.0, asap@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= @@ -9945,24 +9945,6 @@ fb-watchman@^2.0.0: dependencies: bser "^2.0.0" -fbjs-css-vars@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.1.tgz#836d876e887d702f45610f5ebd2fbeef649527fc" - integrity sha512-IM+v/C40MNZWqsLErc32e0TyIk/NhkkQZL0QmjBh6zi1eXv0/GeVKmKmueQX7nn9SXQBQbTUcB8zuexIF3/88w== - -fbjs@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-3.0.0.tgz#0907067fb3f57a78f45d95f1eacffcacd623c165" - integrity sha512-dJd4PiDOFuhe7vk4F80Mba83Vr2QuK86FoxtgPmzBqEJahncp+13YCmfoa53KHCo6OnlXLG7eeMWPfB5CrpVKg== - dependencies: - cross-fetch "^3.0.4" - fbjs-css-vars "^1.0.0" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.18" - fd-slicer@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" @@ -15312,13 +15294,6 @@ promise-polyfill@^8.1.3: resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.1.3.tgz#8c99b3cf53f3a91c68226ffde7bde81d7f904116" integrity sha512-MG5r82wBzh7pSKDRa9y+vllNHz3e3d4CNj1PQE4BQYxLme0gKYYBm9YENq+UkEikyZ0XbiGWxYlVw3Rl9O/U8g== -promise@^7.1.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" - integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== - dependencies: - asap "~2.0.3" - promise@^8.0.3: version "8.1.0" resolved "https://registry.yarnpkg.com/promise/-/promise-8.1.0.tgz#697c25c3dfe7435dd79fcd58c38a135888eaf05e" @@ -15800,15 +15775,15 @@ react-native-fs@^2.20.0: base-64 "^0.1.0" utf8 "^3.0.0" -react-native-gesture-handler@^1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-1.9.0.tgz#e441b1c0277c3fd4ca3e5c58fdd681e2f0ceddf0" - integrity sha512-fkkNeWDBzDdwDxDcxtYbrb9T1g0PLgT1AxBs2iO/p7uEbDbC6mIoL/NzuOnKNEBHcd0lpLoJuNmIfdmucEON5g== +react-native-gesture-handler@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.9.0.tgz#2f63812e523c646f25b9ad660fc6f75948e51241" + integrity sha512-a0BcH3Qb1tgVqUutc6d3VuWQkI1AM3+fJx8dkxzZs9t06qA27QgURYFoklpabuWpsUTzuKRpxleykp25E8m7tg== dependencies: "@egjs/hammerjs" "^2.0.17" - fbjs "^3.0.0" hoist-non-react-statics "^3.3.0" invariant "^2.2.4" + lodash "^4.17.21" prop-types "^15.7.2" react-native-get-random-values@^1.8.0: @@ -18577,7 +18552,7 @@ typescript@~4.5.0: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA== -ua-parser-js@^0.7.18, ua-parser-js@^0.7.33: +ua-parser-js@^0.7.33: version "0.7.33" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.33.tgz#1d04acb4ccef9293df6f70f2c3d22f3030d8b532" integrity sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw== From a58d5d9d0a2753923af1f9b65449c207fba7ef5d Mon Sep 17 00:00:00 2001 From: Kathy Luo Date: Fri, 10 Feb 2023 15:25:31 +0100 Subject: [PATCH 2/3] fix: tests --- .../__snapshots__/Profile.test.tsx.snap | 147 ++++++++--------- src/components/TokenBottomSheetLegacy.tsx | 14 +- .../TokenBottomSheetLegacy.test.tsx.snap | 32 ++-- .../__snapshots__/PictureInput.test.tsx.snap | 155 +++++++++--------- 4 files changed, 166 insertions(+), 182 deletions(-) diff --git a/src/account/__snapshots__/Profile.test.tsx.snap b/src/account/__snapshots__/Profile.test.tsx.snap index 137406fb978..4a927d57b71 100644 --- a/src/account/__snapshots__/Profile.test.tsx.snap +++ b/src/account/__snapshots__/Profile.test.tsx.snap @@ -28,88 +28,89 @@ exports[`Profile renders correctly 1`] = ` } } > - - - - addPhoto - - + + - - - - - + /> + + - + - - - + + + - - - - + testID="BackgroundTouchable" + /> + - - - - - - - + /> + + - , + , Date: Fri, 10 Feb 2023 16:39:58 +0100 Subject: [PATCH 3/3] fix: offramps test --- e2e/src/usecases/OffRamps.js | 7 ------- src/fiatExchanges/FiatExchangeCurrency.test.tsx | 2 ++ src/fiatExchanges/FiatExchangeCurrency.tsx | 3 +-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/e2e/src/usecases/OffRamps.js b/e2e/src/usecases/OffRamps.js index 688cd7c646b..76a0cae4e68 100644 --- a/e2e/src/usecases/OffRamps.js +++ b/e2e/src/usecases/OffRamps.js @@ -48,13 +48,6 @@ export default offRamps = () => { await waitForElementId('RNWebView') await expect(element(by.text('Bidali'))).toBeVisible() }) - - // TODO(tomm) debug why this is failing on Android - it(':ios: Then should not be able to spend CELO', async () => { - await waitForElementId('radio/CELO') - let celoRadioButton = await element(by.id('radio/CELO')).getAttributes() - jestExpect(celoRadioButton.enabled).toBeFalsy() - }) }) describe('When Withdraw Selected', () => { diff --git a/src/fiatExchanges/FiatExchangeCurrency.test.tsx b/src/fiatExchanges/FiatExchangeCurrency.test.tsx index f41462fe08f..795972c2a49 100644 --- a/src/fiatExchanges/FiatExchangeCurrency.test.tsx +++ b/src/fiatExchanges/FiatExchangeCurrency.test.tsx @@ -69,6 +69,8 @@ describe('FiatExchangeCurrency', () => { ) + expect(tree.getByTestId('radio/CELO')).toBeDisabled() + fireEvent.press(tree.getByTestId('radio/cEUR')) fireEvent.press(tree.getByText('next')) expect(navigate).toHaveBeenCalledWith(Screens.BidaliScreen, { diff --git a/src/fiatExchanges/FiatExchangeCurrency.tsx b/src/fiatExchanges/FiatExchangeCurrency.tsx index 5c0ff9e4bc2..2296a446aed 100644 --- a/src/fiatExchanges/FiatExchangeCurrency.tsx +++ b/src/fiatExchanges/FiatExchangeCurrency.tsx @@ -75,14 +75,13 @@ function CurrencyRadioItem({ testID?: string }) { return ( - +