为什么从Firestore'9'而不是img url来获得redux存储的对象属性值?

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

当屏幕加载到我的本机应用程序中时,我使用redux存储库中的url(由firestore读取操作填充(存储在firebase-storage中的图像)作为图像组件的源。如果创建图像的源道具,例如source={{ui:this.props.someURL}},则会得到

TypeError: NSNull cannot be converted to NSString

好吧,我知道这是关于图像来源道具的已知问题。我尝试使用以下方法修复它:

source={{ 
  uri: this.props.profileImg == null ?
  require('../assets/img/white-user.png') : 
  this.props.profileImg
}}

然后我从问题标题中得到了错误:JSON value '9' of type NSNumber cannot be converted to NSString如果我完全删除了有问题的图像组件,则没有错误。

构造函数内部this.props.someURL的记录值= null

this.props.someURL内部的componentDidMount()的记录值=空

正如预期的那样,因为值由承诺填充。那么为什么JSON value of '9'错误?这仅在iOS中

当屏幕加载到我的本机应用程序中时,我使用redux存储库中的url(由firestore读取操作填充(存储在firebase-storage中的图像)作为图像组件的源。如果我...

react-native react-redux firebase-storage react-native-ios
1个回答
0
投票

您可以替换源道具

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