Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-star-rating-widget

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-star-rating-widget

A star rating widget for react native

  • 1.9.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10K
increased by45.5%
Maintainers
0
Weekly downloads
 
Created
Source

react-native-star-rating-widget

npm version

A customizable, animated star rating component for React Native. Compatible with iOS, Android and Web. Written in Typescript.

Demo

Installation

  1. install react-native-star-rating-widget npm install react-native-star-rating-widget --save or yarn add react-native-star-rating-widget
  2. if not already installed, add react-native-svg

Usage

This package exports an

Interactive StarRating component

import StarRating from 'react-native-star-rating-widget';

const Example = () => {
  const [rating, setRating] = useState(0);
  return (
      <StarRating
        rating={rating}
        onChange={setRating}
      />
  );
};

Non-Interactive StarRatingDisplay component

import { StarRatingDisplay } from 'react-native-star-rating-widget';

const Example = () => {
  return (
      <StarRatingDisplay
        rating={4.5}
      />
  );
};

See example/src for more examples.

Props

StarRating Props

NameTypeDefaultDescription
ratingnumberREQUIREDRating Value. Should be between 0 and maxStars
onChange(rating: number) => voidREQUIREDcalled when rating changes
maxStarsnumber5number of stars
starSizenumber32star size
colorstring"#fdd835"star color
emptyColorstringsame as colorempty star color
styleobjectundefinedoptional style
starStyleobjectundefinedoptional star style
enableHalfStarbooleantrueenable or disable display of half stars
enableSwipingbooleantrueenable or disable swiping
onRatingStart(rating: number) => voidundefinedcalled when the interaction starts, before onChange
onRatingEnd(rating: number) => voidundefinedcalled when the interaction starts, after onChange
animationConfigsee AnimationConfigsee AnimationConfiganimation configuration object
StarIconComponent(props: { index: number; size: number; color: string; type: "full" | "half" | "empty"; }) => JSX.ElementStarIconIcon component
accessibilityLabelstringstar rating. %value% stars. use custom actions to set rating.The label used on the star component
accessabilityIncrementLabelstringincrementThe label for the increment action
accessabilityDecrementLabelstringdecrementThe label for the decrement action.
accessabilityActivateLabelstringactivate (default)The label for the activate action.
accessibilityAdjustmentLabelstring%value% starsThe label that is announced after adjustment action

StarRatingDisplay Props

The StarRatingDisplay component accepts mostly the same props as StarRating except those that are interaction related props such as onChange, enableSwiping, onRatingStart etc.

AnimationConfig

NameTypeDefaultDescription
scalenumber1.2star animation scale value
durationnumber300animation duration
delaynumber300animation delay when interaction has ended
easing(number) => numberEasing.elastic(2)animation easing function

Keywords

FAQs

Package last updated on 27 Nov 2024

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