通过道具反应的本机图像源问题[关闭]

问题描述 投票:0回答:1

我正在构建一个应用程序。

enter image description here

图像路径来自数据库,我想直接将其传递给img我没有输出。我如何在图像源或任何其他替代物中使用道具,以便我可以传递图像URIenter image description here

reactjs react-native firebase-realtime-database react-redux
1个回答
0
投票

如果知道图像的路径,则无需将图像传递到其他组件。

在您的组件中,将图像传递为

<Adds img= {require('./Images/codify.png')}/>

并且在您的Adds组件中将其用作

<Image source={this.props.img} />

希望这会有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.