Skip to content

Commit 0050e58

Browse files
psobhanloAugustoAleGon
authored andcommitted
fix init state for defualt value
1 parent 2fee37b commit 0050e58

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,18 @@ import MultiSelect from 'react-native-multiple-select';
3939
class MultiSelectExample extends Component {
4040

4141
state = {
42-
selectedItems = [];
42+
selectedItems : [];
4343
};
4444

45-
items = [{
45+
46+
onSelectedItemsChange = selectedItems => {
47+
this.setState({ selectedItems });
48+
};
49+
50+
render() {
51+
const { selectedItems } = this.state;
52+
53+
const items = [{
4654
id: '92iijs7yta',
4755
name: 'Ondo',
4856
}, {
@@ -71,12 +79,6 @@ class MultiSelectExample extends Component {
7179
name: 'Abuja',
7280
}];
7381

74-
onSelectedItemsChange = selectedItems => {
75-
this.setState({ selectedItems });
76-
};
77-
78-
render() {
79-
const { selectedItems } = this.state;
8082
return (
8183
<View style={{ flex: 1 }}>
8284
<MultiSelect

0 commit comments

Comments
 (0)