cooperka / react-native-snackbar

:candy: Material Design "Snackbar" component for Android and iOS.
Other
823 stars 152 forks source link

Snackbars on iPad span the entire screen width #84

Open iRoachie opened 6 years ago

iRoachie commented 6 years ago

Hey been using your package for a while.

One concern I have is that Snackbars on iPad are full width compared to on Android where they only take up the required space.

Android: kapture 2018-08-11 at 12 09 00

iOS: kapture 2018-08-11 at 12 10 03

cooperka commented 6 years ago

Thanks for the report @iRoachie. I'm guessing this would be a simple fix by setting some sort of max width on iOS. Happy to accept PRs!

iRoachie commented 6 years ago

I don't mind doing it all, how would we get the width of the content?

cooperka commented 6 years ago

I didn't personally write the iOS implementation but I'm guessing one or both of these lines are what determines the width:

You might need to dig into the iOS UI APIs a bit to figure out what needs to be tweaked. This guide recommends 568dp as the max width for Snackbars.

Good luck and thank you for offering!

TimCatana commented 2 years ago

hello, I see that this thread is old. Skimming through the documentation, I was thinking that it would be better to have an option that allows the developer to adjust the width of the snackbar, rather than having a fixed width. I personally would prefer that the snackbar take up the entire width if the screen no matter the size.

Thinking about it, this shouldn't be difficult to implement. Rather than hard coding a specific width value, you would simply use a custom 'width' option that is added in the .show() method. This will also ensure, I believe, uniformity between both android and IOS versions of the snackbar.

Let me know what you think

cooperka commented 2 years ago

thanks @TimCatana, sure I would accept a change like that for iOS!