액세스하는 방법 레디 네이티브 listview 하위 구성 요소를 사용 하시겠습니까?참조를 통해 반응 네이티브 listview 하위 구성 요소에 액세스하는 방법?
class MyComponent extends Component {
constructor() {
super();
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(['row 1', 'row 2', 'row 3', 'row 4', 'row 5', 'row 6']),
};
}
onTap() {
console.log(this.refs)
/* After getting touchComponent refs below block of code has to be executed.
that.refs.touchComponent.measure((ox, oy, width, height, px, py) => {
this.setState({
isVisible: true,
buttonRect: {x: px, y: py, width: width, height: height}
});
});
*/
}
render() {
return (
<ListView ref="listView"
dataSource={this.state.dataSource}
renderRow={(rowData) => <TouchableHighlight ref="touchComponent" onPress={this.onTap.bind(this)}><Text>{rowData}</Text></TouchableHighlight>}
/>
);
}
}
console.log(this.refs)
인쇄 내가 TouchableHighlight
구성 요소 심판에 액세스 할 수있는 방법을Object {listView: Object}
?
나는 React Native: Refs in ListView 및 React Native - get refs of custom components in listview from renderRow를 통과하지만 난 그들이 무엇을하는지 이해하지 않습니다.