react-native-swiper icon indicating copy to clipboard operation
react-native-swiper copied to clipboard

crash on android

Open slicejunk opened this issue 9 years ago • 10 comments

Which OS ?

android

Version

Which versions are you using:

  • react-native-swiper v1.5.10
  • react-native v0.47.1

Expected behaviour

no crash!

Actual behaviour

the app crashes due to this line:

  const state = this.state
  let index = state.index
  const diff = offset[dir] - this.internals.offset[dir]
  const step = dir === 'x' ? state.width : state.height
  let loopJump = false
...

because this.internals.offset is undefined

slicejunk avatar Aug 16 '17 10:08 slicejunk

moreover swiping the image cause an infinite and fast loop

slicejunk avatar Aug 16 '17 10:08 slicejunk

And ... I do not have this bug in my case and in any examples. Can you give us an example in which we can reproduce the bug ? Thanks !

arribbar avatar Aug 16 '17 13:08 arribbar

Same situation. Please help.

hbk671104 avatar Sep 06 '17 12:09 hbk671104

@slicejunk did you found the soluiton for this?

sidd123456 avatar Sep 07 '17 05:09 sidd123456

@slicejunk @hbk671104 Again, I do not have this bug. Check again with the last version, 1.5.11 and if you have a bug, fork the project and reproduce it one example. I cannot help you if you don't do that

arribbar avatar Sep 07 '17 07:09 arribbar

same here. I'm on 1.5.12 and the issue is present. The autoplay is true and autoplayTimeout is 4. Here is the code. The banner is a custom component made of View and Image, nothing fancy. <Swiper autoplay autoplayTimeout={4} height={height} style={styles.wrapper} activeDotColor={'red'} > {list.map((item, index) => <Banner key={index} item={item} />)} </Swiper> The height is calculated at render time based on the width of the device.

@arribbar , @slicejunk it looks like it's because of the autoplay. Once it get to the end of the slides the issue appears. hope this help.

valinaga avatar Sep 15 '17 11:09 valinaga

I found the issue. In the initState method, to the end, you need to change: this.internals = { ...this.internals, isScrolling: false }; to this.internals = { ...initState, isScrolling: false }; It looks like the internals is initiated there and there's no other reference of it. Whoever need to give it a ride can test the fork here: https://github.com/valinaga/react-native-swiper Hope it helped.

valinaga avatar Sep 15 '17 14:09 valinaga

swiper codes:

<Swiper
	style={{ backgroundColor: "#ffffff" }}
	height={px2dp(154)}
	index={0}
	bounces={false}
	autoplay={true}
	autoplayTimeout={3}
	showsButtons={false}
	paginationStyle={{ bottom: 0 }}
	dotStyle={{ backgroundColor: '#dedede', width: px2dp(10), height: px2dp(2) }}
	activeDotStyle={{ backgroundColor: '#00bc71', width: px2dp(10), height: px2dp(2) }}>
	{renderSwipeView()}
</Swiper>

and swiper codes are in the FlatList component.Then I have the same question , need help please.

xiaomaer avatar Sep 20 '17 07:09 xiaomaer

Same issue here, when i build gradlew assembleRelease and i test with my android phone the application crash, i'm using your suggestion brother @valinaga.

Pls help me

dapapkung avatar Sep 05 '18 04:09 dapapkung

I have the same problem. Anyone got a solution to this? "react-native-swiper": "^1.6.0", react-native": "~0.63.4",

After a few swipes...my app just closes

elrapha avatar May 15 '21 14:05 elrapha