0
Hello, I have the following problem I have a list of checkbox
, and 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>
);
}
}
Could someone help me
Cara valeu gave to do in Act Native helped me a lot
– Jacob de Oliveira