Browse Source

Fix doc imports, update example app

Jason Safaiyeh 4 years ago
parent
commit
92e4af6f21

+ 1
- 1
.all-contributorsrc View File

@@ -1,5 +1,5 @@
1 1
 {
2
-  "projectName": "webview",
2
+  "projectName": "@react-native-community/webview",
3 3
   "projectOwner": "react-native-community",
4 4
   "repoType": "github",
5 5
   "repoHost": "https://github.com",

+ 1
- 1
.github/ISSUE_TEMPLATE/bug-report.md View File

@@ -39,4 +39,4 @@ If applicable, add screenshots to help explain your problem.
39 39
  - OS:
40 40
  - OS version:
41 41
  - react-native version:
42
- - webview version:
42
+ - @react-native-community/webview version:

+ 2
- 2
README.md View File

@@ -55,12 +55,12 @@ Current Version: ![version](https://img.shields.io/npm/v/webview.svg)
55 55
 
56 56
 ## Usage
57 57
 
58
-Import the `WebView` component from `webview` and use it like so:
58
+Import the `WebView` component from `@react-native-community/webview` and use it like so:
59 59
 
60 60
 ```jsx
61 61
 import React, { Component } from 'react';
62 62
 import { StyleSheet, Text, View } from 'react-native';
63
-import { WebView } from 'webview';
63
+import { WebView } from '@react-native-community/webview';
64 64
 
65 65
 // ...
66 66
 class MyWebComponent extends Component {

+ 1
- 1
docs/Custom-Android.md View File

@@ -176,7 +176,7 @@ To get your native component, you must use `requireNativeComponent`: the same as
176 176
 ```javascript
177 177
 import React, {Component, PropTypes} from 'react';
178 178
 import {requireNativeComponent} from 'react-native';
179
-import {WebView} from 'webview';
179
+import {WebView} from '@react-native-community/webview';
180 180
 
181 181
 export default class CustomWebView extends Component {
182 182
   static propTypes = WebView.propTypes;

+ 10
- 10
docs/Getting-Started.md View File

@@ -2,16 +2,16 @@
2 2
 
3 3
 Here's how to get started quickly with the React Native WebView.
4 4
 
5
-## 1. Add webview to your dependencies
5
+## 1. Add @react-native-community/webview to your dependencies
6 6
 
7 7
 ```
8
-$ yarn add webview
8
+$ yarn add @react-native-community/webview
9 9
 ```
10 10
  (or)
11 11
  
12 12
  For npm use
13 13
 ```
14
-$ npm install --save webview
14
+$ npm install --save @react-native-community/webview
15 15
 ```
16 16
 
17 17
 ## 2. Link native dependencies
@@ -21,10 +21,10 @@ From react-native 0.60 autolinking will take care of the link step but don't for
21 21
 React Native modules that include native Objective-C, Swift, Java, or Kotlin code have to be "linked" so that the compiler knows to include them in the app.
22 22
 
23 23
 ```
24
-$ react-native link webview
24
+$ react-native link @react-native-community/webview
25 25
 ```
26 26
 
27
-_NOTE: If you ever need to uninstall React Native WebView, run `react-native unlink webview` to unlink it._
27
+_NOTE: If you ever need to uninstall React Native WebView, run `react-native unlink @react-native-community/webview` to unlink it._
28 28
 
29 29
 ### iOS:
30 30
 
@@ -38,10 +38,10 @@ If you wish to use cocoapods and haven't set it up yet, please instead refer to
38 38
 
39 39
 ### Android:
40 40
 
41
-Android - webview version <6:
41
+Android - @react-native-community/webview version <6:
42 42
 This module does not require any extra step after running the link command 🎉
43 43
 
44
-Android - webview version >=6.X.X:
44
+Android - @react-native-community/webview version >=6.X.X:
45 45
 Please make sure AndroidX is enabled in your project by editting `android/gradle.properties` and adding 2 lines:
46 46
 
47 47
 ```
@@ -55,13 +55,13 @@ For Android manual installation, please refer to [this article](https://engineer
55 55
 
56 56
 Cocoapod and autolinking is not yet support for react-native macOS but is coming soon.  In the meantime you must manually link.
57 57
 
58
-The method is nearly identical to the [manual linking method for iOS](https://facebook.github.io/react-native/docs/linking-libraries-ios#manual-linking) except that you will include the `node_modules/webview/macos/RNCWebView.xcodeproj` project in your main project and link the `RNCWebView-macOS.a` library. 
58
+The method is nearly identical to the [manual linking method for iOS](https://facebook.github.io/react-native/docs/linking-libraries-ios#manual-linking) except that you will include the `node_modules/@react-native-community/webview/macos/RNCWebView.xcodeproj` project in your main project and link the `RNCWebView-macOS.a` library. 
59 59
 
60 60
 ## 3. Import the webview into your component
61 61
 
62 62
 ```js
63 63
 import React, { Component } from 'react';
64
-import { WebView } from 'webview';
64
+import { WebView } from '@react-native-community/webview';
65 65
 
66 66
 class MyWeb extends Component {
67 67
   render() {
@@ -79,7 +79,7 @@ Minimal example with inline HTML:
79 79
 
80 80
 ```js
81 81
 import React, { Component } from 'react';
82
-import { WebView } from 'webview';
82
+import { WebView } from '@react-native-community/webview';
83 83
 
84 84
 class MyInlineWeb extends Component {
85 85
   render() {

+ 10
- 10
docs/Guide.md View File

@@ -22,7 +22,7 @@ The simplest way to use the WebView is to simply pipe in the HTML you want to di
22 22
 
23 23
 ```js
24 24
 import React, { Component } from 'react';
25
-import { WebView } from 'webview';
25
+import { WebView } from '@react-native-community/webview';
26 26
 
27 27
 class MyInlineWeb extends Component {
28 28
   render() {
@@ -44,7 +44,7 @@ This is the most common use-case for WebView.
44 44
 
45 45
 ```js
46 46
 import React, { Component } from 'react';
47
-import { WebView } from 'webview';
47
+import { WebView } from '@react-native-community/webview';
48 48
 
49 49
 class MyWeb extends Component {
50 50
   render() {
@@ -61,7 +61,7 @@ Sometimes you would have bundled an HTML file along with the app and would like
61 61
 
62 62
 ```js
63 63
 import React, { Component } from 'react';
64
-import { WebView } from 'webview';
64
+import { WebView } from '@react-native-community/webview';
65 65
 
66 66
 const myHtmlFile = require("./my-asset-folder/local-site.html");
67 67
 
@@ -78,7 +78,7 @@ However on Android, you need to place the HTML file inside your android project'
78 78
 
79 79
 ```js
80 80
 import React, { Component } from 'react';
81
-import { WebView } from 'webview';
81
+import { WebView } from '@react-native-community/webview';
82 82
 
83 83
 class MyWeb extends Component {
84 84
   render() {
@@ -95,7 +95,7 @@ Sometimes you want to intercept a user tapping on a link in your webview and do
95 95
 
96 96
 ```js
97 97
 import React, { Component } from 'react';
98
-import { WebView } from 'webview';
98
+import { WebView } from '@react-native-community/webview';
99 99
 
100 100
 class MyWeb extends Component {
101 101
   webview = null;
@@ -196,7 +196,7 @@ Add permission in AndroidManifest.xml:
196 196
 File Upload using `<input type="file" />` is not supported for Android 4.4 KitKat (see [details](https://github.com/delight-im/Android-AdvancedWebView/issues/4#issuecomment-70372146)):
197 197
 
198 198
 ```
199
-import { WebView } from "webview";
199
+import { WebView } from "@react-native-community/webview";
200 200
 
201 201
 WebView.isFileUploadSupported().then(res => {
202 202
   if (res === true) {
@@ -265,7 +265,7 @@ This is a script that runs immediately after the web page loads for the first ti
265 265
 ```jsx
266 266
 import React, { Component } from 'react';
267 267
 import { View } from 'react-native';
268
-import { WebView } from 'webview';
268
+import { WebView } from '@react-native-community/webview';
269 269
 
270 270
 export default class App extends Component {
271 271
   render() {
@@ -306,7 +306,7 @@ This is a script that runs **before** the web page loads for the first time. It
306 306
 ```jsx
307 307
 import React, { Component } from 'react';
308 308
 import { View } from 'react-native';
309
-import { WebView } from 'webview';
309
+import { WebView } from '@react-native-community/webview';
310 310
 
311 311
 export default class App extends Component {
312 312
   render() {
@@ -338,7 +338,7 @@ While convenient, the downside to the previously mentioned `injectedJavaScript`
338 338
 ```jsx
339 339
 import React, { Component } from 'react';
340 340
 import { View } from 'react-native';
341
-import { WebView } from 'webview';
341
+import { WebView } from '@react-native-community/webview';
342 342
 
343 343
 export default class App extends Component {
344 344
   render() {
@@ -386,7 +386,7 @@ You _must_ set `onMessage` or the `window.ReactNativeWebView.postMessage` method
386 386
 ```jsx
387 387
 import React, { Component } from 'react';
388 388
 import { View } from 'react-native';
389
-import { WebView } from 'webview';
389
+import { WebView } from '@react-native-community/webview';
390 390
 
391 391
 export default class App extends Component {
392 392
   render() {

+ 1
- 1
docs/README.portuguese.md View File

@@ -57,7 +57,7 @@ Importe o componente `WebView` de `webview` e use assim:
57 57
 ```jsx
58 58
 import React, { Component } from 'react';
59 59
 import { StyleSheet, Text, View } from 'react-native';
60
-import { WebView } from 'webview';
60
+import { WebView } from '@react-native-community/webview';
61 61
 
62 62
 // ...
63 63
 class MyWebComponent extends Component {

+ 1
- 1
example/ios/Podfile View File

@@ -5,7 +5,7 @@ project './example.xcodeproj'
5 5
 
6 6
 target 'example' do
7 7
   # Pods for example
8
-  pod 'webview', :path => "../.."
8
+  pod 'react-native-webview', :path => "../.."
9 9
   pod 'FBLazyVector', :path => "../../node_modules/react-native/Libraries/FBLazyVector"
10 10
   pod 'FBReactNativeSpec', :path => "../../node_modules/react-native/Libraries/FBReactNativeSpec"
11 11
   pod 'RCTRequired', :path => "../../node_modules/react-native/Libraries/RCTRequired"

+ 4
- 4
example/ios/Podfile.lock View File

@@ -182,7 +182,7 @@ PODS:
182 182
     - React-cxxreact (= 0.61.5)
183 183
     - React-jsi (= 0.61.5)
184 184
   - React-jsinspector (0.61.5)
185
-  - webview (8.0.6):
185
+  - react-native-webview (8.1.0):
186 186
     - React
187 187
   - React-RCTActionSheet (0.61.5):
188 188
     - React-Core/RCTActionSheetHeaders (= 0.61.5)
@@ -238,7 +238,7 @@ DEPENDENCIES:
238 238
   - React-jsi (from `../../node_modules/react-native/ReactCommon/jsi`)
239 239
   - React-jsiexecutor (from `../../node_modules/react-native/ReactCommon/jsiexecutor`)
240 240
   - React-jsinspector (from `../../node_modules/react-native/ReactCommon/jsinspector`)
241
-  - webview (from `../..`)
241
+  - react-native-webview (from `../..`)
242 242
   - React-RCTActionSheet (from `../../node_modules/react-native/Libraries/ActionSheetIOS`)
243 243
   - React-RCTAnimation (from `../../node_modules/react-native/Libraries/NativeAnimation`)
244 244
   - React-RCTBlob (from `../../node_modules/react-native/Libraries/Blob`)
@@ -285,7 +285,7 @@ EXTERNAL SOURCES:
285 285
     :path: "../../node_modules/react-native/ReactCommon/jsiexecutor"
286 286
   React-jsinspector:
287 287
     :path: "../../node_modules/react-native/ReactCommon/jsinspector"
288
-  webview:
288
+  react-native-webview:
289 289
     :path: "../.."
290 290
   React-RCTActionSheet:
291 291
     :path: "../../node_modules/react-native/Libraries/ActionSheetIOS"
@@ -326,7 +326,7 @@ SPEC CHECKSUMS:
326 326
   React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7
327 327
   React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
328 328
   React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
329
-  webview: 222d83c9c489e09b5d3541519110a637490ad4fa
329
+  react-native-webview: 6a787655a50a59c309ea032561ea8a8d8b8d1c45
330 330
   React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
331 331
   React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
332 332
   React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72

+ 1
- 1
package.json View File

@@ -1,5 +1,5 @@
1 1
 {
2
-  "name": "webview",
2
+  "name": "@react-native-community/webview",
3 3
   "description": "React Native WebView component for iOS, Android, and macOS",
4 4
   "main": "index.js",
5 5
   "typings": "index.d.ts",

webview.podspec → react-native-webview.podspec View File

@@ -3,7 +3,7 @@ require 'json'
3 3
 package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4 4
 
5 5
 Pod::Spec.new do |s|
6
-  s.name         = package['name']
6
+  s.name         = "react-native-webview"
7 7
   s.version      = package['version']
8 8
   s.summary      = package['description']
9 9
   s.license      = package['license']