🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

rn-rating-component

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

rn-rating-component

react-native rating component

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

rn-rating-component

A Simple react-native rating component.

npm

Installation

Install rn-rating-component and its dependeices with npm

  npm install --save rn-rating-component

or

  yarn add --save rn-rating-component

Basic Example

import React, {useState} from 'react';
import Rating from 'rn-rating-component'

export const Rn_Rating_Component_Example =()=> {
      const [rate, setRate] = useState(null);
      return (
       <Rating
        maxrating={5}
        size={30}
        defaultrate={rate}
        onChangeRate={setRate}
      />
  );
}

Features

  • two default modes

  • uri string for custom icons

  • fully customisable style and props

  • Highly functional

Documentation

The default icons are from react-native-vector-icons.see the demo app inside the directory rating_test_app/App.js you can find all the usage examples in the same file of the demo app.for customiconfilled and customiconoutline prop pass in the icon name from react-native-vector-icons/MaterialIcons.

Usage

Props

PropTypeDefaultDescription
colorString#900Required for default and custom icons,it'll be ignored if isurlpresent prop set to true
customiconfilledStringundefinedUsed for custom filled icon,it'll override default icons
customiconoutlineStringundefinedUsed for custom outline icon,it'll override default icons
defaultrateNumber0Default rate for filled icons and it's required
filledurlUriundefinedUri string for filled png / svg icons to be used, this will work if isurlpresent prop set to true.
isurlpresentBooleanfalseUsed for custom image icons,
maxratingNumber5Maximum icons or ratings to be rendered
modeStringstarUsed for defaults mode options can be either 'star' or 'heart'
onChangeRatefunctionundefinedIt's required for handling change in icons and is required
outlineurlUriundefinedUri string for outline png / svg icons to be used, this will work if isurlpresent prop set to true.
parentstyleStyleflexDirection:'row'This style will apply to total component, use this for handling parent View of the component
sizeNumber30Will be used for changing size of the icons, ignored if isurlpresent set to true
styleStyleundefinedStyle for icons,for ex margin:2, this will render icons with margin of 2.
keyNumberundefinedkey prop,

Advanced Example

import React, { useState } from "react";
import Rating from "rn-rating-component";

export const Rn_Rating_Component_Example = () => {
  const [rate, setRate] = useState(null);
  
  console.log(rate);

  return (
    <Rating
      maxrating={5}
      onChangeRate={setrate}
      defaultrate={rate}
      isurlpresent={true}
      filledurl=""
      outlineurl=""
    />
  );
};

Demo App Installation

cd rating_test_app
npm install --save
npx react-native start
npx react-native run-android

Contributing

Contributions are always welcome! Please adhere to this project's code of conduct.

Support

For support, email raghavyuva@gmail.com

Keywords

react-native

FAQs

Package last updated on 17 Aug 2021

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