Socket
Socket
Sign inDemoInstall

react-native-radio-button-group

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-radio-button-group

Simple and handy animated Radio group button for React Native


Version published
Weekly downloads
48
decreased by-49.47%
Maintainers
1
Install size
426 kB
Created
Weekly downloads
 

Readme

Source

react-native-radio-button-group

Simple and handy animated Radio group button for React Native in Android and IOS

npmnpm

NPM

Demo

DemoDemo .DemoDemo

Installation

in Cli

npm i react-native-radio-button-group --save

            OR

yarn add react-native-radio-button-group

Getting started

import RadioGroup from 'react-native-radio-button-group';


var radiogroup_options = [
  {id: 0, label: 'Button1' },
  {id: 1, label: 'Button2' },
  {id: 2, label: 'Button3' },
  {id: 3, label: 'Button4' },
];

var RadioGroupProject = React.createClass({
  getInitialState: function() {
    return {
        selectedOption: null,
    }
  },
  render: function() {
    return (
      <View>
            <RadioGroup
                  options={radiogroup_options}
                  onChange={(option) => this.setState({selectedOption: option})}
            />
      </View>
    );
  }
});

Props

KeyTypeDefaultValue
optionsArray[ ]Option
horizontalBooleanfalsetrue / false
activeButtonIdString / Number_option id from the given options array
onChangefunction_callback function
circleStyleObjectCircleStyleCircleStyle with even more properties as required.
Option
{
    id: number | string,
    label: string,
    labelView: Element
}
CircleStyle
{
    width: 22,
    height: 22,
    borderColor: '#000',
    borderWidth: 0.8,
    marginRight: 10,
    fillColor: '#279315'
}

Note : 'fillColor' used to change the background color of the circle on select.

Usage

horizontal

Demo

<RadioGroup
      horizontal
      options={radiogroup_options}
/>
label as view

Demo

<RadioGroup
      options={[
        {
              id: 0,
              labelView: (
                <Text style={{flex: 1}}>
                  Button label as <Text style={{ color: 'red' }}>View</Text>
                </Text>
              ),
        },
        { id: 1, label: 'Button2' },
        { id: 2, label: 'Button3' },
      ]}
      activeButtonId={0}
/>
customized button

Demo

<RadioGroup
      horizontal
      options={[
        {
              id: 0,
              labelView: (
                <Text>
                  Button label as <Text style={{ color: 'red' }}>View</Text>
                </Text>
              ),
        },
        { id: 1, label: 'Button2' },
        { id: 2, label: 'Button3' },
      ]}
      activeButtonId={0}
      circleStyle={{ fillColor: 'pink', borderColor: 'cyan' }}
/>

License

MIT

Keywords

FAQs

Last updated on 18 Oct 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc