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

react-native-radio-buttons-group

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-radio-buttons-group - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "react-native-radio-buttons-group",
"version": "1.0.1",
"version": "1.0.2",
"description": "Simple and Best. An easy to use radio buttons for react native apps.",

@@ -5,0 +5,0 @@ "main": "index.js",

# React Native Radio Buttons Group
Simple and Best. An easy to use radio buttons for react native apps.
## Getting Started
### Installation
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
```
npm i react-native-radio-buttons-group --save
```
### Installing
### Getting Started
###### App.js
```
npm i react-native-radio-buttons-group --save
import React, { Component } from 'react';
import { Text, View, StyleSheet } from 'react-native';
import RadioGroup from 'react-native-radio-buttons-group';
export default class App extends Component {
state = {
// Below mention objects explains different props supported by radio button
radioButtons: [
{}, // empty object will create radio button with default values
{
label: 'Selected',
selected: true,
},
{
label: 'With just a label',
},
{
label: 'Value is different',
value: "I'm not same as label",
},
{
label: 'Color',
color: 'green',
},
{
disabled: true,
label: 'Disabled',
},
{
label: 'Size',
size: 32,
},
{
label: 'Layout column',
layout: 'column',
},
],
};
// update state
onPress = radioButtons => this.setState({ radioButtons });
// output
onSubmit = () => {
const selectedButton = this.state.radioButtons.find(e => e.selected == true).value;
alert(selectedButton);
};
render() {
return (
<View style={styles.container}>
<RadioGroup
radioButtons={this.state.radioButtons}
onPress={this.onPress}
/>
<Text style={styles.submit} onPress={this.onSubmit}>Submit</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
submit: {
borderWidth: 1,
borderRadius: 4,
paddingHorizontal: 100,
paddingVertical: 10,
},
});
```
### Default
### Default object of radio button
```

@@ -29,12 +107,15 @@ {

```
color
disabled
label
layout
selected
size
value
Props Data Type Valid Values
-----------------------------------------------------
color String < all css formats >
disabled Boolean true/false
label String
layout String row/column
selected Boolen true/false
size Number < positive numbers >
value String < mention value if you want to give different value other than 'label'>
```
### TODO
- animation

@@ -48,2 +129,2 @@

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
This project is licensed under the [MIT License](https://github.com/ThakurBallary/react-native-radio-buttons-group/blob/master/LICENSE)
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