* Filter out extra onLoadProgress calls; add url to onLoadProgress
* remove note about onLoadProgress not having the url property in docs
* Update Reference.md
Each time building our app, this library causes a message like this
one to be printed, sometimes twice:
> Configure project :react-native-webview
:react-native-webview:reactNativeAndroidRoot /home/greg/z/mobile/node_modules/react-native/android
Worse, the message comes through even if I silence all normal
progress messages and warnings, with `./gradlew --quiet`.
It turns out that the `logger.quiet` method which these log lines are
using has a confusing name. It doesn't mean "log quietly", but more
like the opposite: "log even when asked to keep things quiet". See
documentation on Gradle log levels:
https://docs.gradle.org/current/userguide/logging.html
So, remove the noise by switching to `logger.info`. This avoids
bothering the user by default, and keeps the information readily
available if desired by passing `--info` to Gradle.
* - add focus functionality for devices without touch screen
(faced problem while developing for android TV, cause there only remote controller for device)
* Reimplement as a ref method.
* - remove redundant requestFocus
* fix(Android): WebRTC permission request (#231)
* fix(Android): Avoid unintentionally granting requests for new permissions (#231)
* ContextCompat import migrated to androidx new artifact
* RNCWebViewManager.java original format restored
Hello, in order to use react-native-webview > 6.0.2 please make your android/gradle.properties contains:
```
android.useAndroidX=true
android.enableJetifier=true
```
This enables AndroidX libraries which are the new standard.
fixes#580fixes#581fixes#582
* 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
* 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.
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}
/>
`
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.
The current implementation doesn't support a list of file extensions in the accept attribute (e.g. `<input type="file" accept=".jpg, .png">`) while that is a valid value per the HTML spec. I've updated the implementation to convert any file extensions to mime types before we set the type(s) on the intent to rectify the issue. In addition I've updated the `acceptsImages` and `acceptsVideo` methods to handle file extensions as well.
fixes#29fixes#272fixes#221fixes#105fixes#66
BREAKING CHANGE: Communication from webview to react-native has been completely rewritten. React-native-webview will not use or override window.postMessage anymore. Reasons behind these changes can be found throughout so many issues that it made sense to go that way.
Instead of using window.postMessage(data, *), please now use window.ReactNativeWebView.postMessage(data).
Side note: if you wish to keep compatibility with the old version when you upgrade, you can use the injectedJavascript prop to do that:
const injectedJavascript = `(function() {
window.postMessage = function(data) {
window.ReactNativeWebView.postMessage(data);
};
})()`;
Huge thanks to @jordansexton and @KoenLav!
Added a new cacheEnabled prop to toggle Android & iOS webview caching behavior.
BREAKING CHANGE: This change makes caching enabled by default when previously there was no caching behavior which may cause unexpected behaviour changes in your existing implementations.
Addresses #80.
Caveat: I am not an Android developer. This code comes from a fork of the original RN WebView that we have been using in production for some time, so all credit goes to @Oblongmana: https://github.com/Oblongmana/react-native-webview-file-upload-android.
Setting up a DownloadManager for the WebView is pretty straightforward, as is adding any known cookies to the request. Most of the complication comes from the requirement after SDK 23 to ask the user for the WRITE_EXTERNAL_STORAGE permission. Unfortunately there is no mechanism to suspend the download request until permission is resolved so this code stores off the request and sets up a listener that enqueues the download once permissions are resolved so the user experience is really nice.
I didn't see anything in the way of tests or documentation that needs to be added for this change, so let me know if I missed anything. Thanks!
Fixes#33
I could really use some help from an Android developer on this one, because I just "made it work", don't know how to "make it work good".
Some things that should be reviewed:
- [ ] validate Android 5.0 devices (my emulator work, but outputs some weird sounds; a Galaxy 4 I tested on crashes)
- [ ] validate Android 5.1 devices (emulator works, couldn't find a real device)
- [ ] how to handle File Extensions? (https://www.w3schools.com/tags/att_input_accept.asp)
I'm sure that there's more refactoring to be done, so any help and advice would be appreciated.