1.0.17 • Published 4 years ago

@pratap2210/react-native-radio-button v1.0.17

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

React Native Radio Button

Simple Radio and RadioGroup button for React Native App which supplort single select and multiple select.

Installation

using npm

npm i @pratap2210/react-native-radio-button

using yarn

yarn add @pratap2210/react-native-radio-button

Usage

This is format of input

      radioGroups: [
        {
          label: 'Shawshank Redemption',
          uniqueId: 'shawshankRedemption',
        },
        {
          label: 'The Godfather',
          uniqueId: 'theGodfather',
        },
        {
          label: 'The Dark Knight',
          uniqueId: 'theDarkKnight',
        },
        {
          label: 'Saving Private Ryan',
          uniqueId: 'savingPrivateRyan',
        },
        {
          label: 'Schindlers List',
          uniqueId: 'schindlersList',
        },
      ]
        <RadioButtonGroup radioButtons={radioGroups} radioGroupLabel={`How do you see this??`} onRadioGroupChange={this.handleRadioGroupChange} isMultiSelect={false}/>
handleRadioGroupChange = updatedRadioGroups => {
  console.warn("Updated Groups ", updatedRadioGroups);
  this.setState({
    radioGroups: updatedRadioGroups
  });
};

Outputs

Output if multiple is false

single

[{label:"Shawshank Redemption",uniqueId:"shawshankRedemption",selected:false},
{label:"The Godfather",uniqueId:"theGodfather",selected:false},
{label:"The Dark Knight",uniqueId:"theDarkKnight",selected:true},
{label:"Saving Private Ryan",uniqueId:"savingPrivateRyan",selected:false},
{label:"Schindlers List",uniqueId:"schindlersList",selected:false}}

Output if multiple is true

multiple

[
  { label: "Shawshank Redemption", uniqueId: "shawshankRedemption" },
  { label: "The Godfather", uniqueId: "theGodfather", selected: false },
  { label: "The Dark Knight", uniqueId: "theDarkKnight", selected: true },
  {
    label: "Saving Private Ryan",
    uniqueId: "savingPrivateRyan",
    selected: true
  },
  { label: "Schindlers List", uniqueId: "schindlersList" }
];

Configuration

Radio Group:
PropertyTypeDefaultDescription
sizenumber24Size of the radio button
thicknessnumber2width of radio button border
colorstring'#007AFF'color of radio button
isMultiSelectbooleanfalseis radio button multiple selectable
radioGroupLabelstringnullLabel for the Radio group
radioGroupLabelStyleobjectnullCustom styles to be applied if supplied
radioLabelStyleobjectnullCustom styles to be applied if supplied
radioStyleobjectnullCustom styles to be applied if supplied
styleobjectnullCustom styles to be applied if supplied
onRadioGroupChangeupdatedValuenullfunction to be invoked when radio button is selected or changed

Motivated from

How to implement radio button in React Native

Checkbox in react by Harshal

react-native-flexi-radio-button

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago