leecade / react-native-swiper

The best Swiper component for React Native.
MIT License
10.4k stars 2.34k forks source link

undefined is not an object (evaluating'_this.internals.offset[dir]') #583

Open mescalchuan opened 6 years ago

mescalchuan commented 6 years ago

Which OS ?

Android

Version

Which versions are you using:

Describe

I'm developing a shopping website. On the goods description page,I used swiper. Goods description page can jump to the shopping cart page (navigator.push) and shopping cart page can jump to the goods description page too (infinite stack). The problem is that when there are more than one swiper in the stack, the code prompts "undefined is not an object" in 'updateIndex' function.

problem

DevSzurmanski commented 6 years ago

Sup. I had a very similar problem, but my swiper just swiped correctly, but I had an error same as yours. If everything works ok, but the problem is just an error you can use not so gentle way to null it. In the "updateIndex" method wrap the content in if(this.internals.offset){##content}. This validator helped me get rid off this error. In my case it worked on 2 android devices. On ios I have a problem with scrolling to index, so right now I'm not sure about it.

arribbar commented 6 years ago

Can you try with the latest version, 1.5.13 ? If it does it again, can you fork this project and reproduce the bug in the examples ?

ejkkan commented 6 years ago

+1, Any news on this?

RN 48.4 react-native-swiper 1.5.9

liuzhe429 commented 6 years ago

I meet the same question

kunpark168 commented 6 years ago

I meet the same question :( please

KamranKhankhail commented 6 years ago

+1 react-native-swiper 1.5.13 RN 49.3

KamranKhankhail commented 6 years ago

reverting back to version 1.5.8, it's working fine.

kunpark168 commented 6 years ago

How can i know the vertion of my swiper? how to reverting back to version 1.5.8 ?

SephoraCode commented 6 years ago

+1 react-native-swiper 1.5.8 RN 48.0

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

hooonko commented 6 years ago

In my case, RN 0.49 react-native-swiper 1.5.13 In Android, problem caused by 'onLayout' event fired after this.swiper.scrollBy(...).. But react-native-swiper initialized in onLayout event phase.. So.. I solved this issue.. by..

  1. Add isSwiperLoaded state.. like this.state={..., isSwiperLoaded: false};
  2. attach onLayout listener like <Swiper onLayout={() => {this.setState({...this.state, isSwiperLoaded: true});} ... />
  3. call this.swiper.scrollBy(...) with some delay in componentDidUpdate like... componentDidUpdate(prevProps, prevState) { .. if (!this.state.isSwiperLoading) { setTimeout(() => { this.swiper.scrollBy(...); }, 200);

That's all. I hope someone helped.

jasonchou3 commented 6 years ago

can anybody help ?

ethanyuwang commented 6 years ago

Having the same problem here

wikieswan commented 6 years ago

@KamranKhankhail it works fine for me . thx

wikieswan commented 6 years ago

when i re-install 1.5.8 , the error gone,but swiper does not work. So i re-install 1.5.9, everything goes fine. yarn add react-native-swiper@1.5.9

gyf19 commented 6 years ago

@arribbar I meet the same question

yoyo0427 commented 6 years ago

I solve this problem.
node_modules/react-native-swiper/src/index.js 398 line add if(offset === undefined || this.internals.offset === undefined){ return; }

LukeChenyk commented 6 years ago

I meet the same question "react-native-swiper": "^1.5.13", "react-native": "0.51.0"

But after rebuild my project, it be resovle!!

Runtime007 commented 6 years ago

@yoyo0427 add this code, not crash, but can not swip auto. see thishttps://github.com/leecade/react-native-swiper/issues/521 there have another way to solve in comments

zhaoqigang commented 6 years ago

I solve this problem. "react-native-swiper": "https://github.com/Tennen/react-native-swiper.git", loop={this.state.dataList.length>1}

ZionChang commented 6 years ago

+1

evanjmg commented 6 years ago

+1 for slow devices - navigating out of view - need to protect against unmounting or it will crash the app

Andrfas commented 6 years ago

Same here. My app is in production, crashes for a lot of users because of this issue :(

djhr commented 6 years ago

facing same crash on android with version 1.5.13

wenkangzhou commented 6 years ago

Same question.

andrzey commented 6 years ago

+1

Is it safe to say that this repository is dead or have someone been successful in contacting @leecade ?

IliRusli commented 6 years ago

+1

2linziyi2 commented 6 years ago

I have the same problem on 1.5.13 com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 'n.internals.offset[e]') can anyone help me?

IliRusli commented 6 years ago

@2linziyi2

My plugin is currently pointing to this forked git repo that has the fix to this issue. So far I'm no longer getting this error. Hope this helps!

Doublezzz commented 6 years ago

我也有同样的问题,已经哭晕了

iamsoorena commented 6 years ago

Same

havinhthai commented 5 years ago

@zhaoqigang Your repo working with me. Thank you.

keshamtravels commented 5 years ago

I solve this problem. node_modules/react-native-swiper/src/index.js 398 line add if(offset === undefined || this.internals.offset === undefined){ return; }

Please implement this in the repo

djhr commented 5 years ago

@leecade @arribbar can any of you guys do something about this issue please...?

navata commented 5 years ago

I have same this issue. Please help me to fix it. Thanks Admin

zero8892084 commented 5 years ago

I have same this issue,it make me crazzy。

stockrel commented 5 years ago

+1 for me would be nice to have a fix please

farshidshahmoradi1996 commented 5 years ago

I have same issue with react native 0.58.6 !!!