88 Commits

Author SHA1 Message Date
Thibault Malbranche
7ab2afbab7
fix(android): Broken build due to conditional import of kotlin (#1412) 2020-05-28 13:18:13 +02:00
Jason Chia-Hsien Ho
89886c820d
fix(android): Fix several Android file upload issues (#1302 by @hojason117)
[skip ci]
2020-05-26 19:59:08 -07:00
Benjamin Rau
4f0f0afe70
fix(android): add missing null check for fileTypes (#1368 by @bengy) 2020-05-26 14:59:18 -07:00
SaeedZhiany
2639d523e9
fix(gradle): Load Android Gradle Plugin conditionally (#1230 by @SaeedZhiany)
BREAKING CHANGE:

The Android Gradle plugin is only required when opening the project stand-alone, not when it is included as a dependency. By doing this, the project opens correctly in Android Studio, and it can also be consumed as a native module dependency from an application project without affecting the app project (avoiding unnecessary downloads/conflicts/etc).

Also moved getExtOrDefault to buildScript block to able to use everywhere in the file

This change shouldn't break any apps, but we are marking it as a breaking change in case there are some use cases we've missed.

[skip ci]
2020-05-26 14:57:40 -07:00
trcoffman
5d88af44fa
fix(Android): Workaround for chromium bugs 1023678 and 1050635. (#1221)
There is a bug in the WebView that causes a spurious call to onReceivedError
whenever you download a file.

This commit is a workaround for that bug. The idea here is to try and detect
these spurious errors and drop them before they cause problems.

This commit should be reverted once those chromium bugs are fixed.
2020-04-10 13:41:53 -07:00
ivari
04f9fb23ba
fix(Android): Ensure each mounted WebView binds their personal onMessage handler (#1301)
* Ensure each mounted WebView binds their personal onMessage handler

* Changed unique ref generation to uuid

Uses `uuid` npm package.
Dashes are removed from the ref for sanity.
2020-04-09 08:05:44 -07:00
ivari
c88e380762
feat(Android): Implement direct communication between Android code and JS (#1203) 2020-04-06 10:25:28 -07:00
trcoffman
24702450f3
fix(Android): Don't log the cookie when downloading file. (#1224) 2020-02-21 11:02:50 -08:00
Daniel Vicory
4093682e08
fix(Android): Don't show camera options for a file upload when they can not be used (#1210)
* Don't show camera options for a file upload that would result in nothing happening for the user.

On Android, if the application declares the camera permission, then even intents
that use the camera require permission to be granted. This is a problem for apps
that combine an in-app camera with a WebView that has file uploading and the user
has not given permission for the camera.

Note, this will not request permission for camera. This will simply prevent
showing the camera options that would be a no-op action for users. It does this
by checking if the camera permission is declared, and if so, checks that the
user has granted permission.

More information: https://blog.egorand.me/taking-photos-not-so-simply-how-i-got-bitten-by-action_image_capture/

* Add example and documentation about camera option availability in file uploads for Android.
2020-02-18 18:40:30 -08:00
Dulmandakh
e6241cbb6a
chore(Android): Convert RNCWebViewPackage to Kotlin (#1194)
* RN is implementation dependency

* renamed:    RNCWebViewPackage.java -> RNCWebViewPackage.kt

* migrate RNCWebViewPackage to Kotlin

Co-authored-by: Jason Safaiyeh <safaiyeh@protonmail.com>
2020-02-12 17:12:24 -08:00
Daniel Vicory
344aab591a
fix(Android): Revert "Redirected URLs now redirect correctly. (#991)" (#1177)
This reverts commit acf1ad7560aac450615703b3c8410919dbddecd1.
2020-01-29 19:18:35 -08:00
hanlh1
acf1ad7560 fix(Android): Redirected URLs now redirect correctly. (#991)
Co-authored-by: Jamon Holmgren <jamon@infinite.red>
Co-authored-by: Jason Safaiyeh <safaiyeh@protonmail.com>
2020-01-26 00:25:24 -08:00
Conner Owen
5b0c634f15 fix(build): Android build errors when using Gradle 6.0 (#1037)
* Fix Android build errors when using Gradle 6.0

* Update gradle.properties

* Remove newline at end of file

* newline
2019-11-26 10:41:16 +01:00
Vladimir
d8acd9086c fix(android): Added fallback poster image to prevent crashes (#1036) 2019-11-26 10:40:38 +01:00
Andrei Pfeiffer
71a375f898 chore(cleaning): Remove old comments (#1019) 2019-11-14 10:48:58 +01:00
Nikhil Chitlur Navakiran
7e68da4ffe fix(android): Fix ClassCastException when doing native things(#987) 2019-11-13 10:36:08 +01:00
Stanislav Shakirov
4a4f4a2c45 feat(android): add clearHistory, clearCache and clearFormData (#450)
* add clearHistory, clearCache and clearFormData android webview api.

* remove pointless `async`

* add docs for new android webview methods

* Update Reference.md

* update commands types

* add more strict type for RNCWebViewUIManager `Commands` property
2019-11-12 10:09:16 +01:00
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