Coder Social home page Coder Social logo

react-native-scroll-ruler's Introduction

react-native-scroll-ruler

ReactNative版滑动刻度尺,兼容Android和iOS。

Gifs

Get Started

Installation

Step 1:

npm i react-native-scroll-ruler --save

or

yarn add react-native-scroll-ruler

Step 2:

react-native link react-native-scroll-ruler

That's all!

Usage

Simple

import RNScrollRuler from 'react-native-scroll-ruler';

<RNScrollRuler 
	style={{width: Util.size.width - 20, height: 100, backgroundColor: '#fff'}}
   	ref={(view) => {
   	}}
   	minValue={30}
   	maxValue={180}
   	step={1}
   	num={10}
   	unit={"kg"}
   	defaultValue={this.state.defaultWeight}
   	onSelect={(value) => {
    	this.setState({weight: value});
   	}}
></RNScrollRuler>


<RNScrollRuler 
	style={{width: Util.size.width - 20, height: 100, backgroundColor: '#fff'}}
   	ref={(view) => {
   	}}
   	minValue={120}
   	maxValue={250}
   	step={1}
   	num={10}
   	unit={"cm"}
   	defaultValue={this.state.defaultHeight}
   	onSelect={(value) => {
    	this.setState({height: value});
   	}}
></RNScrollRuler>

Props

Prop Description Type Required
minValue 尺子显示的最小值 number Y
maxValue 尺子显示的最大值 number Y
defaultValue 尺子默认值 number Y
step 两个大刻度之间的数值间隔 number Y
num 两个小刻度之间的数值间隔 number Y
unit 单位 string N

Methods

Method Description
onSelect 选中值后的回调方法

License

MIT

react-native-scroll-ruler's People

Contributors

shenhuniurou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-native-scroll-ruler's Issues

ios 无法滚动

hi 作者你好,我集成了你的代码,但是发现ios端uicollectionview无法滚动,不知道是什么原因

No podfile

可不可以更新一下啊,添加一下podfile

Getting extra scale value printed larger then max value

I am getting one extra scale point for when I am passing max value lower i.e 10 and getting 20 printed on the scale
2019-10-22_2042

RNScrollRuler
style={{ width: width, height: 100, backgroundColor: "#fff" }}
ref={view => {}}
minValue={0}
maxValue={10}
step={1}
num={10}
defaultValue={5}
onSelect={value => {
console.log("this.state.weight ", value);
}}
/>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.