Skip to content

Commit

Permalink
fix(#1987): updated provided style handling for bottom sheet view
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Oct 20, 2024
1 parent d1c74c5 commit 4c8ae25
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/components/bottomSheetView/BottomSheetView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import React, { memo, useEffect, useCallback, useMemo } from 'react';
import { type LayoutChangeEvent, StyleSheet } from 'react-native';
import {
type LayoutChangeEvent,
StyleSheet,
type ViewStyle,
} from 'react-native';
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
import { SCROLLABLE_TYPE } from '../../constants';
import { useBottomSheetInternal } from '../../hooks';
Expand All @@ -25,21 +29,22 @@ function BottomSheetViewComponent({
//#endregion

//#region styles
const flattenStyle = useMemo(() => StyleSheet.flatten(style), [style]);
const flattenStyle = useMemo<ViewStyle | undefined>(
() => StyleSheet.flatten(style),
[style]
);
const containerStyle = useAnimatedStyle(() => {
if (!enableFooterMarginAdjustment) {
return flattenStyle;
return flattenStyle ?? {};
}

const marginBottom =
typeof flattenStyle.marginBottom === 'number'
typeof flattenStyle?.marginBottom === 'number'
? flattenStyle.marginBottom
: 0;

// console.log(paddingBottom, animatedFooterHeight.value);

return {
...flattenStyle,
...(flattenStyle ?? {}),
marginBottom: marginBottom + animatedFooterHeight.value,
};
}, [flattenStyle, enableFooterMarginAdjustment, animatedFooterHeight]);
Expand Down

0 comments on commit 4c8ae25

Please sign in to comment.