Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor BalanceCoinRow into FastBalanceCoinRow and FastCoinIcon #3313

Merged
merged 75 commits into from Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
044a9e2
Add WIP FastBalanceCoinRow
terrysahaidak May 9, 2022
5a57e58
Ditch the useAccountSettings hook from useAccountAsset
terrysahaidak May 9, 2022
3715a8e
WIP Editing assets
terrysahaidak May 9, 2022
05732e7
Do not run includes when it's not needed
terrysahaidak May 9, 2022
902f9c6
Fix unnecesarry rerenders when editing assets
terrysahaidak May 10, 2022
a58e9f5
Fix useAccountAsset
terrysahaidak May 10, 2022
5d335af
Fast icons for rows (#3316)
osdnk May 10, 2022
931a5e9
Simplify fallback icon
terrysahaidak May 10, 2022
455a8ea
Fix CoinChainBadge
terrysahaidak May 10, 2022
c3dce23
Fix styles
terrysahaidak May 10, 2022
4b7e3cd
Fix pin/hide icons
terrysahaidak May 10, 2022
dcb194b
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak May 13, 2022
22cebb8
Make fast coin icon faster
terrysahaidak May 13, 2022
04e3c38
Remove unnecessary context
terrysahaidak May 15, 2022
b8946ec
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak May 16, 2022
ab0ebb0
Better icon
osdnk May 16, 2022
97af3de
Make ButtonPressAnimation on android tiny bit faster
terrysahaidak May 16, 2022
69180b3
Use @rainbow-me import for assets
terrysahaidak May 16, 2022
7a97f85
Don't use math when it's not needed :D
terrysahaidak May 16, 2022
fca4811
Improve typings of FastCoinBadge
terrysahaidak May 16, 2022
0c297aa
Merge branch '@terrysahaidak/fast-balance-coin-row' of https://github…
terrysahaidak May 16, 2022
622cc09
Fix linting issues
terrysahaidak May 16, 2022
4f12ace
type
osdnk May 17, 2022
4c93242
use object with pinned coins and hidden coins (#3345)
osdnk May 17, 2022
8318e3c
Migration v16
osdnk May 17, 2022
ee76c40
fix addHiddenCoins
osdnk May 17, 2022
c2e9586
Add cache to pseudoRandomArrayItemFromString
terrysahaidak May 17, 2022
6259fa9
assetType is optional
terrysahaidak May 17, 2022
5a3e79b
Do not flicker the coin icon image; cache availability
terrysahaidak May 17, 2022
d9de929
Add shadow back
terrysahaidak May 17, 2022
88f5418
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak May 18, 2022
308cf99
Make linter happy
terrysahaidak May 18, 2022
bed39b3
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak May 19, 2022
35c5439
Fix edit button
terrysahaidak May 19, 2022
3be86a6
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak May 20, 2022
dcd7127
Do not rebuils unnecesarry wallet sections
terrysahaidak May 23, 2022
184f7be
Update codeowners
terrysahaidak May 23, 2022
076d180
Remove magic memo and fix update based on props
terrysahaidak May 26, 2022
a6b116c
Improve dependency debugger
terrysahaidak May 26, 2022
80ad782
Remove unnecesarry stagger of small balances
terrysahaidak May 26, 2022
e4ad7ea
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak May 26, 2022
ba0400a
Merge branch '@terrysahaidak/fix-unnecessary-wallet-sections-creation…
terrysahaidak May 26, 2022
4ae584d
Fix merge conflicts
terrysahaidak May 27, 2022
ba799ea
Update src/components/asset-list/RecyclerAssetList2/FastComponents/Fa…
terrysahaidak May 27, 2022
a17f6ff
Update src/components/asset-list/RecyclerAssetList2/FastComponents/Fa…
terrysahaidak May 27, 2022
e466d89
Update src/components/asset-list/RecyclerAssetList2/FastComponents/Fa…
terrysahaidak May 27, 2022
93fc8f6
Remove unused import
terrysahaidak May 27, 2022
8b92467
Merge branch 'develop' into @terrysahaidak/fast-balance-coin-row
osdnk May 27, 2022
2c60b35
Random fixes
terrysahaidak May 27, 2022
9c1fa51
Merge branch '@terrysahaidak/fast-balance-coin-row' of https://github…
terrysahaidak May 27, 2022
380ce43
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak Jun 6, 2022
bf7e450
Update stuff according to profiles stuff
terrysahaidak Jun 6, 2022
9417548
Address reviews
terrysahaidak Jun 6, 2022
2b00268
revert fast-image patch
terrysahaidak Jun 7, 2022
b8ee401
Fix typings
terrysahaidak Jun 7, 2022
d40e1bd
Use Image for static coin badge icons
terrysahaidak Jun 7, 2022
322fee7
More fixes
terrysahaidak Jun 7, 2022
4763506
More review feedback
terrysahaidak Jun 7, 2022
d6f5165
fix useCollectible
terrysahaidak Jun 7, 2022
0f968da
remove type annotation in useCollectible
terrysahaidak Jun 7, 2022
996443a
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak Jun 7, 2022
1798c57
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak Jun 8, 2022
d055486
Fix broken selec unique token sheet
terrysahaidak Jun 8, 2022
bea48fd
Fix selecting NFTs
terrysahaidak Jun 8, 2022
d535fc4
Fix passing type to raw recycling view
terrysahaidak Jun 8, 2022
1e7ba12
Improve layout based on previous version
terrysahaidak Jun 9, 2022
daddb29
Improve edit mode layout
terrysahaidak Jun 9, 2022
346e1df
Fix fast-image patch
terrysahaidak Jun 15, 2022
dc8b19c
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak Jun 15, 2022
281d715
Fix the badge
terrysahaidak Jun 15, 2022
33d2af8
Fix edit mode
terrysahaidak Jun 15, 2022
b3c64c8
Improve more
terrysahaidak Jun 15, 2022
a32f3a9
Refactor FastCoinIcon
terrysahaidak Jun 15, 2022
2511ce4
Merge remote-tracking branch 'origin/develop' into @terrysahaidak/fas…
terrysahaidak Jun 16, 2022
0613972
Fix edit options actions
terrysahaidak Jun 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions patches/react-native-fast-image+8.5.11.patch
Expand Up @@ -10,6 +10,32 @@ index db0fada..54d8d5b 100644
+ s.dependency 'SDWebImage', '~> 5.12.5'
s.dependency 'SDWebImageWebPCoder', '~> 0.8.4'
end
diff --git a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java
index 361417b..f167e91 100644
--- a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java
+++ b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java
@@ -40,7 +40,20 @@ public class FastImageRequestListener implements RequestListener<Drawable> {
ThemedReactContext context = (ThemedReactContext) view.getContext();
RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
int viewId = view.getId();
- eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
+ WritableMap error = new WritableNativeMap();
+
+ String message = "Error";
+
+ if (e != null) {
+ Throwable throwable = e.getRootCauses().get(0);
+ if (throwable != null) {
+ message = throwable.getMessage();
+ }
+
+ }
+
+ error.putString("message", message);
+ eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, error);
eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
return false;
}
diff --git a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageSource.java b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageSource.java
index 888b38e..e73737d 100644
--- a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageSource.java
Expand Down
@@ -1,5 +1,10 @@
import React, { createContext, useCallback, useContext, useMemo } from 'react';
import { processColor, requireNativeComponent, View } from 'react-native';
import {
processColor,
requireNativeComponent,
StyleSheet,
View,
} from 'react-native';
import { createNativeWrapper } from 'react-native-gesture-handler';
import { PureNativeButton } from 'react-native-gesture-handler/src/components/GestureButtons';
import Animated, {
Expand All @@ -13,7 +18,6 @@ import Animated, {
} from 'react-native-reanimated';
import { normalizeTransformOrigin } from './NativeButton';
import { useLongPressEvents } from '@rainbow-me/hooks';
import styled from '@rainbow-me/styled-components';

const ZoomableRawButton = requireNativeComponent('RNZoomableButton');

Expand All @@ -31,9 +35,7 @@ const OVERFLOW_MARGIN = 5;

const ScaleButtonContext = createContext(null);

const Content = styled.View({
overflow: 'visible',
});
const transparentColor = processColor('transparent');

// I managed to implement partially overflow in scale button (up to 5px),
// but overflow is not visible beyond small boundaries. Hence, to make it reactive to touches
Expand Down Expand Up @@ -136,15 +138,15 @@ const ScaleButton = ({
});

return (
<View style={[{ overflow: 'visible' }, wrapperStyle]}>
<View style={[cx.overflow, wrapperStyle]}>
<View style={{ margin: -overflowMargin }}>
<AnimatedRawButton
hitSlop={-overflowMargin}
onGestureEvent={gestureHandler}
rippleColor={processColor('transparent')}
style={{ overflow: 'visible' }}
rippleColor={transparentColor}
style={cx.overflow}
>
<View style={{ backgroundColor: 'transparent' }}>
<View style={cx.transparentBackground}>
<View style={{ padding: overflowMargin }}>
<Animated.View style={[sz, contentContainerStyle]}>
{children}
Expand Down Expand Up @@ -189,6 +191,10 @@ const SimpleScaleButton = ({
[onLongPress, onLongPressEnded, onPress, shouldLongPressHoldPress]
);

// we won't guess if there are any animated styles in there but we can
// not render the Animated.View if we don't use that prop at all
const Wrapper = contentContainerStyle ? Animated.View : View;

return (
<View
onLayout={onLayout}
Expand All @@ -213,22 +219,20 @@ const SimpleScaleButton = ({
isLongPress={isLongPress}
minLongPressDuration={minLongPressDuration}
onPress={onNativePress}
rippleColor={processColor('transparent')}
rippleColor={transparentColor}
scaleTo={scaleTo}
shouldLongPressHoldPress={shouldLongPressHoldPress}
style={{ overflow: 'visible' }}
style={cx.overflow}
transformOrigin={transformOrigin}
>
<View style={{ backgroundColor: 'transparent' }}>
<View style={cx.transparentBackground}>
<View
style={{
padding: overflowMargin,
paddingTop: skipTopMargin ? OVERFLOW_MARGIN : overflowMargin,
}}
>
<Animated.View style={contentContainerStyle}>
{children}
</Animated.View>
<Wrapper style={contentContainerStyle}>{children}</Wrapper>
</View>
</View>
</ZoomableButton>
Expand Down Expand Up @@ -271,9 +275,9 @@ export default function ButtonPressAnimation({

const ButtonElement = reanimatedButton ? ScaleButton : SimpleScaleButton;
return disabled ? (
<Content onLayout={onLayout} style={style}>
<View onLayout={onLayout} style={[cx.overflow, style]}>
{children}
</Content>
</View>
) : (
<ButtonElement
backgroundColor={backgroundColor}
Expand All @@ -297,9 +301,18 @@ export default function ButtonPressAnimation({
transformOrigin={normalizedTransformOrigin}
wrapperStyle={wrapperStyle}
>
<Content pointerEvents="box-only" style={style}>
<View pointerEvents="box-only" style={[cx.overflow, style]}>
{children}
</Content>
</View>
</ButtonElement>
);
}

const cx = StyleSheet.create({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use a different name than cx? I have a hard time knowing what is it about. I think I already changed something about the sz in animated styles in another component

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cx is actually a really popular name for such things if you've ever used css-modules in react.

import classnames from 'classnames/bind'
import s from './styles.module.css'

const cx = classnames.bind(s);

but yeah I'll consider something else.

Copy link
Contributor

@osdnk osdnk May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think cx is ok

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is some kind of react convention, then great I didn't know that

overflow: {
overflow: 'visible',
},
transparentBackground: {
backgroundColor: 'transparent',
},
});
11 changes: 3 additions & 8 deletions src/components/asset-list/AssetList.js
@@ -1,7 +1,6 @@
import lang from 'i18n-js';
import React from 'react';
import { useSafeArea } from 'react-native-safe-area-context';
import { magicMemo } from '../../utils';
import { FabWrapperBottomPosition, FloatingActionButtonSize } from '../fab';
import { ListFooter } from '../list';
import EmptyAssetList from './EmptyAssetList';
Expand All @@ -19,6 +18,7 @@ const AssetList = ({
network,
scrollViewTracker,
sections,
walletBriefSectionsData,
...props
}) => {
const insets = useSafeArea();
Expand All @@ -43,13 +43,8 @@ const AssetList = ({
{...props}
/>
) : (
<RecyclerAssetList2 />
<RecyclerAssetList2 walletBriefSectionsData={walletBriefSectionsData} />
);
};

export default magicMemo(AssetList, [
'isEmpty',
'isLoading',
'isWalletEthZero',
'sections',
]);
export default React.memo(AssetList);
16 changes: 14 additions & 2 deletions src/components/asset-list/RecyclerAssetList/index.tsx
Expand Up @@ -243,7 +243,7 @@ function RecyclerAssetList({
disableRefreshControl,
...extras
}: RecyclerAssetListProps): JSX.Element {
const { isCoinListEdited } = useCoinListEdited();
const { isCoinListEdited, setIsCoinListEdited } = useCoinListEdited();
const {
isInvestmentCardsOpen: openInvestmentCards,
} = useOpenInvestmentCards();
Expand Down Expand Up @@ -774,6 +774,14 @@ function RecyclerAssetList({

const isInsideBottomSheet = !!useContext(BottomSheetContext);

const coinDividerExtendedState = useMemo(
() => ({
isCoinListEdited,
setIsCoinListEdited,
}),
[isCoinListEdited, setIsCoinListEdited]
);

return (
<StyledContainer onLayout={onLayout}>
{/* @ts-ignore */}
Expand Down Expand Up @@ -815,7 +823,11 @@ function RecyclerAssetList({
},
]}
>
<CoinDivider balancesSum={0} defaultToEditButton={false} />
<CoinDivider
balancesSum={0}
defaultToEditButton={false}
extendedState={coinDividerExtendedState}
/>
</View>
</StyledContainer>
);
Expand Down