New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-rating

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-rating

A stars rating component for react-native built with the Animated API

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
209
decreased by-5.86%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-rating

Display ratings in your react-native app like a pro. Works on both iOS and Android.

Install

npm i -S react-native-rating or yarn add react-native-rating

Usage

import Rating from 'react-native-rating'
import { Easing } from 'react-native'

const images = {
  starFilled: require('./assets/star_filled.png'),
  starUnfilled: require('./assets/star_unfilled.png')
}

const myRandoComponent = () => (
  <Rating
    onChange={rating => console.log(rating)}
    selectedStar={images.starFilled}
    unselectedStar={images.starUnfilled}
    config={{
      easing: Easing.inOut(Easing.ease),
      duration: 350
    }}
    stagger={80}
    maxScale={1.4}
    starStyle={{
      width: 40,
      height: 40
    }}
  />
)

Customization

Refer to the propTypes and defaultProps definition below:

static propTypes = {
  max: PropTypes.number,
  initial: PropTypes.number,
  onChange: PropTypes.func,
  config: PropTypes.shape({
    easing: PropTypes.func.isRequired,
    duration: PropTypes.number.isRequired
  }),
  editable: PropTypes.bool,
  stagger: PropTypes.number,
  maxScale: PropTypes.number,
  starStyle: ViewPropTypes.style,
  containerStyle: ViewPropTypes.style,
  selectedStar: PropTypes.number.isRequired,
  unselectedStar: PropTypes.number.isRequired,
  onAnimationComplete: PropTypes.func
}

static defaultProps = {
  max: 5,
  initial: 0,
  onChange: () => {},
  config: {
    easing: Easing.elastic(1),
    duration: 400
  },
  stagger: 100,
  maxScale: 1.1,
  starStyle: {
    width: 36,
    height: 36
  },
  editable: true,
  containerStyle: { flexDirection: 'row' },
  onAnimationComplete: () => {}
}

License

MIT

Keywords

FAQs

Package last updated on 18 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc