【发布时间】:2016-06-01 16:47:39
【问题描述】:
我很难从 SectionHeader 访问 ref。我知道我需要使用 ref 作为回调函数而不是字符串,但我不明白如何实现它。
render(){
return (
<ListView
ref="mylist"
dataSource={this.state.dataSource}
renderRow={this.renderCampaign}
style={styles.listView}
renderSectionHeader={this.header.bind(this)}
onChangeVisibleRows={this.updateFocus.bind(this)}/>
);
}
}
header(data){
return(
<MapView
ref="mymap"
style={styles.map}
region={this.state.region}
onRegionChange={this.onRegionChange.bind(this)}
showsUserLocation={true}
>
{this.state.markers.map(marker => (
<MapView.Marker
coordinate={marker.coordinate}
title={marker.name}
description={marker.reward_type}
/>
))}
</MapView>
);
}
有人可以帮忙吗?
【问题讨论】:
标签: javascript reactjs react-native ecmascript-6