11import { memo , useState , useCallback } from 'react' ;
2- import { RefreshControl , ScrollView , StyleSheet } from 'react-native' ;
2+ import { RefreshControl , StyleSheet } from 'react-native' ;
33import { Box , useColorMode } from '@/design-system' ;
44import { AccountImage } from '@/components/AccountImage' ;
5- import { Navbar } from '@/components/navbar/Navbar' ;
5+ import { Navbar , navbarHeight } from '@/components/navbar/Navbar' ;
66import { RnbwRewardsClaimCard } from './components/RnbwRewardsClaimCard' ;
77import { RnbwAirdropClaimCard } from './components/RnbwAirdropClaimCard' ;
88import { RnbwUnstakePenaltyRecoveryCard } from './components/RnbwUnstakePenaltyRecoveryCard' ;
@@ -17,35 +17,49 @@ import { RnbwStakingEarningsCard } from './components/RnbwStakingEarningsCard';
1717import { TAB_BAR_HEIGHT } from '@/navigation/SwipeNavigator' ;
1818import { TierBadge } from '@/features/rnbw-membership/components/TierBadge' ;
1919import { 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
2128export 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
6788function CurrentTierBadge ( ) {
0 commit comments