n4kz / react-native-pages

Easy to use page view component
Other
376 stars 83 forks source link

android onScrollEnd() not firing #24

Closed phyzical closed 4 years ago

phyzical commented 6 years ago

Hey there!

great little component :)

i found this previous issue where people seem to say it has been resolved? https://github.com/n4kz/react-native-pages/issues/13

Do i need a certain RN/ R to make it work?

i seem to have the functionality that was before the fix which was it randomly fires the callback on scroll end

(im also testing on the android simulator not sure if this makes a difference)

ive even tried rolling back to 0.5.6 version with the same results :(

i also have a prop being updated via dispatch which show the body contents of the current 'active' page and nulls for the rest to increase performance when there is lots of pages in case this could have something todo with it.

edit. oh as i remember seeing it being a float conversion issue before i have 42 pages in my current senario

matyj commented 6 years ago

Yep, I have the same issue. Sometimes it fires and sometimes not: When I change 2 tabs, then callback is called, but never when I change only one tab. It's Android 8.0, maybe this will help.

Danstett commented 6 years ago

Any word on this issue?

rayronvictor commented 6 years ago

Here I change internal ScrollView to FlatList and worked. I submited a pull request.

phyzical commented 6 years ago

thanks i will give this a test later today, and confirm it works

phyzical commented 6 years ago

hey there, gave it a test, the problem still persists unfortunately,

again this seems to only occur on android

thiago1belino commented 5 years ago

Hey there, great component. Temporarily, for fix this bug, I used the style backgroundColor in pagination objects. The example bellow, in Android, not firing onScrollEnd():

      <Pages onScrollEnd={this.onScrollEnd.bind(this)} >
        <View style={{ flex: 1}} />
        <View style={{ flex: 1 }} />
        <View style={{ flex: 1 }} />
      </Pages>

Now, it's functional example:

      <Pages onScrollEnd={this.onScrollEnd.bind(this)} >
        <View style={{ flex: 1, backgroundColor: 'red' }} />
        <View style={{ flex: 1, backgroundColor: 'green' }} />
        <View style={{ flex: 1, backgroundColor: 'blue' }} />
      </Pages>
dackmin commented 5 years ago

Setting backgroundColor: 'transparent' also works for those who don't want to set a real background color.

wanghe826 commented 5 years ago

Same issue at 0.7.0 in Android. In pagination objects, backgroundColor should been set with any color, also can be 'transparent'. And you should wrap other Component like <Image> with <View>, then set the backgroundColor of <View>

Kiolk commented 5 years ago

Sometimes it's happen if present margin from left and right, and swiping started from margin. You need add padding instead margin, and don't forget about set backgroundColor.

n4kz commented 4 years ago

Thanks for issue and sorry for delayed reply. I've added collapsable prop to all children in 37180351 and starting from next release there will be no need for backgroundColor hack.