GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - CaleyD/react-native-dial: Like a slider input, but round. For finer grained control over large ranges.

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
Dial.js
Dial.js
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
index.js
index.js
 
 
legacy.js
legacy.js
 
 
package.json
package.json
 
 

Repository files navigation

react-native-dial

Like a slider input, but round. For finer grained control over large ranges.

This component is 100% JS and compatible with both Android and iOS.

props

  • minimumValue - PropTypes.number: the minimum selectable value
  • maximumValue - PropTypes.number: the maximum selectable value
  • value - PropTypes.number: the initial value
  • onValueChange - PropTypes.func: Callback continuously called while the user is interacting with the component.
  • onSlidingBegin - PropTypes.func: Callback called when the user begins interacting with the component. This is a good time to disable scrolling in a parent ScrollView.
  • onSlidingComplete - PropTypes.func: Callback called when the user finishes changing the value (e.g. when the component is released).

installation

npm install react-native-dial --save

usage sample

IMPORTANT If you are using an older version of React-Native import from react-native-dial/legacy (instead of react-native-dial) because the React Native team changed the API for accessing the NativeMethodsMixin module and the static packager doesn't support fallback or dynamic paths for loading modules.

import React, { Component } from 'react';
import { AppRegistry, Text, View } from 'react-native';
import Dial from 'react-native-dial';

class SampleApp extends Component {
  constructor(props) {
    super(props);
    this.state = { value: 0 };
  }
  render() {
    return (
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center'}}>
        <Text>{this.state.value}</Text>

      	<Dial
      		style={{ width: 120, height: 120, marginBottom:30 }}
          maximumValue={3600}
          step={360/50}
          onValueChange={num=>this.setState({ value: num })}
      	/>

      </View>
    );
  }
}

AppRegistry.registerComponent('SampleApp', () => SampleApp);

future enhancements

Pull requests are welcome.

  • add animated gif of example to readme
  • set step value like in Slider control
  • set range of 1 revolution
  • don't allow oversliding more than 1 revolution past min/max
  • add mode prop to swap between 'dial' and 'circular-slider'
    • maybe allow custom renderer?
  • ability to customize styles
  • more native looking default styles for android?
  • add enabled property
  • allow value prop to be updatable

About

Like a slider input, but round. For finer grained control over large ranges.

Resources

Readme
MIT license
Activity

Stars

5 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.