Javascript 如何在平面列表中打印图像组件?自然反应
我有一个目标:Javascript 如何在平面列表中打印图像组件?自然反应,javascript,react-native,Javascript,React Native,我有一个目标: const new_note = { note_number: last_note, //create a new_note object, note_number will be the key for each note content: this.state.content, color: this.state.default_color,
const new_note = {
note_number: last_note, //create a new_note object, note_number will be the key for each note
content: this.state.content,
color: this.state.default_color,
text_color: this.state.color,
uri: this.uri,
real_content: clear_real_content,
images_uri: this.images_uri,
};
其中this.uri是图像组件:
this.uri=代码>
并将其打印到平面列表中:
<FlatList
data = {this.props.array_notes}
renderItem = {({item}) => (
<TouchableOpacity
onLongPress = {() => this.show_hide_popup_menu(item)}
onPress = {() => this.select_edit(item)}
activeOpacity = {0.9}>
<View style = {this.styles.notes_container(dark, notes_backgroundColor, item)}>
{item.uri}
</View>
</TouchableOpacity>)}
contentContainerStyle = {{flexGrow:1}}>
</FlatList>
(
显示\隐藏\弹出\菜单(项目)}
onPress={()=>this.选择编辑(项目)}
activeOpacity={0.9}>
{item.uri}
)}
contentContainerStyle={{flexGrow:1}}>
但我得到了这个错误:
您只能设置uri
而不是Image
对象中的new\u note
元素
const new_note = {
note_number: last_note,
content: this.state.content,
color: this.state.default_color,
text_color: this.state.color,
// uri: this.uri, <-- change this line as below
uri: clear_content,
real_content: clear_real_content,
images_uri: this.images_uri,
};
const new\u注释={
注释编号:最后一个注释,
内容:this.state.content,
颜色:this.state.default\u颜色,
文本颜色:this.state.color,
//uri:this.uri,this.select_edit(item)}
activeOpacity={0.9}>
)}
contentContainerStyle={{flexGrow:1}}>
是的,我是这样做的,但是当我在上一张图片之前设置上一张图片,但它不起作用时,您可以共享更多的代码,以便我更好地了解您在做什么吗?
<FlatList
data = {this.props.array_notes}
renderItem = {({item}) => (
<TouchableOpacity
onLongPress = {() => this.show_hide_popup_menu(item)}
onPress = {() => this.select_edit(item)}
activeOpacity = {0.9}>
<View style = {this.styles.notes_container(dark, notes_backgroundColor, item)}>
<Image source={{ uri: item.uri }} style={{ width: 50, height: 50 }}/>
</View>
</TouchableOpacity>)}
contentContainerStyle = {{flexGrow:1}}>
</FlatList>