97 Commits

Author SHA1 Message Date
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
Thibault Malbranche
2c0059ff61
feat(New Webview Prop): Added Android overscroll property (#54) 2018-10-17 16:48:19 +02:00
黎明
b5aaf5c800 feat(webview props) onLoadProgresss property (#53)
* Added the onLoadProgress property to the iOS wkwebview and Android webview
2018-10-17 15:08:52 +02:00
Thibault Malbranche
0e34982477 Done 2018-10-13 00:40:20 +02:00
Gianfrancø Palumbo
513886775c
Fix Android WebView with garbled UTF-8 characters
taken from the last line of https://stackoverflow.com/a/10831462/728287
2018-10-09 12:14:28 +03:00
Thibault Malbranche
fcc35cec09 Renamed RNC on android too to stay consistent with iOS 2018-09-19 01:19:06 +02:00
Max Ammann
f95cdd8f80 Fix compilation by renaming a class usage 2018-09-17 17:25:04 +02:00
Thibault Malbranche
220d7a1973 Merge branch 'master' into import/0c576ef-allow-file-access-android 2018-09-14 01:09:50 +02:00
Thibault Malbranche
62b560a546 imported 0c576ef84a 2018-09-14 01:09:39 +02:00
Thibault Malbranche
4a23b51cbe fix formatting 2018-09-14 00:38:40 +02:00
Thibault Malbranche
2e3232caa0 imported https://github.com/facebook/react-native/pull/20366 2018-09-14 00:36:29 +02:00
Dulmandakh
2cd5a421c8 use SDK 27, build tools 27.0.3 2018-09-12 03:34:09 +08:00
Dulmandakh
0f7091ba14 Revert "use compile instead of implementation to support gradle plugin 2.x used in RN 0.56" 2018-09-12 03:31:44 +08:00
Dulmandakh
1461ba26e2 use compile instead of implementation to support gradle plugin 2.x used in RN 0.56 2018-09-11 17:22:54 +08:00
Dulmandakh
c4fde1d323 try reuse tooling config from React Native 2018-09-11 11:02:16 +08:00
Jamon Holmgren
642620dd98 WIP: WebView extraction - Rename android from RNC to RCT 2018-09-08 17:01:05 -07:00
Jamon Holmgren
f9b9d3c092 Rename ReactWebView to RNCWebView, remove more infinitered references 2018-08-15 20:30:06 -07:00
Jamon Holmgren
bc3be5ecaa Removes copyright notices from file headers 2018-08-15 19:25:15 -07:00
Jamon Holmgren
d1f442cc51 WIP: Android 2018-08-07 23:02:40 -07:00
Jamon Holmgren
52ba380e4a Added RNCWebViewManager to xcode proj 2018-08-02 23:52:31 -07:00
Jamon Holmgren
0d3a4ebe62 Move android IRWebView to WebView 2018-08-02 22:01:29 -07:00
Jamon Holmgren
af0057a321 Reshuffling 2018-08-02 21:41:20 -07:00