【发布时间】:2019-08-10 03:03:08
【问题描述】:
我想在 onPress 函数中访问 React Native 元素属性,我用 event.target 和 ReactNativeComponentTree 尝试过,但它不起作用,我想在 Onpress 函数中访问 audioPath 属性
<Ionicons
name="ios-play"
size={35}
color={this.state.playAudio ? "red" : "blue"}
style={{
left: 90,
position: "relative",
shadowColor: "#000",
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.5,
backgroundColor: "transparent"
}}
audioPath= {audioPath}
onPress={this.audioPathFunction.bind(this)}
/>
【问题讨论】:
-
请提及所有场景
-
实际上我想渲染多个 ioniIcons 但问题是它们都具有相同的值我希望 ioniIcons 保持其自己的 audiopath 值,您要求的方法在我渲染时为所有 ioniIcons 赋予相同的值多次
-
所以你有多个audioPath?
-
是的,其实它是一个语音聊天应用,每个录音都有不同的路径,
-
你有audioPath数组吗?
标签: javascript reactjs react-native