不显示滑块栏中的滑块范围反应原生Android

时间:2017-06-07 05:04:32

标签: react-native react-native-android

我正在开发示例应用程序,实际上我使用反应原生Android创建了Slider。我有滑块的一个小问题,当我在滑块上设置特定距离或移动滑块时它没有显示(实际上在这里我是给定状态值默认值为5,但在Slider中不移动,显示值范围正常,但不移动滑动条)

这是我的代码:

Sub CalculateOutliers()
    Dim n As Integer
    Dim mean As Double
    Dim SD As Double
    Dim X As Integer
    Dim k As Integer
    Dim DataSet As Variant
    Dim ESDPrin As Double

    DataSet = Selection.Value
    'Copies highlighted data into DataSet variable
    'Cell A1 is (1,1) Because it starts at 0 which is out of range

    n = Selection.CountLarge
    'Counts number of entries
    'If n < 20 Then
        'MsgBox "Data set too small"
        'Exit Sub
    'End If
    'Ends Subroutine if data set is too small for this analysis

    If n < 50 Then
        k = Int(n / 10)
    Else
        k = 5
    End If
    'determines k = number of possible outliers

    mean = Application.WorksheetFunction.Average(DataSet)
    'Calculates mean of Data Set
    MsgBox mean & "Average"

    SD = Application.WorksheetFunction.StDev(DataSet)
    'Calculates Standard Deviation of Data Set

    Dim element As Variant
    Dim Diff() As Variant, Diff2() As Variant, j As Integer

    For Each element In DataSet
        j = j + 1
        ReDim Preserve Diff(1 To j): ReDim Preserve Diff2(1 To j)
        Diff(j) = element - mean
        Diff2(j) = Abs(Diff(j))
        MsgBox Diff(j) & " Difference"
        MsgBox Diff2(j) & " Difference abs "
    Next element
    MsgBox UBound(Diff)
    'Dim P As Integer
    'Dim Outlier As Integer
    'Dim Diff2 As Variant

End Sub

最初范围显示五但不移动滑块:(图像在这里) enter image description here

但我想这样:

enter image description here

1 个答案:

答案 0 :(得分:1)

因为您还没有将值设置为滑块。

这样做:

constructor(props) {
    super(props);
      this.state = {
        switchValue: true,
        distance: 90,
      }
  }

<Slider
     style={styles.slider}
     value = {this.state.distance}
     minimumValue={0}
     maximumValue={100}
     step={1}
     onSlidingComplete={val => this.setState({ distance: val })} />

<Text style={styles.distance2}>{this.state.distance} Miles</Text>

这是输出:

enter image description here