feat(onScroll): Add `onScroll` callback for iOS & Android (#516)
* Add `onScroll` callback for iOS & Android
This code was mostly extracted from https://github.com/react-native-community/react-native-webview/pull/202
I tried and tried to make it work with `Animated.event`'s `useNativeDriver`, but I was unsuccessful 😢 that'll have to be done later once I understand better how Animated's native stuff is hooked up.
* fix crash for missing onScroll
feat(fullscreen videos): Support fullscreen video on Android (#325)
* Extract WebChromeClient from an anonymous class
* Support fullscreen videos on Android
Forces landscape mode while playing.
* Use sticky immersive mode for fullscreen videos
No longer forces landscape mode as that is a problem for portrait videos - allow
the user to rotate as necessary.
Only supports KitKat or greater, and falls back to leaving the status and navigation
bars visible for lower than KitKat. This is the easiest way to prevent issues with
resizing the video during playback.
Also implement a lifecyle event listener which means if a user backgrounds the app
or locks the screen with the video fullscreen, the UI visibility is re-applied.
* Add allowsFullscreenVideo prop to control whether videos can be fullscreen on Android
Luckily, we're able to change the WebChromeClient on demand in response to prop changes
without seeming to do any harm. If you switch to disallow fullscreen, it will attempt
to close the currently fullscreened video (if there is one) so users aren't stuck.
I did notice a bug that if you go from fullscreen allowed, to fullscreen disallowed,
the fullscreen button will remain on the video. Tapping the button will have no effect.
feat(WKWebView): Allow focus without user interaction (#540)
* [iOS] Allow focus without user interaction
* Add documentation for keyboardDisplayRequiresUserAction
* set keyboardDisplayRequiresUserAction default to true
feat(iOS cookies): implement sharedCookiesEnabled prop for iOS RNCWKWebView (#175)
We had the problem on iOS WebViews that local cookies (stored in local HTTPCookieStorage, set with [react-native-cookie](https://github.com/shimohq/react-native-cookie) ) were not added in loadRequests. On Android the local stored cookies were sent like expected.
This kinda "hacky" solution is the only way we found, that works for us.
The stack overview link is in the code below.
If someone finds a better solution we would very much like to accept that.
fix(styles): Removes hard-coded container white backgroundColor (#478)
Fixes #475#472 added a `backgroundColor` of `white` to the `container` style which broke the ability to set a `transparent` background color on the `WebView` component. This simply removes that unnecessary style.
feat(android): textZoom prop to limit scaling issues (#414)
When setting a custom font size in the Android system, an undesirable scale of the site interface in WebView occurs.
I researched that when setting the standard textZoom (100) parameter size, this undesirable effect disappears.
This can be very useful if you need to avoid the scale of content in WebView when changing the size of system fonts, or change textZoom property directly.
Example:
`
<WebView
textZoom={100}
/>
`
fix(android): Annotate RNCWebViewModule with @ReactModule to comply with latest changes (#459)
The app was crashing with `"Could not find @ReactModule annotation in class RNCWebViewModule"` exception. Searching for this message in RN's code I found [this commit](0cd3994f1a/), introduced in React Native 0.58, which requires native modules to be annotated with @ReactModule annotation. 🤔
After adding the annotation to the module, tapping on a file input field no longer crashes the app (in fact it shows the file browser). 🎉
I haven't had caught it previously, testing only against React Native 0.57, sorry! 😞
For reference see similar fix in `react-native-gesture-handler` — https://github.com/kmagiera/react-native-gesture-handler/pull/295.
Fixes https://github.com/react-native-community/react-native-webview/issues/458.