I am trying to use WebView Component inside View component, for a react native application I am working on. When I embed WebView inside View, I am not seeing the content I am displaying in WebView. Is this the expected behavior with react native?
相关问题
- React Native Inline style for multiple Text in sin
- Android Exclude Some Camera Intent
- How Do I Convert Image URI into Byte Expo
- ApolloClient from apollo-boost attemped to assign
- Implementing ssl pinning in a react-native applica
相关文章
- Why do we have to call `.done()` at the end of a p
- Remove expo from react native
- React Native - Dynamic Image Source
- “Unfortunately, app has stopped” error with buildi
- eslint Parsing error: Unexpected token =
- How to determine JS bottlenecks in React Native co
- How to override navigation options in functional c
- PanResponder snaps Animated.View back to original
Please use following code:
this code is working absolutely fine for me,
In all above solutions I observed that everyone is suggesting to add flex: 1 to your webView style.
Yes it is correct but in case you want to nest WebView inside View then you need to specify styles of your parent view precisely.
So, I set justifyContent: 'flex-start' so that vertically WebView will start from top of my screen and alignItems: 'stretch' so that WebView will take all available in horizontal direction
As we use justifyContent to specify primary axis alignment and alignItems to specify secondary axis alignment and default flexDirection is column.
To get more information on how to install react-native-webview please refer following link: https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md
You should specify a width and height for your webview. Do it as follow:
Can use something like this
For WebView in View, We can use this code for .js and .tsx files in React-native.
Try this to open a pdf file. Li'l out of the box but I am sure it would help someone :)
When it's nested inside a View component, you need to set both view and webview flex to 1.
eg. -