Commit Graph

71 Commits

Author SHA1 Message Date
thanakij fab77dc82f fix(android): possible NullPointerException (#965) 2019-10-22 09:56:50 +02:00
Tom Targosz 0b783da0a4 fix(lint android): Add TargetAPI to onPermissionRequest (#940) 2019-10-11 10:45:22 +02:00
Borut Balazek 4db3d84dda feat(android): allowFileAccessFromFileURLs prop added (#831)
* add allowFileAccessFromFileURLs propery to do the expected on android

* Added types

* Update WebViewTypes.ts
2019-09-29 15:50:39 +02:00
Andres Castano 5da59251ce feat(android): Expose cacheMode property (#895) 2019-09-29 15:45:20 +02:00
Thibault Malbranche 8f2ddf4542
fix(android): Revert scroll update from #281 (#889)
fixes #878
2019-09-23 15:40:40 +02:00
Tyler Alves fc59cae4bf fix(android): Filter extra onLoadProgress & add url event (#643)
* Filter out extra onLoadProgress calls; add url to onLoadProgress

* remove note about onLoadProgress not having the url property in docs

* Update Reference.md
2019-09-23 10:35:49 +02:00
thanakij 9e25e42cee fix(Android): hardware acceleration issue (#854)
* Fix https://github.com/react-native-community/react-native-webview/issues/575

* Check if hardware acceleration is available also

* Alternative way to check isHarewareAccelerated
2019-09-23 00:03:42 +02:00
Jason Chia-Hsien Ho 552472c414 feat(new prop): onHttpError callback (#885) 2019-09-21 02:43:28 +02:00
masako-yamada a5cb7ba65c fix(android): Allow scrolling inside ScrollView (#281) 2019-09-18 11:33:08 +02:00
Greg Price b2cd6b54fa fix(android): Move noisy debug logging out of "quiet" log level. (#844)
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.
2019-09-04 09:22:23 +02:00
tekmin 47e9a0b97d fix(android): webview crash with incognito in Android Lollipop (#799) 2019-08-29 16:47:48 +02:00
MAHAVIR VATALIYA 39e5373d3e Update RNCWebViewModule.java (#509)
In Devices moto e5 play and Samsung Galaxy Note 9 Video Capture via camera return data as null.
2019-08-29 16:46:42 +02:00
Akeem McLennon 1ea05d3115 fix(android): Allow user to rotate fullscreen video (Android X) (#816)
* Allow user to rotate fullscreen video on Android

* Update RNCWebViewManager.java

* Update RNCWebViewManager.java
2019-08-29 16:38:25 +02:00
Roc 12db6956a9 fix(android): add null reference check for onMessage on android (#770) 2019-08-09 10:53:00 +02:00
DemMarcupan 6f053bad7b feat(focus): Add functionality to imperatively focus webview (#567)
*  - 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
2019-08-06 10:56:59 +02:00
Eze bb79ae80ee feat(Android): webrtc permission request - conflicts fixed (#719)
* 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
2019-08-02 17:23:59 +02:00
Raphael Eidus 9c592d621c feat(android): polyfill applicationNameForUserAgent on Android (#707) 2019-08-02 10:46:03 +02:00
SiDevesh 282f81dcdd fix(android): onMessage on android to return baseEvent(#755) 2019-08-02 10:06:11 +02:00
José Luis Pereira 25bc5a55c6 feat(android props): Add incognito to Android (#524) 2019-08-02 09:48:54 +02:00
ifsnow d8743eeed2 fix(performance): Improved `onScroll` to work efficiently on Android (#609) 2019-06-02 20:19:39 +02:00
Thibault Malbranche 585ac7a243
fix(AndroidX support): Fixed broken import + added instructions (#583)
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 #580 
fixes #581 
fixes #582
2019-05-20 00:36:51 +02:00
liminjie cbbff21ea8 fix(Android): on scroll syntax error (#577)
getJSEventName() needs a ScrollEventType parameter
2019-05-17 09:25:53 +02:00
Mike Diarmid 1d6c88dcf5 feat(android): Migrate to Android X (#520)
BREAKING CHANGE:
If you override compileSdkVersion<28  it won't work anymore.
2019-05-17 00:33:25 +02:00
Jared Forsyth e4c8dab2ae 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
2019-05-17 00:27:16 +02:00
Adrian Rangel 409b9ae620 fix(Android): geolocation access (#562) 2019-05-17 00:25:40 +02:00
Daniel Vicory d72c2ae144 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.
2019-05-17 00:22:08 +02:00
Avery Choke Kar Sing c8977ec7ce fix(android): unable to re-enable hardware acceleration after disabled it (#553) 2019-05-13 09:38:54 +02:00
Scott Beca 9aa14f1a96 fix(android): updating source.html prop doesn't refresh webview (#485) 2019-04-15 09:56:45 +02:00
mr.sadvit 82fe6e2c3d 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}
/>
`
2019-03-28 09:52:18 +01:00
Stanisław Chmiela f6e208be61 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.
2019-03-27 10:52:36 +01:00
Stanisław Chmiela 566a6292b4 fix(android): Do not hold a strong reference to native module in the package (#434) 2019-03-20 13:04:47 +00:00
Stanisław Chmiela e697dff1d0 chore(format): Android project formatting (#433)
Added an extremely simple `.editorconfig` I inferred from the main part of the project, then reformatted the codebase according to it. 🙂
2019-03-19 14:42:47 +00:00
Stanislav Shakirov a25997bf65 fix(onShouldStartLoadWithRequest): android event was missing fields (#385)
`onShouldStartLoadWithRequest` event had only `url` in payload on android.
I've fixed it according to js event definition. 
https://github.com/react-native-community/react-native-webview/blob/master/js/WebViewTypes.js#L34
2019-03-13 16:21:25 +01:00
Ryan Linton 803a3b095b fix(Android <input />): Support file extensions in file input accept attributes (#357)
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.
2019-02-28 22:12:27 +01:00
Benjos Antony a661df1ffc fix(android:scalesPageToFit): scalesPageToFit does not work as intended , especially for large jpg and png images. (#275)
fixes #113

- One can verify that this for jpg images loaded on the webview (eg: https://www.ecda.gov.sg/growatbeanstalk/PublishingImages/READ%20Publications%20and%20Research/Parent%20Infographic%20Series/Infographic%204.jpg)
- This is a replication of the pull request that was originally made in the react-native repo (https://github.com/facebook/react-native/pull/17195), but was not merged in due to no reviews.
2019-02-28 22:02:44 +01:00
Jordan Sexton 92c20581ae feat(toggle scroll bar): added new props showsVerticalScrollIndicator / showsHorizontalScrollIndicator (#250) 2019-02-12 14:47:24 +01:00
Thibault Malbranche d5fc028383 fix(PostMessage): Renamed ReactNativeWebview to ReactNativeWebView
fixes #304
2019-02-01 22:04:11 +01:00
Thibault Malbranche f3bdab5a22
feat(Android/iOS postMessage): refactoring the old postMessage implementation (#303)
fixes #29
fixes #272
fixes #221
fixes #105
fixes #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!
2019-02-01 18:37:28 +01:00
Michael Diarmid 83ce79ff89 feat(iOS/Android): Add `cacheEnabled` prop (#152)
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.
2019-01-30 10:32:46 +01:00
Marcin Ochyra 15d904f769 fix(android): Fix Download on android P (#273)
Fixes #266. 
Now downloading works on Motorola Moto One with Android 9.
2019-01-29 10:05:25 +01:00
Thibault Malbranche 2846e27fcf
fix(Gradle): Allow kotlinVersion override using ext with gradle.properties (#267)
You can now override kotlin version by defining ext kotlinVersion
2019-01-23 01:58:27 +01:00
Margaret d3fc5e6cde feat(android props): Add `androidHardwareAccelerationDisabled` prop (#265)
* add test code for disable hardware acceleration

* add interface to disable android hardware acceleration

* Update index.d.ts
2019-01-22 10:21:10 +01:00
Thibault Malbranche 518003392a
fix(gradle): Add support library as a dependency (#253)
fixes #174 
fixes #184 
fixes #245
2019-01-18 16:41:52 +01:00
Thibault Malbranche 4e1d113c70
fix(android): Blank screen due to missing super() call in RNCWebViewManager.java (#241)
fixes #240 #224
2019-01-11 10:44:42 +01:00
Michael Diarmid 9014c4cac0 fix(android): replace deprecated `WebView.PictureListener`->`onContentSizeChange` impl (#164)
* [android] replace deprecated `WebView.PictureListener` onSizeChanged implementation

* [android] use pre-provided w/h values
2019-01-10 11:38:05 +01:00
Michael Diarmid 24ec4f752c fix(android): cleanup `build.gradle` & fix #218 (#238)
This changes the following:
 - Fixes #218 
 - Removed unused Fabric Maven config
 - Versions now correctly checking `rootProject.ext.X` instead of `rootProject.X` to match behaviour from all other libs (RNFB needs changing as well 🙈)
 - Swapped `implementation` for `api` for react native sources - only used to build.


![image](https://user-images.githubusercontent.com/5347038/50959941-1af23980-14bc-11e9-8677-e60f3ee744e7.png)
![image](https://user-images.githubusercontent.com/5347038/50959955-22b1de00-14bc-11e9-8afa-d1abbba46a64.png)

cc @terrytianliang
2019-01-10 11:23:46 +01:00
Scott Mathson 2114a9b327 feat(Android Webview): Add file download support for Android (#203)
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!
2019-01-07 15:02:47 +01:00
Thibault Malbranche b1b662628e feat(Android Webview): Support onShouldStartLoadWithRequest on Android (#107)
This PR adds support for `onShouldStartLoadWithRequest` on android.

The initial PR was #59

The issue for this PR is: #106

fixes #106
2018-11-30 02:59:12 +01:00
Andrei Pfeiffer 752a5b295a feat(Android): Support Android file upload (#60)
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.
2018-11-21 11:46:43 +01:00
Thibault Malbranche fd736cf26b
refactor(Android): New project setup + kotlin events (#121) 2018-11-19 11:25:28 +01:00