React Native的SliderIOS滑块组件
2024-10-12 01:38:00
import React,{Component}from 'react';
import {
AppRegistry, StyleSheet,
Text,
View,
SliderIOS,
} from 'react-native'; class SliderIOSDemo extends Component {
constructor(props){
super(props);
this.state={
value:0,
};
}
render() {
return (
<View> <Text style={{marginLeft:10}}>默认的SliderIOS</Text>
<SliderIOS style={{margin:10}}
onSlidingComplete={()=>console.log('当前的值为'+this.state.value)}
onValueChange={(value)=>this.setState({value:value})}
/>
<Text style={{marginLeft:10}}>设置SliderIOS无法滑动</Text>
<SliderIOS
style={{margin:10}}
disabled={true}
/>
<Text style={{marginLeft:10}}>定制SliderIOS</Text>
<SliderIOS style={{margin:10}}
value={0.4} onSlidingComplete={()=>console.log('当前的值为'+this.state.value)}
onValueChange={(value)=>this.setState({value:value})}
/>
</View>
);
}
}
const styles = StyleSheet.create({
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 20,
},
}); AppRegistry.registerComponent('Allen', () => SliderIOSDemo )
备注:滑动后会用函数传递参数值
最新文章
- python 学习笔记十六 django深入学习一 路由系统,模板,admin,数据库操作
- SDL播放视频
- BZOJ4110 : [Wf2015]Evolution in Parallel
- eclipse菜单解释及中英对照《二》
- 翻译:Knockout 轻松上手 - 1 Knockout 是什么?
- C#中利用委托实现多线程跨线程操作
- matlab特征值分解和奇异值分解
- verilog中的function用法与例子
- SqlLite 简明教程
- 小试牛刀-嘿嘿,创建job了
- UML基础知识
- Serializable 都这么牛逼了,Parcelable 还要你何用?
- Idea中右边的maven projects窗口找不到了如何调出来
- C++对一组pair数据进行排序(sort函数的使用)
- BZOJ4671异或图
- spring mvc jsonp调用示例
- MySQL--REPLACE INTO与自增
- python语法风格
- Win10系列:JavaScript多媒体
- 短信验证登陆-中国网建提供的SMS短信平台
热门文章
- elasticsearch 通过外网访问
- spring boot读取配置文件
- selenium python 启动Firefox
- 一些ios牛人的博客
- XenServer:使用XenCenter开设VPS(多图完整版)
- python 读取配置文件总是报错 configparser.NoSectionError: No section:
- 常用软件安装及VS插件工具
- Catch all the latest Jordan Release Dates
- 几乎考虑到了每个细节的php图片上传
- Python: 类中为什么要定义__init__()方法