今天发生了一个很奇怪的RN错误
undefined is not an object(evaluating 'this._component.getScrollableNode')
完全没有线索,通过排除法发现了是在
<DrawerLayout的UserCenterView中发生了错误
UserCenter在加载完毕后会调用componentDidMount方法,其中调用了AsyncStorage方法。而UserCenter中并没有引用AsyncStorage进来,把AsyncStorage引入后问题解决
这个问题的触发提示很奇怪。完全想不到是这样造成的。mark一下
本文记录了一次解决React Native中出现的“undefined is not an object”错误的过程。该错误发生在DrawerLayout的UserCenterView组件中,最终发现是因为UserCenter组件内的componentDidMount方法尝试调用未被引入的AsyncStorage模块导致。

被折叠的 条评论
为什么被折叠?



