1
1
import React , { memo , useEffect , useCallback , useMemo } from 'react' ;
2
- import { type LayoutChangeEvent , StyleSheet } from 'react-native' ;
2
+ import {
3
+ type LayoutChangeEvent ,
4
+ StyleSheet ,
5
+ type ViewStyle ,
6
+ } from 'react-native' ;
3
7
import Animated , { useAnimatedStyle } from 'react-native-reanimated' ;
4
8
import { SCROLLABLE_TYPE } from '../../constants' ;
5
9
import { useBottomSheetInternal } from '../../hooks' ;
@@ -25,21 +29,22 @@ function BottomSheetViewComponent({
25
29
//#endregion
26
30
27
31
//#region styles
28
- const flattenStyle = useMemo ( ( ) => StyleSheet . flatten ( style ) , [ style ] ) ;
32
+ const flattenStyle = useMemo < ViewStyle | undefined > (
33
+ ( ) => StyleSheet . flatten ( style ) ,
34
+ [ style ]
35
+ ) ;
29
36
const containerStyle = useAnimatedStyle ( ( ) => {
30
37
if ( ! enableFooterMarginAdjustment ) {
31
- return flattenStyle ;
38
+ return flattenStyle ?? { } ;
32
39
}
33
40
34
41
const marginBottom =
35
- typeof flattenStyle . marginBottom === 'number'
42
+ typeof flattenStyle ? .marginBottom === 'number'
36
43
? flattenStyle . marginBottom
37
44
: 0 ;
38
45
39
- // console.log(paddingBottom, animatedFooterHeight.value);
40
-
41
46
return {
42
- ...flattenStyle ,
47
+ ...( flattenStyle ?? { } ) ,
43
48
marginBottom : marginBottom + animatedFooterHeight . value ,
44
49
} ;
45
50
} , [ flattenStyle , enableFooterMarginAdjustment , animatedFooterHeight ] ) ;
0 commit comments