react native 踩坑记

react native 碰到的几个坑。记录如下。

1.com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 'n.internals.offset[e]'), stack:

updateIndex@728:3247

onScrollEnd@728:2792

<unknown>@728:4023

<unknown>@23:1787

解决办法:

更改文件   node_modules/react-native-swiper/src/index.js 398 line add
if(offset === undefined || this.internals.offset === undefined){ return; }

———————————————————

2. react-native 调试的时候会有报错:日志Attempted to transition from state `RESPONDER_INACTIVE_PRESS_IN` to `RESPONDER_ACTIVE_LONG_PRESS_IN`, which is not supported. This is most likely due to `Touchable.longPressDelayTimeout` not being cancelled.

reactConsoleErrorHandler @ ExceptionsManager.js:71

扫描二维码关注公众号,回复: 4201949 查看本文章

console.error @ YellowBox.js:61

_handleLongDelay @ Touchable.js:596

解决办法:

My practical solution was to edit react-native source code at:

node-modules/react-native/Libraries/Components/Touchable/Touchable.js

Here I've changed "console.error" to "console.log" at line 628, this way I receive the message, however my app is not interrupted and the error is "dissmissed"

3.react native 类似安卓的viewpage 轮播图片的时候,应用的控件有报错,cannot read property x of undefined react native  。android 某些机型轮播无限滚动情况。

解决办法:

node_modules/react-native-swiper/src/index.js 171 line add

更改为:autoplayTimeout: 3,

可以避免cannot read property x of undefined react native 这个报错,但实际上并没有完全解决有些机型比如魅族,速度超快无限轮播的情况。

猜你喜欢

转载自blog.csdn.net/kdsde/article/details/83416237