반응식 네이티브로 Listview를 만들려고하는데 각 행마다 확인란과 본문이 있습니다. 이렇게하려면 nativebase 패키지를 사용하고 있습니다. http://nativebase.io/docs/v2.0.0/components#checkboxReact 네이티브 목록보기
확인란을 클릭하면 상태가 false로 변경되지 않습니다. 몇 가지 문제가 있습니다. 체크 박스를 클릭하면 본문 텍스트의 값을 어떻게 얻을 수 있습니까?
import React, { Component } from 'react';
import { Container, Content, List, Body, ListItem, Text, CheckBox } from 'native-base';
class ListExample extends Component {
state = {
pressed: true,
value: ""
};
onCheckBoxPress() {
console.log(this);
this.setState({ pressed: false});
this.setState({ value: BODYVALUE});
}
render() {
var items = [ "test1", "test2", "test3", "test4", "test5", "test6" ];
return (
<Container>
<Content>
<List dataArray={items} renderRow={(data) =>
<ListItem>
<CheckBox onPress={this.onCheckBoxPress.bind(this)} checked={this.state.pressed} />
<Body>
<Text>{data}</Text>
</Body>
</ListItem>
} />
</Content>
</Container>
);
}
}
export default ListExample;
나는 동일한 문제, 모든 해결책 lolix가 있는가? – neelima