react-native-slider icon indicating copy to clipboard operation
react-native-slider copied to clipboard

Remove space before and after the slider bar

Open canyavall opened this issue 5 years ago • 9 comments

When a new Slideer is created, it is created inside a view and I can see an space before and after the slider (just set backgroundColor='red' on the style)

This is quite annoying in order to make it if with other components as the slider is always a bit smaller

Is this done in purpose? Can those spaces (padding or margin) be removed and make the bar use 100%

I tried setting the padding, margin, left, right to 0, but nothing...

canyavall avatar Aug 20 '19 12:08 canyavall

You could temporarily put it inside a view with negative margins:

<View style={{ marginLeft: -10, marginRight: -10 }}>
  <Slider />
</View>

ogabrielsantos avatar Oct 17 '19 01:10 ogabrielsantos

This behavior affects both platforms?

brunoziie avatar Mar 18 '20 18:03 brunoziie

Is this issue still alive? I'd like to work on this issue but the example app doesn't reproduce this.

moriyuu avatar Jun 14 '20 17:06 moriyuu

Or with marginHorizontal: -10

charitha95 avatar Jan 27 '21 07:01 charitha95

I see this issue only on Android. I applied the following style to the slider:

marginLeft: Platform.select({ ios: 0, android: -15 }),
marginRight: Platform.select({ ios: 0, android: -15 })

Kinda annoying but it works.

lucidlive avatar Apr 12 '21 19:04 lucidlive

I see this issue only on Android. I applied the following style to the slider:

marginLeft: Platform.select({ ios: 0, android: -15 }),
marginRight: Platform.select({ ios: 0, android: -15 })

Kinda annoying but it works.

it works, thanks

lirkang avatar Jun 27 '22 03:06 lirkang

The issue seems to be still there. The "margin trick" works on android for me but it causes that one tick extra is added to the upper/right limit - with no change in value. so not very useful. :(

Chr1k0 avatar Jul 19 '23 17:07 Chr1k0

Anyone got an idea of how to select the margin values - are you just doing it by eye? It looks better with -3 for iOS on our app, but unsure if this is due to different screen sizes/resolutions etc. Is setting a constant value for each platform robust?

matt-dalton avatar Aug 17 '23 18:08 matt-dalton