checkbox
, and I would like to check which checkbox
is selected after clicking the button.
import React, {
Component
} from 'react';
import {
Platform,
StyleSheet,
Text,
View,
ScrollView,
CheckBox
} from 'react-native';
import Checkbox from 'react-native-custom-checkbox';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
checked: false,
check: []
};
}
_myFunction(value, name, checked) {
console.log("Log: " + value, checked);
};
clickButton() {
}
render() {
let checkboxes = [];
for (let i = 0; i < 5; i++) {
checkboxes.push( <
View >
<
Checkbox
name = 'checkbox2'
checked = {
false
}
size = {
30
}
style = {
{
backgroundColor: '#f2f2f2',
color: 'blue',
borderRadius: 5
}
}
onChange = {
(name, checked) => this._myFunction(name, i, checked)
}
/> <
/View>
);
}
return ( <
View >
<
Button onPress = {
() => this.clickButton()
} > < /Button> {
checkboxes
}
<
/View>
);
}
}
Someone could help me