From 1287e20b9adf2eb6e7fb694e8a095dd6fd0f7b7e Mon Sep 17 00:00:00 2001 From: AnasMSN <mahasin.anas@gmail.com> Date: Wed, 16 Oct 2019 17:33:06 +0700 Subject: [PATCH] clear documentation --- README.md | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 29edc11..8191477 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,88 @@ -# react-natvie-ossd-radio-button +# react-native-ossd-radio-button Customizable React Native Radio Button -### React Native OSSD Radio Button Checklist + +## How to install +Use the package manager npm to install react-native-ossd-radio-button. + +```bash +npm i react-native-ossd-radio-button +``` + +## Usage + +Import RadioList from 'react-native-ossd-radio-button' + +```javascript +import { RadioList } from 'react-native-ossd-radio-button' +``` + +create the data for the application to render in a list with this kind of format, the icon format is optional. + +```javascript + +const radioDatas = [ + { + text: "Promo sudah tidak aktif/sudah habis periodenya", + iconUrl: require("./assets/icons/unactive_promo.png") + }, + { + text: "Lokasi promo salah", + iconUrl: require("./assets/icons/wrong_location.png") + } +] + +``` + +Define the state that will save the choosen radio and add this callback function to the radio button + +```javascript + +onChangeState(text, radioState) { + this.setState({ text: text, radioState: radioState }) +} + + + +``` + + +```javascript + +<RadioList + onChangeState={this.onChangeState.bind(this)} + radioState={this.state.radioState} +/> + + +``` + + +## Props for Radio List + +| Props | Type | Function | +| ------ | ------ | ------ | +| radioState | string | state that can be retrieved outside the component | +| radioDatas | List | List of text data and image (optional) to be shown when component rendered | +| imageShow | boolean | show/hide the image | +| width | number |width of radio button item | +| height | number | height of radio button item | +| activeColor | string | Color of the radio button when clicked | +| defaultColor | string | Default color when radio button not clicked | +| textColor | string | Color of the text of radio button | +| borderColor | string | Radio button border color | +| borderWidth | number | border width | +| justifyContent | string | Radio button alignment | +| imageColor | string | Tint color of image | + +## Callback for Radio List + +| Callback | Function | +| ------ | ------ | +| onChangeState | callback for change the state of choosen value | + + +## React Native OSSD Radio Button TODO List - [x] Create new repository and first commit - [x] Learn about npm and how to publish to it @@ -19,4 +100,5 @@ Customizable React Native Radio Button - [x] Radio Button image can tint color - [ ] create new type of radio button with textInput - [ ] customizable textInput -- [ ] Create documentation \ No newline at end of file +- [ ] Create documentation + -- GitLab