react-native-resegmented-control icon indicating copy to clipboard operation
react-native-resegmented-control copied to clipboard

It would be nice to have sliderStyle props

Open firede opened this issue 4 years ago • 5 comments

image (react-native-resegmented-control vs react-native-community/segmented-control)

Slider backgroundColor is hardcoded to white, it's difficult to customize the theme in dark mode. It would be nice to have sliderStyle(or sliderBackgroundColor) props to override it.

firede avatar Apr 07 '20 07:04 firede

Published v2.3.0 which includes sliderStyle.

Let me know if this works for you!

richardvclam avatar Apr 07 '20 16:04 richardvclam

Thanks, it works!

But the last Segment looks missing some padding:

firede avatar Apr 07 '20 16:04 firede

Can you share a screenshot or the code to replicate?

richardvclam avatar Apr 07 '20 18:04 richardvclam

Sorry, the screenshot I uploaded earlier is broken...

SegmentedControl

Code:

const styles = StyleSheet.create({
  segmentedControl: {
    width: 140,
    backgroundColor: "rgba(255,255,255,.1)",
  },
  segmentedSlider: {
    backgroundColor: "rgba(255,255,255,.25)",
  },
})

// ...

<SegmentedControl
  activeTintColor="#fff"
  inactiveTintColor="#fff"
  initialSelectedName="HEX"
  style={styles.segmentedControl}
  sliderStyle={styles.segmentedSlider}>
  <Segment name="HEX" content="HEX" />
  <Segment name="HSLuv" content="HSLuv" />
</SegmentedControl>

firede avatar Apr 09 '20 08:04 firede

Ah, thanks for reporting this!

I'll take a look and see if some tweaking can fix this 😄

richardvclam avatar Apr 09 '20 15:04 richardvclam