From 951aa1b4ab68dab5120241ab11b2a82f21b4753e Mon Sep 17 00:00:00 2001 From: LewisB Date: Tue, 14 Nov 2023 06:50:07 +0700 Subject: [PATCH 01/17] wip: always automatically update snapshots when running tests --- package.json | 2 +- .../dashboard/__tests__/__snapshots__/Claim.js.snap | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/package.json b/package.json index fcb7cff461..9c7e68318d 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "test": "npm run lingui:compile && npm run test:web && npm run test:native", "test:setup": "./scripts/blockchainTestSetup.sh", "test:web-watch": "npm run link && node scripts/test.js --watch --config \"./config/web.jest.config.js\"", - "test:web": "REACT_APP_ENV=test react-app-rewired test --forceExit", + "test:web": "REACT_APP_ENV=test react-app-rewired test -u --forceExit", "test:local": "npm run ganache && REACT_APP_ENV=test npm run lingui:compile && npm run test:web", "test:native": "npm run test:ios && npm run test:android", "test:ios": "npm run animation:assets && ENVFILE=.env.test detox build -c ios.sim.debug && detox test -c ios.sim.debug", diff --git a/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap b/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap index ffbfe089dd..828bfaccea 100644 --- a/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap +++ b/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap @@ -323,12 +323,6 @@ More G$'s Coming Soon
-
- - -
-
- - -
Date: Tue, 14 Nov 2023 06:50:44 +0700 Subject: [PATCH 02/17] also add update snapshot option to coverage --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9c7e68318d..b744d92b12 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "test:native": "npm run test:ios && npm run test:android", "test:ios": "npm run animation:assets && ENVFILE=.env.test detox build -c ios.sim.debug && detox test -c ios.sim.debug", "test:android": "npm run animation:assets && ENVFILE=.env.test detox build -c android.emu.debug && detox test -c android.emu.debug", - "coverage": "npm run lingui:compile && REACT_APP_ENV=test react-app-rewired test --coverage --forceExit", + "coverage": "npm run lingui:compile && REACT_APP_ENV=test react-app-rewired test -u --coverage --forceExit", "coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls", "bundlesize:check": "bundlesize", "flow": "flow", From cec303181361ef3a16cdf8b3ae4fcee2c201f2a4 Mon Sep 17 00:00:00 2001 From: LewisB Date: Tue, 14 Nov 2023 18:55:26 +0700 Subject: [PATCH 03/17] fix: align buttons on feedmodal --- src/components/common/modal/ModalActionsByFeedType.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/modal/ModalActionsByFeedType.js b/src/components/common/modal/ModalActionsByFeedType.js index a178c0ee34..fffa90b696 100644 --- a/src/components/common/modal/ModalActionsByFeedType.js +++ b/src/components/common/modal/ModalActionsByFeedType.js @@ -345,7 +345,7 @@ const ModalActionsByFeedType = ({ theme, styles, item, handleModalClose, navigat const getStylesFromProps = ({ theme }) => ({ buttonsView: { - alignItems: 'flex-end', + alignItems: 'flex-start', display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', From ee0d46eaab7d3363071c06d871171a229f855545 Mon Sep 17 00:00:00 2001 From: LewisB Date: Tue, 14 Nov 2023 19:49:56 +0700 Subject: [PATCH 04/17] Revert "also add update snapshot option to coverage" This reverts commit faab472c9f79c549ed24520365132b588f2f27da. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b744d92b12..9c7e68318d 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "test:native": "npm run test:ios && npm run test:android", "test:ios": "npm run animation:assets && ENVFILE=.env.test detox build -c ios.sim.debug && detox test -c ios.sim.debug", "test:android": "npm run animation:assets && ENVFILE=.env.test detox build -c android.emu.debug && detox test -c android.emu.debug", - "coverage": "npm run lingui:compile && REACT_APP_ENV=test react-app-rewired test -u --coverage --forceExit", + "coverage": "npm run lingui:compile && REACT_APP_ENV=test react-app-rewired test --coverage --forceExit", "coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls", "bundlesize:check": "bundlesize", "flow": "flow", From 3a3429a4870e59f180cd406a0fff576c765592ae Mon Sep 17 00:00:00 2001 From: LewisB Date: Tue, 14 Nov 2023 19:50:14 +0700 Subject: [PATCH 05/17] Revert "wip: always automatically update snapshots when running tests" This reverts commit 951aa1b4ab68dab5120241ab11b2a82f21b4753e. --- package.json | 2 +- .../dashboard/__tests__/__snapshots__/Claim.js.snap | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9c7e68318d..fcb7cff461 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "test": "npm run lingui:compile && npm run test:web && npm run test:native", "test:setup": "./scripts/blockchainTestSetup.sh", "test:web-watch": "npm run link && node scripts/test.js --watch --config \"./config/web.jest.config.js\"", - "test:web": "REACT_APP_ENV=test react-app-rewired test -u --forceExit", + "test:web": "REACT_APP_ENV=test react-app-rewired test --forceExit", "test:local": "npm run ganache && REACT_APP_ENV=test npm run lingui:compile && npm run test:web", "test:native": "npm run test:ios && npm run test:android", "test:ios": "npm run animation:assets && ENVFILE=.env.test detox build -c ios.sim.debug && detox test -c ios.sim.debug", diff --git a/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap b/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap index 828bfaccea..ffbfe089dd 100644 --- a/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap +++ b/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap @@ -323,6 +323,12 @@ More G$'s Coming Soon
+
+ - +
+
+ - +
Date: Thu, 16 Nov 2023 09:46:17 +0700 Subject: [PATCH 06/17] fix: buggy animation during slow-scrolling feed --- src/components/dashboard/Dashboard.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/dashboard/Dashboard.js b/src/components/dashboard/Dashboard.js index 08e1c28786..24d22b958e 100644 --- a/src/components/dashboard/Dashboard.js +++ b/src/components/dashboard/Dashboard.js @@ -313,6 +313,7 @@ const Dashboard = props => { const [activeTab, setActiveTab] = useState(FeedCategories.All) const [getCurrentTab] = usePropsRefs([activeTab]) const { onGiveUp } = useGiveUpDialog(navigation, 'cancelled') + const staticScrollbarOffset = useRef(0) const { currentNetwork } = useSwitchNetwork() @@ -350,7 +351,7 @@ const Dashboard = props => { const sendReceiveAnimStyles = { width: '100%', - marginTop: headerLarge ? 5 : 0, + marginTop: 5, transform: [ { translateY: sendReceiveMinimzedYAnimValue.interpolate({ @@ -825,7 +826,17 @@ const Dashboard = props => { const scrollPosition = nativeEvent.contentOffset.y const { minScrollRequiredISH, scrollPositionGap, isFeedSizeEnough } = scrollData const scrollPositionISH = scrollPosition + scrollPositionGap - setHeaderLarge(!isFeedSizeEnough || scrollPositionISH < minScrollRequiredISH) + + // because enlarging the feed changes the scroll position (minus), we cannot use this directly for headerLarge + // as during slow-scrolling the statement could (depending on platform) jump in-out of being true + // why we rely here on a more static ref value + if (scrollPositionISH > minScrollRequiredISH) { + staticScrollbarOffset.current = 1 + } else if (scrollPosition < 50) { + staticScrollbarOffset.current = 0 + } + + setHeaderLarge(!isFeedSizeEnough || staticScrollbarOffset.current < 1) }, [scrollData, setHeaderLarge], ) From 742f4f6d40e0ae9f1e5cb3c7f5c034dbe916e19c Mon Sep 17 00:00:00 2001 From: LewisB Date: Thu, 16 Nov 2023 10:50:37 +0700 Subject: [PATCH 07/17] fix: don't show toTop when scrolling is active --- src/components/dashboard/FeedList.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/dashboard/FeedList.js b/src/components/dashboard/FeedList.js index b79f226878..363fcfd648 100644 --- a/src/components/dashboard/FeedList.js +++ b/src/components/dashboard/FeedList.js @@ -60,6 +60,7 @@ const FeedList = ({ listHeaderComponent, listFooterComponent, headerLarge, + isScrolling, windowSize, }: FeedListProps) => { const { showErrorDialog } = useDialog() @@ -70,14 +71,10 @@ const FeedList = ({ const goodWallet = useWallet() const userStorage = useUserStorage() const feeds = useFeeds(data) + const [showButton, setShowButton] = useState(true) const handleItemSelection = handleFeedSelection - // shouldnt be required with latest react-native-web - // const onScrollStart = useCallback(() => setAbleItemSelection(false), [setAbleItemSelection]) - - // const onScrollEnd = useCallback(() => setAbleItemSelection(true), [setAbleItemSelection]) - const scrollToTop = useCallback(() => { const list = get(flRef, 'current._flatListRef', {}) @@ -86,6 +83,13 @@ const FeedList = ({ } }, []) + const handleHideButton = useCallback(() => { + setShowButton(false) + }) + + const handleShowButton = useCallback(() => { + setShowButton(true) + }) const renderItemComponent = useCallback( ({ item, index }) => , [handleItemSelection], @@ -229,18 +233,19 @@ const FeedList = ({ numColumns={1} onEndReached={onEndReached} onEndReachedThreshold={onEndReachedThreshold} - onMomentumScrollEnd={_onScrollEnd} + onMomentumScrollEnd={_onScrollEnd && handleShowButton} refreshing={false} renderItem={renderItemComponent} ListHeaderComponent={listHeaderComponent} ListFooterComponent={listFooterComponent} renderQuickActions={renderQuickActions} viewabilityConfig={VIEWABILITY_CONFIG} + onScrollBeginDrag={handleHideButton} onScroll={onScroll} ref={flRef} windowSize={windowSize} /> - + {showButton && } ) : null } From 36e92f9ad1df9af9f3b18129920ba4867301dd36 Mon Sep 17 00:00:00 2001 From: LewisB Date: Thu, 16 Nov 2023 10:52:21 +0700 Subject: [PATCH 08/17] fix: remove unused prop --- src/components/dashboard/FeedList.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/dashboard/FeedList.js b/src/components/dashboard/FeedList.js index 363fcfd648..ca0f2f666e 100644 --- a/src/components/dashboard/FeedList.js +++ b/src/components/dashboard/FeedList.js @@ -60,7 +60,6 @@ const FeedList = ({ listHeaderComponent, listFooterComponent, headerLarge, - isScrolling, windowSize, }: FeedListProps) => { const { showErrorDialog } = useDialog() From fbd9f49920a1a4e590a560027b561e75b970bbf3 Mon Sep 17 00:00:00 2001 From: LewisB Date: Thu, 16 Nov 2023 20:28:27 +0700 Subject: [PATCH 09/17] fix: onMomentum callback --- src/components/dashboard/FeedList.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/dashboard/FeedList.js b/src/components/dashboard/FeedList.js index ca0f2f666e..b4054103c6 100644 --- a/src/components/dashboard/FeedList.js +++ b/src/components/dashboard/FeedList.js @@ -214,6 +214,11 @@ const FeedList = ({ } }, [setShowBounce, userStorage]) + const handleMomentum = useCallback((event: any) => { + _onScrollEnd(event) + handleShowButton() + }) + return displayContent ? ( <> Date: Thu, 16 Nov 2023 22:16:08 +0700 Subject: [PATCH 10/17] remove unneccesary callbacks --- src/components/dashboard/FeedList.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/dashboard/FeedList.js b/src/components/dashboard/FeedList.js index b4054103c6..22ccf5fe23 100644 --- a/src/components/dashboard/FeedList.js +++ b/src/components/dashboard/FeedList.js @@ -82,13 +82,9 @@ const FeedList = ({ } }, []) - const handleHideButton = useCallback(() => { - setShowButton(false) - }) + const handleHideButton = () => setShowButton(false) - const handleShowButton = useCallback(() => { - setShowButton(true) - }) + const handleShowButton = () => setShowButton(true) const renderItemComponent = useCallback( ({ item, index }) => , [handleItemSelection], From 11d9ce75ec7c512631ca2466d78155036bd47857 Mon Sep 17 00:00:00 2001 From: LewisB Date: Thu, 16 Nov 2023 22:36:00 +0700 Subject: [PATCH 11/17] fix: snapshot --- .../dashboard/__tests__/__snapshots__/FeedModalList.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dashboard/__tests__/__snapshots__/FeedModalList.js.snap b/src/components/dashboard/__tests__/__snapshots__/FeedModalList.js.snap index d5b6a02935..7b0e9f51a5 100644 --- a/src/components/dashboard/__tests__/__snapshots__/FeedModalList.js.snap +++ b/src/components/dashboard/__tests__/__snapshots__/FeedModalList.js.snap @@ -268,7 +268,7 @@ Array [
Date: Thu, 16 Nov 2023 21:20:09 +0200 Subject: [PATCH 12/17] Update src/components/dashboard/Dashboard.js --- src/components/dashboard/Dashboard.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/components/dashboard/Dashboard.js b/src/components/dashboard/Dashboard.js index 24d22b958e..913a790cce 100644 --- a/src/components/dashboard/Dashboard.js +++ b/src/components/dashboard/Dashboard.js @@ -827,16 +827,7 @@ const Dashboard = props => { const { minScrollRequiredISH, scrollPositionGap, isFeedSizeEnough } = scrollData const scrollPositionISH = scrollPosition + scrollPositionGap - // because enlarging the feed changes the scroll position (minus), we cannot use this directly for headerLarge - // as during slow-scrolling the statement could (depending on platform) jump in-out of being true - // why we rely here on a more static ref value - if (scrollPositionISH > minScrollRequiredISH) { - staticScrollbarOffset.current = 1 - } else if (scrollPosition < 50) { - staticScrollbarOffset.current = 0 - } - - setHeaderLarge(!isFeedSizeEnough || staticScrollbarOffset.current < 1) + setHeaderLarge(!isFeedSizeEnough || scrollPositionISH > minScrollRequiredISH) }, [scrollData, setHeaderLarge], ) From 9726478ccd97ff347c3e33f18a4684fc051668a2 Mon Sep 17 00:00:00 2001 From: johnsmith-gooddollar <89783679+johnsmith-gooddollar@users.noreply.github.com> Date: Thu, 16 Nov 2023 21:21:40 +0200 Subject: [PATCH 13/17] Update src/components/dashboard/Dashboard.js --- src/components/dashboard/Dashboard.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/dashboard/Dashboard.js b/src/components/dashboard/Dashboard.js index 913a790cce..754388aa04 100644 --- a/src/components/dashboard/Dashboard.js +++ b/src/components/dashboard/Dashboard.js @@ -313,7 +313,6 @@ const Dashboard = props => { const [activeTab, setActiveTab] = useState(FeedCategories.All) const [getCurrentTab] = usePropsRefs([activeTab]) const { onGiveUp } = useGiveUpDialog(navigation, 'cancelled') - const staticScrollbarOffset = useRef(0) const { currentNetwork } = useSwitchNetwork() From cd0a9001c4b3faca20a872be515b8b6229caed78 Mon Sep 17 00:00:00 2001 From: LewisB Date: Fri, 17 Nov 2023 18:55:01 +0700 Subject: [PATCH 14/17] fix: on android app, only determine scrollposition at scrollEnd --- src/components/dashboard/Dashboard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/dashboard/Dashboard.js b/src/components/dashboard/Dashboard.js index 4e0506b3cc..ca4e1df714 100644 --- a/src/components/dashboard/Dashboard.js +++ b/src/components/dashboard/Dashboard.js @@ -825,7 +825,7 @@ const Dashboard = props => { const { minScrollRequiredISH, scrollPositionGap, isFeedSizeEnough } = scrollData const scrollPositionISH = scrollPosition + scrollPositionGap - setHeaderLarge(!isFeedSizeEnough || scrollPositionISH > minScrollRequiredISH) + setHeaderLarge(!isFeedSizeEnough || scrollPositionISH < minScrollRequiredISH) }, [scrollData, setHeaderLarge], ) @@ -833,7 +833,7 @@ const Dashboard = props => { const handleScroll = useCallback( ({ ...args }) => { dispatchScrollEvent() - handleScrollEnd(args) + Platform.OS === 'web' && handleScrollEnd(args) }, [dispatchScrollEvent, handleScrollEnd], ) From a20b2ceab7ba948b6b20e936746452d302c05272 Mon Sep 17 00:00:00 2001 From: LewisB Date: Fri, 17 Nov 2023 19:23:41 +0700 Subject: [PATCH 15/17] fix: claim snap --- .../dashboard/__tests__/__snapshots__/Claim.js.snap | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap b/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap index 828bfaccea..ffbfe089dd 100644 --- a/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap +++ b/src/components/dashboard/__tests__/__snapshots__/Claim.js.snap @@ -323,6 +323,12 @@ More G$'s Coming Soon
+
+ - +
+
+ - +
Date: Sat, 18 Nov 2023 19:43:24 +0200 Subject: [PATCH 16/17] adjust code --- src/components/dashboard/Dashboard.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/dashboard/Dashboard.js b/src/components/dashboard/Dashboard.js index ca4e1df714..59c1f617f8 100644 --- a/src/components/dashboard/Dashboard.js +++ b/src/components/dashboard/Dashboard.js @@ -29,7 +29,7 @@ import { createStackNavigator } from '../appNavigation/stackNavigation' import useAppState from '../../lib/hooks/useAppState' import useGoodDollarPrice from '../reserve/useGoodDollarPrice' import { PushButton } from '../appNavigation/PushButton' -import { useNativeDriverForAnimation } from '../../lib/utils/platform' +import { isWeb, useNativeDriverForAnimation } from '../../lib/utils/platform' import TabsView from '../appNavigation/TabsView' import BigGoodDollar from '../common/view/BigGoodDollar' import ClaimButton from '../common/buttons/ClaimButton' @@ -833,7 +833,10 @@ const Dashboard = props => { const handleScroll = useCallback( ({ ...args }) => { dispatchScrollEvent() - Platform.OS === 'web' && handleScrollEnd(args) + + if (isWeb) { + handleScrollEnd(args) + } }, [dispatchScrollEvent, handleScrollEnd], ) From e6684a864c6f085a8db2edd2fd892a6b29d1df31 Mon Sep 17 00:00:00 2001 From: LewisB Date: Mon, 20 Nov 2023 22:21:57 +0700 Subject: [PATCH 17/17] fix: remove old yarnrc conf file --- .yarnrc | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .yarnrc diff --git a/.yarnrc b/.yarnrc deleted file mode 100644 index b6c6e9f2e9..0000000000 --- a/.yarnrc +++ /dev/null @@ -1,5 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -yarn-path ".yarn/releases/yarn-3.5.1.cjs"