react-native - 我无法显示 ActivityIndicator
问题描述
所以这是我的代码:
const imageSource = autoData.imgSource ? autoData.imgSource : autoData.downloadURL;
return (
<View style={styles.main}>
(!imageSource? <ActivityIndicator size="large" /> :
<Image source={imageSource} style={styles.image} />
)
</View>
所以基本上我想显示那个微调器,如果我没有得到任何信息
Invariant Violation: Text strings must be rendered within a <Text> component.
解决方案
你试试braces
。
如果你的图片是uri,你应该如下使用它:
<Image
source={{
uri: 'https://facebook.github.io/react/logo-og.png',
}}
style={{ width: 400, height: 400 }}
/>
用法
const imageSource = autoData.imgSource ? autoData.imgSource : autoData.downloadURL;
return (
<View style={styles.main}>
{!imageSource ? (<ActivityIndicator size="large" />) :
(<Image source={{ uri:imageSource }} style={styles.image} />)
}
</View>
推荐阅读
- javascript - Javascript:为什么警报说未定义而不是字母“k”
- android - Chrome Mobile 失去了主题颜色
- google-apps-script - 如何使用 GAS 发送与聊天机器人一起使用的 http POST 响应
- excel - 发送到邮件正文时如何保持表格列中的超链接可点击?
- sapui5 - 为什么我在 sapUI5 中收到日期格式错误?
- python - Python 单元测试补丁函数 - 避免将模拟函数传递给测试函数
- c# - 将类类型作为参数传递,共享基类属性和方法
- seaborn - 如何调整 seaborn swarmplot 中的透明度(alpha)?
- python - 如何使用 Numba 将正确的数据类型传递给类?
- python - 损坏的 DAG:[/home/airflow/gcs/dags/cdp/xox/cdp_box_audit.py] 没有名为“dags.box”的模块