react-weather icon indicating copy to clipboard operation
react-weather copied to clipboard

The Header doesn't update when scroll the viewpage in Android

Open Shuijwan opened this issue 9 years ago • 4 comments

onSelectedIndexChange(index, offset) { // this is not curently used this.state.current.setValue(index); }

when scroll the viewpage, the onSelectedIndexChange is called, but the Header doesn't update the relative City info. It works in IOS.

Shuijwan avatar Jun 12 '16 12:06 Shuijwan

Hi and thanks :) I haven't had time to test the app properly on an Android device, I plan to do that very soon. I think if you check out the latest version of the repo, you'll see the code has updated a bit, it might work. Animations are now used to display the headers for different locations. Check it out, let me know :)

stage88 avatar Jun 13 '16 09:06 stage88

hmmm....I just update your latest code, it still does not work in Android device, seems the this.setState({current: index}) doesn't trigger re-render. I am new to React native, I will try to do some debug. :-)

Shuijwan avatar Jun 13 '16 09:06 Shuijwan

Ok thanks, I'll try and get a working Android version sometime next week.

stage88 avatar Jun 13 '16 10:06 stage88

Hey, I found the root cause, it is because the onScroll callback of swiper is not supported in Android, so I add onSelectedIndexChange(index, offset) { this.state.shift.setValue(index * SCREEN_WIDTH);//update the offset only when drag is end this.setState({current: index}); }

and it can update the header now :-)

Shuijwan avatar Jun 14 '16 03:06 Shuijwan