Skip to content

Commit

Permalink
fix: fixed extracting paddingBottom in scrollable components
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Jul 31, 2020
1 parent 62ec5f6 commit 945104a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
14 changes: 5 additions & 9 deletions src/components/flatList/FlatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,12 @@ const FlatList = forwardRef(

// styles
const contentContainerStyle = useMemo(() => {
const {
//@ts-ignore
paddingBottom = 0,
// @ts-ignore
...restContentContainerStyle
} = _contentContainerStyle;

return {
...restContentContainerStyle,
paddingBottom: contentPaddingBottom + Math.max(paddingBottom ?? 0, 0),
// @ts-ignore
...(_contentContainerStyle ?? {}),
paddingBottom:
contentPaddingBottom +
Math.max(_contentContainerStyle?.paddingBottom ?? 0, 0),
};
}, [_contentContainerStyle, contentPaddingBottom]);

Expand Down
14 changes: 5 additions & 9 deletions src/components/scrollView/ScrollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,12 @@ const ScrollView = forwardRef(

// styles
const contentContainerStyle = useMemo(() => {
const {
//@ts-ignore
paddingBottom = 0,
// @ts-ignore
...restContentContainerStyle
} = _contentContainerStyle;

return {
...restContentContainerStyle,
paddingBottom: contentPaddingBottom + Math.max(paddingBottom ?? 0, 0),
// @ts-ignore
...(_contentContainerStyle ?? {}),
paddingBottom:
contentPaddingBottom +
Math.max(_contentContainerStyle?.paddingBottom ?? 0, 0),
};
}, [_contentContainerStyle, contentPaddingBottom]);

Expand Down
13 changes: 5 additions & 8 deletions src/components/sectionList/SectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,12 @@ const SectionList = forwardRef(

// styles
const contentContainerStyle = useMemo(() => {
const {
//@ts-ignore
paddingBottom = 0,
// @ts-ignore
...restContentContainerStyle
} = _contentContainerStyle;
return {
...restContentContainerStyle,
paddingBottom: contentPaddingBottom + Math.max(paddingBottom ?? 0, 0),
// @ts-ignore
...(_contentContainerStyle ?? {}),
paddingBottom:
contentPaddingBottom +
Math.max(_contentContainerStyle?.paddingBottom ?? 0, 0),
};
}, [_contentContainerStyle, contentPaddingBottom]);

Expand Down

0 comments on commit 945104a

Please sign in to comment.