1
1
import type { FC } from "react" ;
2
2
import { useContext , useState } from "react" ;
3
3
import { Dimensions , StyleSheet } from "react-native" ;
4
- import Animated , { Extrapolate , interpolate , useAnimatedStyle } from "react-native-reanimated" ;
4
+ import Animated , { Extrapolation , interpolate , useAnimatedStyle } from "react-native-reanimated" ;
5
5
import { useSafeAreaInsets } from "react-native-safe-area-context" ;
6
6
7
7
import type { NativeStackScreenProps } from "@react-navigation/native-stack" ;
@@ -10,7 +10,7 @@ import { LinearGradient } from "expo-linear-gradient";
10
10
import { Stack } from "tamagui" ;
11
11
12
12
import { MasonryFeedList } from "@/components/FeedList" ;
13
- import { GlobalStateContext } from "@/context/global-state-context" ;
13
+ import { GlobalStateContext , useGlobalState } from "@/context/global-state-context" ;
14
14
import { useColors } from "@/hooks/use-colors" ;
15
15
import type { HomeBottomTabsParamList } from "@/navigation/types" ;
16
16
@@ -25,8 +25,6 @@ export interface Props {
25
25
isShorts ?: boolean
26
26
}
27
27
28
- const { height } = Dimensions . get ( "window" ) ;
29
-
30
28
export const FeedListLinearGradientBackground : FC = ( ) => {
31
29
const { pick } = useColors ( ) ;
32
30
return (
@@ -47,32 +45,34 @@ export const FeedPage: FC<NativeStackScreenProps<HomeBottomTabsParamList, "Feed"
47
45
const [ daysInterval , setDaysInterval ] = useState < number > ( 7 ) ;
48
46
const { isExpandedAnimValue, onScroll } = useContext ( GlobalStateContext ) . homeFeed ;
49
47
const { top } = useSafeAreaInsets ( ) ;
48
+ const { dimensions : { height } } = useGlobalState ( ) ;
50
49
51
50
const containerAnimStyles = useAnimatedStyle ( ( ) => {
52
51
const headerHeight = interpolate (
53
52
isExpandedAnimValue . value ,
54
53
[ 0 , 1 ] ,
55
54
[ 0 , homeTabHeaderHeight + top ] ,
56
- Extrapolate . CLAMP ,
57
- ) + extraGapBetweenIOSAndAndroid ;
55
+ Extrapolation . CLAMP ,
56
+ ) ;
58
57
59
58
return {
60
59
height : height - headerHeight ,
61
60
} ;
62
- } , [ top , isExpandedAnimValue ] ) ;
61
+ } , [ top , isExpandedAnimValue , height ] ) ;
63
62
64
63
const innerMaskContainerAnimStyles = useAnimatedStyle ( ( ) => {
65
64
const paddingTop = interpolate (
66
65
isExpandedAnimValue . value ,
67
66
[ 0 , 1 ] ,
68
67
[ 0 , top ] ,
69
- Extrapolate . CLAMP ,
70
- ) + extraGapBetweenIOSAndAndroid ;
68
+ Extrapolation . CLAMP ,
69
+ ) ;
71
70
72
71
return {
73
72
paddingTop,
73
+ height,
74
74
} ;
75
- } , [ top , isExpandedAnimValue ] ) ;
75
+ } , [ top , isExpandedAnimValue , height ] ) ;
76
76
77
77
return (
78
78
< Stack flex = { 1 } >
@@ -115,7 +115,6 @@ const styles = StyleSheet.create({
115
115
} ,
116
116
innerMaskContainer : {
117
117
width : "100%" ,
118
- height,
119
118
position : "absolute" ,
120
119
bottom : 0 ,
121
120
} ,
0 commit comments