Skip to content

Commit 4c8ae25

Browse files
committed
fix(#1987): updated provided style handling for bottom sheet view
1 parent d1c74c5 commit 4c8ae25

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/components/bottomSheetView/BottomSheetView.tsx

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
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';
37
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
48
import { SCROLLABLE_TYPE } from '../../constants';
59
import { useBottomSheetInternal } from '../../hooks';
@@ -25,21 +29,22 @@ function BottomSheetViewComponent({
2529
//#endregion
2630

2731
//#region styles
28-
const flattenStyle = useMemo(() => StyleSheet.flatten(style), [style]);
32+
const flattenStyle = useMemo<ViewStyle | undefined>(
33+
() => StyleSheet.flatten(style),
34+
[style]
35+
);
2936
const containerStyle = useAnimatedStyle(() => {
3037
if (!enableFooterMarginAdjustment) {
31-
return flattenStyle;
38+
return flattenStyle ?? {};
3239
}
3340

3441
const marginBottom =
35-
typeof flattenStyle.marginBottom === 'number'
42+
typeof flattenStyle?.marginBottom === 'number'
3643
? flattenStyle.marginBottom
3744
: 0;
3845

39-
// console.log(paddingBottom, animatedFooterHeight.value);
40-
4146
return {
42-
...flattenStyle,
47+
...(flattenStyle ?? {}),
4348
marginBottom: marginBottom + animatedFooterHeight.value,
4449
};
4550
}, [flattenStyle, enableFooterMarginAdjustment, animatedFooterHeight]);

0 commit comments

Comments
 (0)