From ffab9991368057d6afaf474914ec8667882df137 Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Tue, 23 Aug 2022 12:31:16 +0500 Subject: [PATCH] fix bottom paddin on android --- dist/src/index.d.ts.map | 2 +- dist/src/index.js | 11 ++++++++--- src/index.tsx | 12 +++++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/dist/src/index.d.ts.map b/dist/src/index.d.ts.map index 2be8dde..5232615 100644 --- a/dist/src/index.d.ts.map +++ b/dist/src/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,EAML,eAAe,EAShB,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAE9C,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1B;;OAEG;IACH,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAE7C;;OAEG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH;;;OAGG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,oBAAoB,EAAE,MAAM,IAAI,CAAC;IAEjC;;OAEG;IACH,uBAAuB,EAAE,CACvB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,YAAY,EAAE,MAAM,KACjB,IAAI,CAAC;IAEV,gBAAgB,EAAE,MAAM,OAAO,CAAC;IAEhC,MAAM,EAAE,MAAM,OAAO,CAAC;CACvB,CAAC;;AAIF,wBAksBE"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,EAML,eAAe,EAShB,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAE9C,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1B;;OAEG;IACH,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAE7C;;OAEG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH;;;OAGG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,oBAAoB,EAAE,MAAM,IAAI,CAAC;IAEjC;;OAEG;IACH,uBAAuB,EAAE,CACvB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,YAAY,EAAE,MAAM,KACjB,IAAI,CAAC;IAEV,gBAAgB,EAAE,MAAM,OAAO,CAAC;IAEhC,MAAM,EAAE,MAAM,OAAO,CAAC;CACvB,CAAC;;AAIF,wBAwsBE"} \ No newline at end of file diff --git a/dist/src/index.js b/dist/src/index.js index f3608c5..83226b2 100644 --- a/dist/src/index.js +++ b/dist/src/index.js @@ -476,11 +476,16 @@ 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; @@ -488,11 +493,11 @@ export default forwardRef(function ActionSheet(_a, ref) { 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; }; diff --git a/src/index.tsx b/src/index.tsx index 5a5a054..6385378 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -627,13 +627,19 @@ export default forwardRef( ); 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') @@ -643,12 +649,12 @@ export default forwardRef( 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;