react-custom-scrollbars的使用
2019-12-10 15:10
5155 查看
react-custom-scrollbars的作用
- 流畅的本机浏览器滚动
- 移动设备的本机滚动条
- 完全可定制
- 自动隐藏
- 自动高度
- 通用(在客户端和服务器上运行)
requestAnimationFrame
60fps- 没有多余的样式表
- 经过良好测试,代码覆盖率100%
安装
npm install react-custom-scrollbars --save
基本用法
import { Scrollbars } from 'react-custom-scrollbars'; class App extends Component { render() { return ( <Scrollbars style={{ width: 500, height: 300 }}> <p>Some great content...</p> </Scrollbars> ); } }
可配置:
import { Scrollbars } from 'react-custom-scrollbars'; class CustomScrollbars extends Component { render() { return ( <Scrollbars onScroll={this.handleScroll} onScrollFrame={this.handleScrollFrame} onScrollStart={this.handleScrollStart} onScrollStop={this.handleScrollStop} onUpdate={this.handleUpdate} renderView={this.renderView} renderTrackHorizontal={this.renderTrackHorizontal} renderTrackVertical={this.renderTrackVertical} renderThumbHorizontal={this.renderThumbHorizontal} renderThumbVertical={this.renderThumbVertical} autoHide autoHideTimeout={1000} autoHideDuration={200} autoHeight autoHeightMin={0} autoHeightMax={200} thumbMinSize={30} universal={true} {...this.props}> ); } }
相关文章推荐
- react 学习笔记之AJAX数据请求和使用
- 使用react做的聊天对话列表
- 如何使用 npm 安装 React
- React中setState的使用(跟ref搭配使用的一些坑)
- 使用react做管理后台项目遇到的问题和难点
- react-native-navigation 原生路由组件的使用
- react-native之Realm数据库的使用(一)
- React使用PropTypes进行类型检测
- 在自定义指令中使用NgModelController(Using NgModelController with Custom Directives)
- unity uGui使用图片显示数字(CustomFont)记录备忘
- 初识ReactJS的组件化开发(二):组件嵌套和属性的基本使用
- react native ViewPagerAndroid 使用详解
- 使用CustomValidator类及时验证用户名
- react native ActionSheetIOS 使用详解
- [转]WinForm中Component Class、User Control及Custom Control的区别和使用
- react-intl 国际化语言插件使用
- (转)React Native 使用react-native-image-picker库实现图片上传功能
- 使用Formik轻松开发更高质量的React表单(二)使用指南
- JavaScript学习笔记_ReactRouter使用教程
- Mac React-Native环境搭建及使用