Skip to content

Commit f9849f9

Browse files
author
Sibtain Ali
committed
feat(#67): Moved checkbox to a user defined function.
1 parent 1784869 commit f9849f9

File tree

7 files changed

+9888
-304
lines changed

7 files changed

+9888
-304
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ Prop | Type | Optional | Default | Description
181181
`customSelector` | node | Yes | undefined | Render a custom node instead of the built-in select box.
182182
`initSelectedKeys` | array<any> | Yes | [] | Key of the items to be initially selected. Should contain only one key if `multiple` is selected as false.
183183
`multiple` | bool | No | false | Adds the ability to select multiple options.
184+
`renderCheckbox` | function | No | (checked, onPress) => {} | Function that returns a checkbox element. Arguments of the function include `checked` state and `onPress` function that gets executed when the element is pressed.
184185

185186
### Methods
186187

SampleApp/App.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
import React, {Component} from 'react';
44

55
import {View, Text, TextInput, Switch} from 'react-native';
6+
import {CheckBox} from 'react-native-elements';
7+
8+
import Icon from 'react-native-vector-icons/FontAwesome';
69

710
import ModalSelector from 'react-native-modal-selector';
811

12+
Icon.loadFont();
13+
914
class SampleApp extends Component {
1015
constructor() {
1116
super();
@@ -53,6 +58,9 @@ class SampleApp extends Component {
5358
<ModalSelector
5459
data={data}
5560
multiple={true}
61+
renderCheckbox={(checked, onPress) => (
62+
<CheckBox onPress={onPress} checked={checked} />
63+
)}
5664
initValue="Select something yummy!"
5765
onChange={option => {
5866
alert(`${JSON.stringify(option)} nom nom nom`);

SampleApp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Use [nodemon](https://github.com/remy/nodemon) to keep the module in sync with `
1414

1515
```
1616
$ npm install
17-
$ react-native run-[ios|android]
17+
$ npx react-native run-[ios|android]
1818
$ npm run nodemon
1919
```
2020

0 commit comments

Comments
 (0)