Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional space added in modal #222

Closed
tarekhassan410 opened this issue Sep 25, 2022 · 44 comments · Fixed by #330
Closed

Additional space added in modal #222

tarekhassan410 opened this issue Sep 25, 2022 · 44 comments · Fixed by #330

Comments

@tarekhassan410
Copy link

Action sheet shows additional space in bottom of it.
It is random,one time it shows and the next time it doesn't.

Screenshot_20220925-120042_1
Screenshot_20220925-120106_1

@ammarahm-ed
Copy link
Owner

Hi, this happens on iOS or android? Also which version of the sheet are you using?

@tarekhassan410
Copy link
Author

I am using Android, version 0.8.7.
Also, on downgrading to 0.8.0 it works fine.

@TheAhmadSami
Copy link

TheAhmadSami commented Oct 11, 2022

Did you find a solution?!, I have the same problem with version 0.8.8 using android 11
Sometimes I get padding at the bottom of the modal when using safeArea!!
@tarekhassan410 @ammarahm-ed

@guygolanIL
Copy link

happens to me aswell on android (action sheet v: ^0.8.7)

@guygolanIL
Copy link

guygolanIL commented Oct 18, 2022

just rolled back a few versions. this started to occure on 0.8.4 @ammarahm-ed but sadly i cant remain in those builds since those have issues with react-navigation so a workaround would be appreciated

@guygolanIL
Copy link

guygolanIL commented Oct 19, 2022

also, setting a custom height following seems to mitigate that
<ActionSheet
id={props.sheetId}
containerStyle={{
height: '15%'
}}

@ammarahm-ed
Copy link
Owner

Try v0.8.9

@tarekhassan410
Copy link
Author

It is still happening, less often but still happening

@ammarahm-ed ammarahm-ed reopened this Oct 26, 2022
@ammarahm-ed
Copy link
Owner

ammarahm-ed commented Oct 26, 2022

Have you tried v0.8.10? Also are you testing on emulator or real device?

@tarekhassan410
Copy link
Author

I am testing on emulator.
It is still happening. It is better now but still happening.

@guygolanIL
Copy link

testing 0.8.10 on an android device and could not reproduce this bug

@younes0
Copy link

younes0 commented Feb 12, 2023

I encounter this bug
the getPaddingBottom() is responsible for this extra padding, it returns StatusBar.currentHeight.
Why would you have bottom padding based on StatusBar.currentHeight ?

@ammarahm-ed
Copy link
Owner

@younes0 which version are you on?

@younes0
Copy link

younes0 commented Feb 12, 2023

@ammarahm-ed latest: 0.8.17
This behavior was found on Android, not on web. I didn't test on iOS

@ammarahm-ed
Copy link
Owner

ammarahm-ed commented Feb 12, 2023

Can you share what your sheet is like?what styles & props you have added etc, so i can reproduce it locally 🤔@younes0

@younes0
Copy link

younes0 commented Feb 12, 2023

@ammarahm-ed I use Expo btw
I emoved all props and used a clean setup. But let me try with a blank expo template soon.

@younes0
Copy link

younes0 commented Feb 13, 2023

@ammarahm-ed
This behavior happens since 0.8.4
Check this snack, run on Android, and simply change the version to 0.8.3 and 0.8.4:
https://snack.expo.dev/@younes0/github.com-ammarahm-ed-react-native-actions-sheet:expo-example

Checked v0.8.3...v0.8.4
But can't figure out.

@ammarahm-ed
Copy link
Owner

@younes0 have you tried with the latest version, it's the same?

@younes0
Copy link

younes0 commented Feb 13, 2023

@ammarahm-ed yes it's the same.
also note that the backdrop has the same issue (the overlay starts after this extra bottom padding)

@ammarahm-ed
Copy link
Owner

@younes0 Try 0.8.20. I fixed the problem now I think

@younes0
Copy link

younes0 commented Feb 13, 2023

@ammarahm-ed I've just updated the snack with 0.8.20 and the problem is still there

@younes0
Copy link

younes0 commented Feb 13, 2023

btw Problem happens with my real device (oneplus 10t) + emulator (pixel 6)

@ammarahm-ed
Copy link
Owner

ammarahm-ed commented Feb 13, 2023

After the changes i made, i am not able to reproduce it in your snack example. Before it was adding bottom padding 24 and it was bigger than usual with the Text. 🤔

@younes0
Copy link

younes0 commented Feb 13, 2023

@ammarahm-ed I'm not sure to understand what you mean by reproducing the snack example: the snack has been updated so you can try it. There's no padding added or anything.

@ammarahm-ed
Copy link
Owner

@younes0 Try 0.8.21. The issue is related to this problem facebook/react-native#23693 (comment) however I think I fixed it this time. After testing real device the issue was still there.

@younes0
Copy link

younes0 commented Feb 13, 2023

Almost @ammarahm-ed ! There's no extra space this time, but it seems that there is like a negative margin, you can see that the content is cropped:
https://user-images.githubusercontent.com/886042/218531748-26f9b600-771e-46b2-8bbe-11fe26f42ba2.jpg

@younes0
Copy link

younes0 commented Feb 13, 2023

@ammarahm-ed just realized with this new version, if you add useBottomSafeAreaPadding , it does the same incorrect behavior of before

@ammarahm-ed
Copy link
Owner

ammarahm-ed commented Feb 13, 2023

Then keep that prop disabled if you don't need padding from bottom. Or manually add some padding when needed.

You can simply add some safe padding at bottom i think. I will see to it again but you need to somehow diff between devices with soft buttons and those that use gestures Using some library that gives you bottom nav bar height.

@ammarahm-ed
Copy link
Owner

ammarahm-ed commented Feb 13, 2023

Maybe try this and add padding to container style on bottom based on nav bar height. https://github.com/ConnectyCube/react-native-android-navbar-height

@baatten
Copy link

baatten commented Feb 23, 2023

I just updated to X.21 and I see padding in the bottom?

@HKH01
Copy link

HKH01 commented Feb 24, 2023

My workaround is below:

import { Platform, StatusBar, useWindowDimensions } from 'react-native'
import { initialWindowMetrics, useSafeAreaInsets } from 'react-native-safe-area-context'

function useSafeSheetBottom() {
  const windowHeight = useWindowDimensions().height

  let mb = useSafeAreaInsets().bottom
  if (Platform.OS === 'android') {
    const sh = StatusBar.currentHeight
    if (Math.floor(initialWindowMetrics.frame.height) === Math.floor(windowHeight)) {
      return -sh
    }
    return sh
  }
  return mb
}

and give a margin-bottom from useSafeSheetBottom() to ActionSheet's direct child element.

@kockok
Copy link

kockok commented Mar 7, 2023

I also found extra bottom space in version 0.8.21 iOS physical device.

Adding useBottomSafeAreaPadding={false} won't help.

@mehdinourollah
Copy link

mehdinourollah commented Mar 20, 2023

It looks like the useBottomSafeAreaPadding={false} doesn't work on iOS on version 0.8.21 ...

@moesalih
Copy link

moesalih commented Mar 29, 2023

has anyone figured out the cause of the randomness? why is the behavior inconsistent?
i'm on iOS on v0.8.28

@baatten
Copy link

baatten commented Mar 30, 2023

I'm on version 0.8.29 and also still have the issue.

@mixmaker
Copy link

mixmaker commented Apr 2, 2023

Is this related to the issue I'm facing?
As you can see the sheet doesn't draw under the navbar

Screenshot_1680434200

@carlosedof
Copy link

Is this related to the issue I'm facing? As you can see the sheet doesn't draw under the navbar

Screenshot_1680434200

I'm experiencing the same issue

@jonxssc
Copy link
Contributor

jonxssc commented May 10, 2023

Same problem here since i upgraded react native from 0.69.9 to 0.71.7 and expo from ~46.0.21 to ~48.0.15. Currently using this packages version ^0.8.29. On every Actionsheet on ios real device and simulator is a space in the size of the phones status bar on the bottom that i cant get rid of, which pushes on full size actionsheet the handler under the actionsheet.

The actionsheet containerstyle has the background color green and my content in the actionsheet has the background color red, this shows that the problem is still there on newest react native/expo and package versions.

image

@jonxssc
Copy link
Contributor

jonxssc commented May 12, 2023

Turns out, 0.8.3 is the last possible version without the spacing so i am using this.
As you can see in this snack (newest package version) the https://snack.expo.dev/@jonassc/github.com-ammarahm-ed-react-native-actions-sheet:expo-example on an ios device it has the spacing on bottom:
image

On Android it looks like this:
image

The only Platform it works currectly is on Web:
image

@henrhie
Copy link

henrhie commented May 25, 2023

Downgraded to 0.8.3 and bug goes away

@jonxssc
Copy link
Contributor

jonxssc commented Jan 14, 2024

For anyone searching for a solution, removing the code i pointed at in https://github.com/ammarahm-ed/react-native-actions-sheet/pull/328 this request, should fix the weird spacing, tested it on version 0.8.29

@PopBot
Copy link

PopBot commented Jan 15, 2024

Thanks so much @jonxssc. Was pretty puzzled on this, but glad we found a fix.

@BasitAli
Copy link

@ammarahm-ed Was this resolved? I still see this on latest version 0.9.2.

image

@BasitAli
Copy link

My workaround is below:

import { Platform, StatusBar, useWindowDimensions } from 'react-native'
import { initialWindowMetrics, useSafeAreaInsets } from 'react-native-safe-area-context'

function useSafeSheetBottom() {
  const windowHeight = useWindowDimensions().height

  let mb = useSafeAreaInsets().bottom
  if (Platform.OS === 'android') {
    const sh = StatusBar.currentHeight
    if (Math.floor(initialWindowMetrics.frame.height) === Math.floor(windowHeight)) {
      return -sh
    }
    return sh
  }
  return mb
}

and give a margin-bottom from useSafeSheetBottom() to ActionSheet's direct child element.

This workaround works partially. I need a background color on the sheet which doesn't apply to the white area even if the margin is applied on the container style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.