Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Shuijwan opened this issue Jun 12, 2016 · 4 comments
Open

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

Shuijwan opened this issue Jun 12, 2016 · 4 comments

Comments

@Shuijwan
Copy link

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.

@stage88
Copy link
Owner

stage88 commented Jun 13, 2016

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 :)

@Shuijwan
Copy link
Author

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. :-)

@stage88
Copy link
Owner

stage88 commented Jun 13, 2016

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

@Shuijwan
Copy link
Author

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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants