alessiocancian / react-native-actionsheet

An elegant ActionSheet component for React Native.
MIT License
64 stars 24 forks source link

Action sheet always forces portrait mode #11

Open justkd opened 3 years ago

justkd commented 3 years ago

Bug

When in landscape orientation, when ActionSheetCustom is opened, it forces portrait mode while the action sheet is open. Once closed, it reverts to the original orientation.

Environment info

Library Version
@alessiocancian/react-native-actionsheet 3.0.3
react-native 0.64.2

Steps To Reproduce

  1. Implement ActionSheetCustom on a landscape oriented view.
  2. Open the action sheet in landscape orientation.

Untitled

Describe what you expected to happen:

  1. I expect the action sheet to display in landscape view.
alessiocancian commented 3 years ago

Ok that's odd. 😳

I reproduced the issue and I fixed the orientation by adding supportedOrientations={["portrait", "landscape"]} to the Modal. Unluckily that's not enough to add landscape support, but I will look into it tomorrow.

alessiocancian commented 3 years ago

Released to v3.1.0, let me know if it works for you

EDIT: I saw the native actionsheet on iOS takes less than half of the screen size on landscape mode, should I do the same?

justkd commented 3 years ago

@alessiocancian I had to go in and add the other landscape orientations in order for this to work, but otherwise it's looking great!

supportedOrientations={["portrait", "landscape", "landscape-left", "landscape-right"]}

Do you know if Android trims it down in the default version? Personally, I do like the trimmed down version for landscape. When it's full width it's a lot of whitespace in most cases.

alessiocancian commented 3 years ago

@alessiocancian I had to go in and add the other landscape orientations in order for this to work, but otherwise it's looking great!

supportedOrientations={["portrait", "landscape", "landscape-left", "landscape-right"]}

Ok I'll make this the default value and add an optional prop to change supportedOrientations if needed.

Do you know if Android trims it down in the default version? Personally, I do like the trimmed down version for landscape. When it's full width it's a lot of whitespace in most cases.

There isn't a real equivalent of ActionSheet for Android, there is a material version here but I don't like it. I think I will implement the "trimmed" version only for iOS style ActionSheets, so on Android only if theme="ios".