【发布时间】:2019-02-04 00:27:23
【问题描述】:
这是我的商店课程
.........
从'./utils/Loader'导入Loade;
导出默认类存储扩展组件 {
.................
render() {
return (
<View style={{ flex: 1, backgroundColor: "white" }}>
<Loader ref={"loaderRef"}/>
...........................
当我从我的商店课程中拨打 this.refs.loaderRef.hide(); 时
遇到这样的错误 undefined 不是对象(评估 'this.refs.loaderRef.hide')
我是 react native 的新手,谁能帮帮我?
【问题讨论】:
-
什么时候出现这个错误?点击某个功能?
-
响应发布请求..... .then((response) => response.json()) .then(async (responseJson) => { this.refs.loaderRef.hide (); }
-
能否再添加一些代码?
-
await fetch('' + aws_data.path + aws_data.stage + aws_lamda.contentmanagement, { method: 'POST', headers: { Accept: 'application/json', 'Content-Type': 'application/json', 'Authorization':acceestoken }, body: JSON.stringify(reqobj), }).then((response) => response.json()) .then(async (responseJson) => { ...... }) this.refs.loaderRef.hide(); }) .catch((error) => { this.refs.loaderRef.hide(); console.error(error); });
标签: react-native ref