react-native-radio-button-android
v3.0.0
Published
Android native radio button
Downloads
22
Readme
React Native Radio button for Android
Native Android radio-button component, originally forked from here.
Installation
yarn add react-native-radio-button-android
// or with npm
npm i react-native-radio-button-android --save
// then link the native module, or use manual installation instructions
react-native link react-native-radio-button-android
// rebuild the project
react-native run-android
Usage
import RadioBtn from 'react-native-radio-button-android';
<Radio
value={this.state.isSelected}
disabled={this.state.isDisabled}
onChange={fullEvent => {
//do something
}}
onValueChange={isSelected => {
this.setState({
isSelected,
});
}}
/>;
Manual installation instructions
android/settings.gradle
:: Add the following snippet
include ':react-native-radio-button-android'
project(':react-native-radio-button-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-radio-button-android/android')
android/app/build.gradle
: Add in dependencies block.
dependences {
...
compile project(':react-native-radio-button-android')
}
android/app/src/main/java/com/<your_app>/MainActivity.java
: Import package and add to react list of packages.
import io.sichacvah.react.radio_button.RadioButtonPackage;
...
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
...
new RadioButtonPackage()
);
}