Reputation: 285
I make tests on React Native. I use react-native-paper
for this. This is my code:
{(!props.question.isSingleAnswer && props.question.answers.length) &&
<View>
{props.question.answers.map((item) => (
<List.Item
key={item.id.toString()}
title={item.title}
left={checkProps => <Checkbox {...checkProps} status='unchecked' onPress={() => addAnswer(props.question, item)}/>}
/>
))}
</View>
}
But I can't check checkboxes. The same problem with radio buttons.
Why does it happen and how can I fix it?
UPD: the problem was solved. Question is closed.
Upvotes: 0
Views: 457
Reputation: 308
It is because you have the status
of your checkbox to always unchecked
, whereas you should always set status
of your checkbox to anything dynamic for eg use a state.
I don't know what your addAnswer
function does so have a look at this example for reference.
Upvotes: 1