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

rn-radio-button

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-radio-button

Simple and customizable React Native Radio Button

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rn-radio-button

Simple Radio Button Component for React Native - iOS and Android

npm

rn-radio-button

simple and useful radio button component for React Native

image info

Installation

npm i rn-radio-button --save

Getting Started

import React, { useState } from "react";
import { SafeAreaView, Text, View } from "react-native";
import RadioButton from "rn-radio-button";

const App = () => {
  console.log(RadioButton);
  const [val, setVal] = useState("-");

  function pressCircle(i) {
    setVal(i);
  }

  return (
    <>
      <SafeAreaView style={{ backgroundColor: "#085b7c", flex: 0 }} />
      <SafeAreaView style={{ flex: 1, marginHorizontal: 10 }}>
        <RadioButton
          outerWidth={30}
          innerWidth={20}
          borderWidth={1}
          data={listData}
          color={"steelblue"}
          onPress={pressCircle}
          wrapperStyle={{ padding: 3 }}
        />
        <View
          style={{
            marginHorizontal: 10,
            marginVertical: 10,
            alignItems: "center"
          }}
        >
          <Text>{"clicked item value is: " + val}</Text>
        </View>
      </SafeAreaView>
    </>
  );
};

const listData = [
  { label: "First", value: 1 },
  { label: "Second", value: 2 },
  { label: "Fifth", value: 5 },
  { label: "Sixth", value: 6 }
];

export default App;

Basic Usage of rn-radio-button

<RadioButton
  data={listData}
  color={"steelblue"}
  onPress={val => console.log(val)}
  wrapperStyle={{ padding: 3 }}
/>

Advanced Usage of rn-radio-button

<RadioButton
  data={listData}
  outerWidth={30}
  innerWidth={20}
  borderWidth={1}
  color={"steelblue"}
  onPress={val => console.log(val)}
  wrapperStyle={{ padding: 3 }}
/>

Parameters of rn-radio-button

PropertyTypeDefaultDescription
dataarray of objects[]Required
outerWidthinteger20define width of outer Circle ( optional )
innerWidthinteger10defined Width of inner Circle ( optional)
borderWidthinteger1define borderWidth of outer Circle
colorstring'steelblue'Define primary color for inner and outer Circle
onPressfunction-Define function for get value of selected radio button
wrapperStyleObject style-Styling for wrap outer side of Radio Button
horizontalbooleanfalsemake list of radio Button wrap Horizontally

Demo

- cd ExampleApp/ && npm install
- cd ios && pod install
- cd .. && react-native run-ios

Keywords

FAQs

Package last updated on 11 Apr 2020

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