当我使用这个例子在我的应用程序上实现 Image-slider 时,我遇到了这个错误。
import React,{Component} from 'react'
import {View,Text,TouchableOpacity, ViewPagerAndroid} from 'react-native'
import Infoslider from 'react-native-infoslider'
export default class example extends Component {
constructor(props) {
super(props);
this.state = {
data:[
{
title:"Hello World",
text:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard",
image: require('../Images/Group.png')}
]
};
}
render() {
return (
<Infoslider
data={this.state.data} />
);
}
}
Run Code Online (Sandbox Code Playgroud)
当我使用多滑块时,我遇到的一个问题是,当我滚动滑块时,我只得到了centimeter值,但我没有改变英尺值,所以我需要帮助来centimeter改变英尺值。
class App extends React.Component {
state = {
sliderOneChanging: false,
sliderOneValue: [5],
multiSliderValue: [122, 222],
};
multiSliderValuesChange = values => {
this.setState({
multiSliderValue: values,
});
};
render() {
return (
<View style={styles.container}>
<View style={styles.sliders}>
<View style={styles.sliderOne}>
<Text style={styles.text}>{this.state.multiSliderValue[0]} cm </Text>
<Text style={styles.text}>({this.state.multiSliderValue[0]})</Text>
</View>
</View>
<View style={styles.containerSlider}>
<MultiSlider
values={[
this.state.multiSliderValue[0],
]}
sliderLength={400}
onValuesChange={this.multiSliderValuesChange}
min={122}
max={222}
allowOverlap
snapped
selectedStyle={{
backgroundColor: 'pink',
}}
unselectedStyle={{
backgroundColor: 'silver',
}}
trackStyle={{
height: 2,
}}
/>
</View>
</View>
);
}
}
Run Code Online (Sandbox Code Playgroud)
react-native ×2