Skip to content

Commit 6c59bde

Browse files
committed
fix: misc Android fixes
1 parent 7c702c6 commit 6c59bde

File tree

4 files changed

+43
-20
lines changed

4 files changed

+43
-20
lines changed

src/components/gradient-border/GradientBorderView.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,11 @@ export const GradientBorderView = memo(function GradientBorderView({
4949

5050
return (
5151
<View style={[styles.baseStyle, style, { backgroundColor }, radiusStyle]}>
52-
<MaskedView
53-
maskElement={<View style={[styles.maskElement, { borderWidth }, radiusStyle]} />}
54-
style={styles.maskView}
55-
pointerEvents="none"
56-
>
57-
<LinearGradient start={start} end={end} style={StyleSheet.absoluteFill} colors={borderGradientColors} locations={locations} />
58-
</MaskedView>
52+
<View style={styles.maskView} pointerEvents="none">
53+
<MaskedView maskElement={<View style={[styles.maskElement, { borderWidth }, radiusStyle]} />} style={StyleSheet.absoluteFill}>
54+
<LinearGradient start={start} end={end} style={StyleSheet.absoluteFill} colors={borderGradientColors} locations={locations} />
55+
</MaskedView>
56+
</View>
5957
{children}
6058
</View>
6159
);

src/features/rnbw-membership/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,8 @@ export const FALLBACK_TIERS: Tier[] = [
226226
cashbackBps: 10000,
227227
},
228228
];
229+
230+
export const MEMBERSHIP_SCREEN_BACKGROUND_COLOR = {
231+
light: '#F5F5F7',
232+
dark: '#090909',
233+
};

src/features/rnbw-membership/screens/rnbw-membership-screen/RnbwMembershipScreen.tsx

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { memo, useState, useCallback } from 'react';
2-
import { RefreshControl, ScrollView, StyleSheet } from 'react-native';
2+
import { RefreshControl, StyleSheet } from 'react-native';
33
import { Box, useColorMode } from '@/design-system';
44
import { AccountImage } from '@/components/AccountImage';
5-
import { Navbar } from '@/components/navbar/Navbar';
5+
import { Navbar, navbarHeight } from '@/components/navbar/Navbar';
66
import { RnbwRewardsClaimCard } from './components/RnbwRewardsClaimCard';
77
import { RnbwAirdropClaimCard } from './components/RnbwAirdropClaimCard';
88
import { RnbwUnstakePenaltyRecoveryCard } from './components/RnbwUnstakePenaltyRecoveryCard';
@@ -17,35 +17,49 @@ import { RnbwStakingEarningsCard } from './components/RnbwStakingEarningsCard';
1717
import { TAB_BAR_HEIGHT } from '@/navigation/SwipeNavigator';
1818
import { TierBadge } from '@/features/rnbw-membership/components/TierBadge';
1919
import { useMembershipTierInfo } from '@/features/rnbw-membership/stores/derived/useMembershipTierInfo';
20+
import { IS_ANDROID } from '@/env';
21+
import { ScrollHeaderFade } from '@/components/scroll-header-fade/ScrollHeaderFade';
22+
import { useScrollFadeHandler } from '@/components/scroll-header-fade/useScrollFadeHandler';
23+
import Animated, { useSharedValue } from 'react-native-reanimated';
24+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
25+
import { getValueForColorMode } from '@/design-system/color/palettes';
26+
import { MEMBERSHIP_SCREEN_BACKGROUND_COLOR } from '@/features/rnbw-membership/constants';
2027

2128
export const RnbwMembershipScreen = memo(function RnbwMembershipScreen() {
22-
const { isDarkMode } = useColorMode();
29+
const { colorMode } = useColorMode();
30+
const safeAreaInsets = useSafeAreaInsets();
31+
const backgroundColor = getValueForColorMode(MEMBERSHIP_SCREEN_BACKGROUND_COLOR, colorMode);
32+
const scrollOffset = useSharedValue(0);
33+
const onScroll = useScrollFadeHandler(scrollOffset);
34+
const bottomInset = TAB_BAR_HEIGHT + 16;
2335

2436
return (
25-
<Box backgroundColor={isDarkMode ? '#090909' : '#F5F5F7'} style={styles.flex}>
37+
<Box backgroundColor={backgroundColor} style={styles.flex}>
2638
<Navbar hasStatusBarInset titleComponent={<CurrentTierBadge />} leftComponent={<AccountImage />} />
27-
<ScrollView
39+
<ScrollHeaderFade color={backgroundColor} height={32} scrollOffset={scrollOffset} topInset={safeAreaInsets.top + navbarHeight} />
40+
<Animated.ScrollView
2841
refreshControl={<RefreshControlWrapper />}
29-
contentContainerStyle={styles.scrollViewContentContainer}
42+
contentContainerStyle={[styles.scrollViewContentContainer, { paddingBottom: IS_ANDROID ? bottomInset : 0 }]}
3043
style={styles.flex}
44+
onScroll={onScroll}
3145
contentInset={{
32-
bottom: TAB_BAR_HEIGHT + 16,
46+
bottom: bottomInset,
3347
}}
3448
>
35-
<Box gap={16} style={{ flex: 1 }}>
49+
<Box gap={16}>
3650
<RnbwStakingCard />
3751
<RnbwStakingEarningsCard />
3852
<RnbwUnstakePenaltyRecoveryCard />
3953
<MembershipTierCard />
4054
<RnbwRewardsClaimCard />
4155
<RnbwAirdropClaimCard />
4256
</Box>
43-
</ScrollView>
57+
</Animated.ScrollView>
4458
</Box>
4559
);
4660
});
4761

48-
function RefreshControlWrapper() {
62+
function RefreshControlWrapper(props: Omit<React.ComponentProps<typeof RefreshControl>, 'refreshing' | 'onRefresh'>) {
4963
const [isRefreshing, setIsRefreshing] = useState(false);
5064

5165
const handleRefresh = useCallback(async () => {
@@ -61,7 +75,14 @@ function RefreshControlWrapper() {
6175
setIsRefreshing(false);
6276
}, []);
6377

64-
return <RefreshControl refreshing={isRefreshing} onRefresh={handleRefresh} />;
78+
return (
79+
<RefreshControl
80+
// eslint-disable-next-line react/jsx-props-no-spreading
81+
{...props}
82+
refreshing={isRefreshing}
83+
onRefresh={handleRefresh}
84+
/>
85+
);
6586
}
6687

6788
function CurrentTierBadge() {

src/features/rnbw-staking/screens/rnbw-staking-learn-screen/RnbwStakingLearnScreen.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const RnbwStakingLearnScreen = memo(function RnbwStakingLearnScreen() {
3636
/>
3737
<SheetHandleFixedToTop top={safeAreaTop + 6} />
3838
<View style={[styles.content, { marginTop: safeAreaTop + 40, paddingBottom: safeAreaBottom + 8 }]}>
39-
<Box gap={64}>
39+
<Box gap={64} flexGrow={1}>
4040
<Box alignItems="center" gap={24}>
4141
<Text align="center" size="17pt" weight="heavy" color={{ custom: '#D7A921' }}>
4242
{'INTRODUCING'}
@@ -159,7 +159,6 @@ const styles = StyleSheet.create({
159159
width: '100%',
160160
},
161161
button: {
162-
marginTop: 'auto',
163162
width: '100%',
164163
},
165164
container: {

0 commit comments

Comments
 (0)