Skip to content

[Android] ViewPager child view didn't get draw #11829

Closed
@tlcheah2

Description

@tlcheah2

Description

I created a native UI component, which is a RelativeLayout contain a ViewPager. It instantiate two item view, which is ItemView0 and ItemView1.

However, when I performed scrolling to ItemView1 on ViewPager, the correct behaviour of the ViewPager should be draw the next item, which is ItemView2.

Instead, from the debugging I did, the instantiateItem() from PagerAdapter did called and view is inflated. However, it did not perform dispatchDraw() method for ItemView2.

Hopefully I am clear with the issue. I have also posted on StackOverflow. http://stackoverflow.com/questions/41571053/react-native-custom-native-viewpager-unable-to-addview

Thanks.

Reproduction

Here is the link for the sample project of reproduction.
https://github.com/tlcheah2/test

Solution

Firstly, I couldn't use ViewPagerAndroid as what it contain inside is quite heavy. Thus, I decided to move some of components to native. There I encountered this issue.

Secondly, I am not sure this is a bug or what. If anyone can provide some explaination, it would be really helpful and I appreciate it.

Additional Information

  • React Native version: RN 0.40
  • Platform: Android
  • Operating System: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions