node.js - React Native ERROR Invalid call require(imagePath)
问题描述
实际上我有一个问题,我正在尝试将路径图像发送到组件道具中,但程序无法正常工作。错误是“第 10 行的无效调用:require(imagePath)”
向组件发送道具:
<ImageTopRegister titleText ="Bienvenido a Sparkit" descriptionText ="Ingresa tus datos personales" imagePath= "../../../assets/images/RegisterName.png" />
零件:
const ImageTopRegister = props =>{
return (
<ImageBackground style={styles.imageBackground} source={ require(props.imagePath)}>
<View style={styles.sparkitContainer}>
<Text style={styles.sparkitText}>Sparkit</Text>
</View>
<View style={styles.textContainer}>
<Image style={styles.imageSparkit} source={ require('../../../assets/images/sparkiticon.png')}/>
<Text style={styles.titleText}>{props.titleText}</Text>
<Text style={styles.descriptionText}>{props.descriptionText}</Text>
</View>
</ImageBackground>
);
};
解决方案
推荐阅读
- google-app-engine - 客户端连接到 Google App Engine 时出现随机 ERR_CONNECTION_CLOSED 错误
- pandas - pandas 数据框作为嵌入文档插入到 MongoDB(目录列表)
- javascript - Redux,React:Instagram 故事克隆 - 无法在故事之间切换
- javascript - 如何使用 php 在选择选项搜索中传递项目 id url?
- java - 如何在流 groupby 中传递 Java 8 中的函数参数
- reactjs - 下载的文件在 react-Js 中损坏,它从 Spring Boot 获取数据
- email - SpamAssassin 标志“RAND_MKTG_HEADER”的含义尚不清楚
- opencv - 在 opencv 中为推理引擎后端设置 KEY_CPU_BIND_THREAD
- php - PHP - 将文件上传到目录并将文件扩展名添加到底部时的随机文件名?
- azure - 如何从 azure synapse 中的数据库中读取表并将其写入默认值(spak)?