React Native Slider样式问题(包含代码和图像)

时间:2018-06-12 21:57:29

标签: react-native

我试图让反应原生的滑块在中间,左右两个图像。但是,当我把样式flexDirection:' row'在父母身上,它搞砸了滑块。

期望的结果: enter image description here

实际结果: enter image description here

使用flexDirection的实际结果:' row'在视图上: enter image description here

  <Content>
    <View style={{ backgroundColor: '#fff', padding: 10 }}>
      <Image source={Images.quiet} />
      <Slider
        style={{ flex: 0 }}
        maximumValue={10}
        minimumValue={1}
        step={1}
        value={device.volume}
        minimumTrackTintColor={'#D05B35'}
        maximumTrackTintColor={'#D8D8D8'}
        thumbImage={Images.thumb}
        onSlidingComplete={(vol) => this.changeVolume(vol)}
        />
      <Image source={Images.loud} />
    </View>
  </Content>

1 个答案:

答案 0 :(得分:0)

通过将宽度设置为滑块

来解决问题