question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

About <ViewPagerAndroid> nested

See original GitHub issue

react-native v0.27.2 : ViewPagerAndroid nested , the inner ViewPagerAndroid content couldn’t show 。 E.g :

<ViewPagerAndroid
    style={{flex:1,backgroundColor:'#FF0000'}}
    onPageSelected={(e)=>{}}
    keyboardDismissMode="on-drag">
    //===========outer View 1===========
    <View>
        <Text>Page 1</Text>
        <ViewPagerAndroid
            style={{flex:1,backgroundColor:'#FFFFFF'}}
            onPageSelected={(e)=>{}}
            keyboardDismissMode="on-drag">
            //===========inner View 1===========
            <View>
                <Text style={{color:'#000000'}}>Sub Page 1</Text>
            </View>
            //===========inner View 2===========
            <View>
                <Text style={{color:'#000000'}}>Sub Page 1</Text>
            </View>
        </ViewPagerAndroid>
    </View>
    //===========outer View 2===========
    <View>
        <Text>Page 2</Text>
    </View>
</ViewPagerAndroid>

The inner view couldn’t show , but can be slide !

Thx!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
maxs15commented, Jan 23, 2017

Why did you close the issue ? It looks like there is still an issue with the ViewPagerAndroid component…

2reactions
chrisciszakcommented, Jul 30, 2016

I think there is some kind of defect which causes the inner ViewPagerAndroid not being shown on the initial render. However I noticed when I change the height of the element in my script editor, it re-renders the inner view correctly and is visible without problem. This is a nasty workaround but it’s the only way I have managed to work around this issue.

In the inner ViewPagerAndroid add the following: componentDidMount() { setInterval(() => this.setState({height: height, width: width}), 0); }

width and height is your desired dimension, however it must be different than what you pass to this component initially as obviously if you set it to the same values React will not re-render as the state would be already the same.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ViewPager nested in ViewPager - android - Stack Overflow
I'm really newbie in android and I would appreciate any help for my course work. I need to do: 1) two ViewPagers (not...
Read more >
ViewPager with FragmentPagerAdapter - CodePath Cliffnotes
... the screenshot above, you need to include a nested indicator view called a PagerTabStrip: <androidx.viewpager.widget.ViewPager android:id="@+id/vpPager" ...
Read more >
Prevent Scroll Conflicts in Nested ViewPager | by Randy Arba
The first fragment will show Nested Viewpager, but the second fragment is not visible, to prove the view pager its work when sliding...
Read more >
Migrate from ViewPager to ViewPager2 - Android Developers
ViewPager2 does not natively support nested scroll views in cases where the scroll view has the same orientation as the ViewPager2 object that ......
Read more >
react-native-nested-scrollable-tab-view - npm
react-native-nested-scrollable-tab-view · Readme · Explore BETA · 2 Dependencies · 0 Dependents · 1 Versions ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found