Multiple WebViews in PagerView
See original GitHub issueI am trying to display multiple webviews (with vertical scroll in them) using PagerView.
The issue that I am having is that when I scroll the web page in WebView, for some reason PagerView also handles the tap-and-drag gesture and sometimes may swipe the page. This is not the desired behavior and I am wondering how can it be avoided?
Here’s the working example:
import { Dimensions, View } from 'react-native';
import PagerView from 'react-native-pager-view';
import WebView from 'react-native-webview';
const { width, height } = Dimensions.get('window');
export default function App() {
return (
<View style={{ flex: 1 }}>
<PagerView overScrollMode='never' style={{ width, height}}>
<View style={{ flex: 1 }}>
<WebView source={{ uri: 'https://www.lipsum.com/' }} />
</View>
<View style={{ flex: 1 }}>
<WebView source={{ uri: 'https://cn.lipsum.com/' }} />
</View>
<View style={{ flex: 1 }}>
<WebView source={{ uri: 'https://es.lipsum.com/' }} />
</View>
<View style={{ flex: 1 }}>
<WebView source={{ uri: 'https://it.lipsum.com/' }} />
</View>
</PagerView>
</View>
);
}
https://user-images.githubusercontent.com/873278/154859909-3cfe0e92-136a-49c6-80ce-8f3ebf03dbe7.mov
Thanks for any help!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:12
Top Results From Across the Web
Logic to use multiple webview in TabLayout to handle memory ...
Use ViewPager . ViewPager will hold maximum 3 fragments in memory at any time(without changing the default offscreen page limit).
Read more >Android WebView | Part 2: WebView on Top ViewPager2
Modify fragment creation and make sure we can open different pages on each viewpager. First for the blog, second for promotions. Modify the...
Read more >Espresso Web - Android Developers
Espresso-Web is an entry point to work with Android WebView UI ... onData() method, a WebView interaction comprises several Atoms.
Read more >How to restore the state of a WebView in a layout “Tabs + ...
replace the file eu/lucazanini/viewpager/MainActivity.java ... When swiping between different app sections, select // the corresponding tab.
Read more >Android ViewPager Example Tutorial - DigitalOcean
In our android ViewPager application we'll implement a ViewPager that swipes through three views with different images and texts.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zhuanghongji yeah thats more or less what i did but i experimented a bit with pager view 6.0.0-rc2 with lazy load and i got a better result
@manosKas I didn’t use react-native-webview 。This library does not meet my needs,I am using the webview packaged by my own project