Javascript 对象作为react子对象无效(找到:TypeError:filepath.includes不是函数)

Javascript 对象作为react子对象无效(找到:TypeError:filepath.includes不是函数),javascript,firebase,react-native,firebase-storage,react-native-fetch-blob,Javascript,Firebase,React Native,Firebase Storage,React Native Fetch Blob,当我尝试使用react native fetch blob在firebase存储中上载照片时,遇到了这个问题! 这是上载文件的代码 uploadImage=(uri、imageName、mime='image/jpg')=>{ 返回新承诺((解决、拒绝)=>{ const uploadUri=uri 让uploadBlob=null const imageRef=firebase.storage().ref('posts').child(imageName) fs.readFile(上传URI,

当我尝试使用
react native fetch blob
在firebase存储中上载照片时,遇到了这个问题! 这是上载文件的代码

uploadImage=(uri、imageName、mime='image/jpg')=>{
返回新承诺((解决、拒绝)=>{
const uploadUri=uri
让uploadBlob=null
const imageRef=firebase.storage().ref('posts').child(imageName)
fs.readFile(上传URI,'base64')
。然后((数据)=>{
返回Blob.build(数据,{type:`${mime};BASE64`})
})
.然后((blob)=>{
uploadBlob=blob
返回imageRef.put(blob,{contentType:mime})
})
.然后(()=>{
uploadBlob.close()文件
返回imageRef.getDownloadURL()
})
。然后((url)=>{
解析(url)
})
.catch((错误)=>{
拒绝(错误)
})
})
}
这是调用函数uploadImage的代码:

this.uploadImage(this.state.avatarUri.uri,userId)。然后((imageURL)=>{
saveDatabase(用户ID、imageURL)
}).catch((错误)=>{
这是我的国家({
错误,
孤岛加载:false
})
})
从imagepicker库中设置化身,如下所示:

openCamera=()=>{
ImagePicker.launchImageLibrary({},(响应)=>{
if(response.didconcel){
}else if(response.error){
this.state.imageError=response.error
console.log('ImagePicker错误:',this.state.imageError);
}else if(response.customButton){
console.log('用户点击自定义按钮:',response.customButton);
}否则{
这是我的国家({
阿瓦塔鲁里:{
uri:response.uri
},
imgPath:response.imgPath,
错误:“”
});
}
});
}
错误屏幕截图如下:

编辑 渲染功能如下所示:

        this.state.isLoading ? 
            <Spinner style={{flex:1, alignSelf: 'center'}} color='blue' />
        :
        <Container>
        <Content style={{margin:20}}>

            <Item>
                <Icon type="FontAwesome" active name='user' style={{ color :'#c5aa6a'}} />
                <Input 
                    placeholder='Email' 
                    onChangeText= { (text)=> { this.setEmailText(text) } } 
                    value={this.state.email}/>
            </Item>

            <Item>
                <Icon type="FontAwesome" active name='key' style={{ color :'#c5aa6a'}} />
                <Input 
                    secureTextEntry 
                    placeholder='Password'
                    onChangeText= { (text)=> { this.setPasswordText(text) } } 
                    value={this.state.password}
                    />
            </Item>

            <Item>
                <Icon type="FontAwesome" active name='key' style={{ color :'#c5aa6a'}} />
                <Input 
                    secureTextEntry 
                    placeholder='Confirm Password'
                    onChangeText= { (text)=> { this.setRePasswordText(text) } } 
                    value={this.state.re_password}
                    />
            </Item>

            <Button bordered success  style={{ justifyContent: 'center', marginTop: 20}} onPress = { ()=> this.verifyCredentials() } >
                <Text style={{color:'#c5aa6a'}}>Sign Up</Text>
            </Button>

            {
                !this.state.avatarUri ?
                <Icon type="FontAwesome" active name='user-circle' style={styles.photoPicker} onPress= { ()=> this.openCamera() } /> :
                <Image style={styles.avatarPicked}  source= {  this.state.avatarUri }  />

            }

            { 
                this.state.error ? 
                    <Text style= {{ color: '#ff0000', alignSelf: 'center', marginTop: 30}}>    {this.state.error}  </Text>
                    :
                    null
            }

        </Content>

        <Button transparent onPress={() => this.props.navigation.navigate('login')} style={styles.buttonStyle} >
            <Text style={{color:'#c5aa6a'}}>I already have an account</Text>
        </Button>

        </Container>
this.state.isLoading?
:
{this.setEmailText(text)}
值={this.state.email}/>
{this.setPasswordText(text)}
值={this.state.password}
/>
{this.setRePasswordText(text)}
值={this.state.re_password}
/>
此.verifyCredentials()}>
注册
{
!这个州,阿瓦塔鲁里?
this.openCamera()}/>
}
{ 
这个.状态.错误?
{this.state.error}
:
无效的
}
this.props.navigation.navigate('login')}style={style.buttonStyle}>
我已经有账户了

我认为该函数没有问题,但渲染函数有问题。检查你的渲染函数,看看你试图从你的状态渲染什么。更新了我的渲染函数!