Skip to content

Commit

Permalink
fix bottom paddin on android
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarahm-ed committed Aug 23, 2022
1 parent 9cc7eb3 commit ffab999
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/src/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions dist/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,23 +476,28 @@ export default forwardRef(function ActionSheet(_a, ref) {
}, [isModal, onHardwareBackPress, props, statusBarTranslucent, zIndex]);
var getPaddingBottom = function () {
var _a, _b, _c, _d, _e;
var topPadding = Platform.OS === 'android'
? StatusBar.currentHeight && StatusBar.currentHeight > 35
? 35
: StatusBar.currentHeight
: safeAreaPaddingTop.current;
if (!props.useBottomSafeAreaPadding && props.containerStyle) {
return (((_a = props.containerStyle) === null || _a === void 0 ? void 0 : _a.paddingBottom) || props.containerStyle.padding);
}
if (!props.containerStyle && (props === null || props === void 0 ? void 0 : props.useBottomSafeAreaPadding)) {
return safeAreaPaddingTop.current;
return topPadding;
}
if (((_b = props.containerStyle) === null || _b === void 0 ? void 0 : _b.paddingBottom) === 'string')
return props.containerStyle.paddingBottom;
if (((_c = props.containerStyle) === null || _c === void 0 ? void 0 : _c.padding) === 'string')
return props.containerStyle.padding;
if ((_d = props.containerStyle) === null || _d === void 0 ? void 0 : _d.paddingBottom) {
//@ts-ignore
return safeAreaPaddingTop.current + props.containerStyle.paddingBottom;
return topPadding + props.containerStyle.paddingBottom;
}
if ((_e = props.containerStyle) === null || _e === void 0 ? void 0 : _e.padding) {
//@ts-ignore
return safeAreaPaddingTop.current + props.containerStyle.padding;
return topPadding + props.containerStyle.padding;
}
return 0;
};
Expand Down
12 changes: 9 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -627,13 +627,19 @@ export default forwardRef<ActionSheetRef, ActionSheetProps>(
);

const getPaddingBottom = () => {
const topPadding =
Platform.OS === 'android'
? StatusBar.currentHeight && StatusBar.currentHeight > 35
? 35
: StatusBar.currentHeight
: safeAreaPaddingTop.current;
if (!props.useBottomSafeAreaPadding && props.containerStyle) {
return (
props.containerStyle?.paddingBottom || props.containerStyle.padding
);
}
if (!props.containerStyle && props?.useBottomSafeAreaPadding) {
return safeAreaPaddingTop.current;
return topPadding;
}

if (props.containerStyle?.paddingBottom === 'string')
Expand All @@ -643,12 +649,12 @@ export default forwardRef<ActionSheetRef, ActionSheetProps>(

if (props.containerStyle?.paddingBottom) {
//@ts-ignore
return safeAreaPaddingTop.current + props.containerStyle.paddingBottom;
return topPadding + props.containerStyle.paddingBottom;
}

if (props.containerStyle?.padding) {
//@ts-ignore
return safeAreaPaddingTop.current + props.containerStyle.padding;
return topPadding + props.containerStyle.padding;
}

return 0;
Expand Down

0 comments on commit ffab999

Please sign in to comment.