SliderView.js 1.1 KB
import React, {Component} from 'react';
import {
    View,
    Text,
    Slider
} from 'react-native';

export default class SliderView extends Component {

    constructor(props) {
        super(props);
        this.state = {
            value: 0,
        };
        this.title = this.props.title || '滑块';
        this.minValue = this.props.minValue || 0;// 最小值
        this.maxValue = this.props.maxValue || 100;// 最大值
        this.onComplete = this.props.onComplete;
    }

    render() {
        return(
            <View style={{width: '100%', backgroundColor: 'white', paddingHorizontal: 5, paddingVertical: 10}}>
                <Text style={{fontSize: 16, color: 'rgba(0, 0, 0, 1)', marginBottom: 5}}>{this.title}</Text>
                <Slider
                    value={this.state.value}
                    minimumValue={this.minValue}
                    maximumValue={this.maxValue}
                    //onValueChange={this.callBack}
                    //onSlidingComplete={this.onComplete()}
                    //thumbImage={}
                ></Slider>
            </View>
        );
    }
}