Support RN v0.60.0, use react-native-webview instead RN build-in WebView (#93)

This commit is contained in:
Vince 2019-09-17 18:02:35 +08:00 коммит произвёл Dongyu Zhao
Родитель 79598ae2b2
Коммит 912efdce7c
22 изменённых файлов: 1663 добавлений и 1338 удалений

20
dist/Components/Basic/Svg.js поставляемый
Просмотреть файл

@ -1,5 +1,6 @@
import * as React from 'react';
import { Platform, WebView } from 'react-native';
import { Platform } from 'react-native';
import { WebView } from 'react-native-webview';
export class Svg extends React.Component {
constructor(props) {
super(props);
@ -16,16 +17,13 @@ export class Svg extends React.Component {
}
get html() {
return (`<html>
<head>
</head>
<body
style="margin:0; padding:0; overflow:hidden; background-color: 'transparent'; height:100%; width:100%;"
>
<img src="${this.src}"
alt="${this.alt}"
style="position:fixed; top:0; left:0; background-color: 'transparent'; height:100%; width:100%;"
/>
</body>
<head>
<meta charset="UTF-8">
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,shrink-to-fit=no" name="viewport">
</head>
<body style="margin: 0;">
<img src="${this.src}" alt="${this.alt}" />
</body>
</html>`);
}
get src() {

1
dist/Views/Factories/ActionFactory.d.ts поставляемый
Просмотреть файл

@ -1,4 +1,3 @@
/// <reference types="react" />
import { OpenUrlActionModel } from '../../Models/Actions/OpenUrlAction';
import { ShowCardActionModel } from '../../Models/Actions/ShowCardAction';
import { SubmitActionModel } from '../../Models/Actions/SubmitAction';

1
dist/Views/Factories/ContentFactory.d.ts поставляемый
Просмотреть файл

@ -1,4 +1,3 @@
/// <reference types="react" />
import { ContentModel } from '../../Models/Abstract/ContentModel';
export declare class ContentFactory {
static createView(model: ContentModel, index: number, theme: 'default' | 'emphasis'): JSX.Element[];

Просмотреть файл

@ -1,4 +1,3 @@
/// <reference types="react" />
export declare class DebugOutputFactory {
static createDebugOutputBanner(info: string, theme: 'default' | 'emphasis', level: 'info' | 'warning' | 'error' | 'success'): JSX.Element;
}

Просмотреть файл

@ -0,0 +1,4 @@
{
"39a3ac05142990761a647c6ddb3e5ae45b727dfe8c0905a2a45401f6c0203f9a": true,
"a05284cf69c245805b3bc16a16d9a1754e7f5e60188f74e56e4bad3782ebbfdf": true
}

Просмотреть файл

@ -1,5 +1,6 @@
import * as React from 'react';
import { Platform, WebView } from 'react-native';
import { Platform } from 'react-native';
import { WebView } from 'react-native-webview';
export class Svg extends React.Component {
constructor(props) {
super(props);
@ -16,16 +17,13 @@ export class Svg extends React.Component {
}
get html() {
return (`<html>
<head>
</head>
<body
style="margin:0; padding:0; overflow:hidden; background-color: 'transparent'; height:100%; width:100%;"
>
<img src="${this.src}"
alt="${this.alt}"
style="position:fixed; top:0; left:0; background-color: 'transparent'; height:100%; width:100%;"
/>
</body>
<head>
<meta charset="UTF-8">
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,shrink-to-fit=no" name="viewport">
</head>
<body style="margin: 0;">
<img src="${this.src}" alt="${this.alt}" />
</body>
</html>`);
}
get src() {

Просмотреть файл

@ -1,4 +1,3 @@
/// <reference types="react" />
import { OpenUrlActionModel } from '../../Models/Actions/OpenUrlAction';
import { ShowCardActionModel } from '../../Models/Actions/ShowCardAction';
import { SubmitActionModel } from '../../Models/Actions/SubmitAction';

Просмотреть файл

@ -1,4 +1,3 @@
/// <reference types="react" />
import { ContentModel } from '../../Models/Abstract/ContentModel';
export declare class ContentFactory {
static createView(model: ContentModel, index: number, theme: 'default' | 'emphasis'): JSX.Element[];

Просмотреть файл

@ -1,4 +1,3 @@
/// <reference types="react" />
export declare class DebugOutputFactory {
static createDebugOutputBanner(info: string, theme: 'default' | 'emphasis', level: 'info' | 'warning' | 'error' | 'success'): JSX.Element;
}

Просмотреть файл

@ -30,7 +30,8 @@ export default class App extends React.Component {
padding: 10,
backgroundColor: 'white',
}}>
<AdaptiveCards adaptiveCard={BingAnswer.whatIsTheWeather} onSubmit={this.onSubmit} onInfo={this.onInfo} onError={this.onError} onWarning={this.onWarning} onOpenUrl={this.onOpenUrl}/>
{this.renderGap()}
<AdaptiveCards adaptiveCard={mockData.inputs} onSubmit={this.onSubmit} onInfo={this.onInfo} onError={this.onError} onWarning={this.onWarning} onOpenUrl={this.onOpenUrl}/>
{this.renderGap()}
</ScrollView>

Просмотреть файл

@ -4,7 +4,7 @@
"description": "This project is really great.",
"slug": "react-native-adaptivecards",
"privacy": "public",
"sdkVersion": "31.0.0",
"sdkVersion": "34.0.0",
"platforms": ["ios", "android"],
"version": "1.0.0",
"orientation": "portrait",

Просмотреть файл

@ -9,13 +9,16 @@
"eject": "expo eject"
},
"dependencies": {
"@babel/runtime": "7.1.5",
"schedule": "^0.4.0",
"expo": "^31.0.5",
"react": "16.6.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz"
"expo": "^34.0.1",
"lodash-es": "4.17.14",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-webview": "~5.12.0",
"schedule": "^0.5.0"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0"
"@babel/core": "^7.5.5",
"@babel/runtime": "^7.5.5",
"babel-preset-expo": "^5.2.0"
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,7 +1,7 @@
{
"name": "react-native-adaptivecards",
"description": "React Native implementation of AdaptiveCards.",
"version": "0.1.36",
"version": "0.1.37",
"repository": {
"url": "git+https://github.com/Microsoft/react-native-adaptivecards",
"type": "git"
@ -36,8 +36,8 @@
},
"devDependencies": {
"@types/lodash-es": "4.17.3",
"@types/react": "16.8.3",
"@types/react-native": "0.57.36",
"@types/react": "16.8.6",
"@types/react-native": "0.60.0",
"del": "5.1.0",
"gulp": "4.0.2",
"gulp-imagemin": "6.1.0",
@ -45,11 +45,14 @@
"gulp-tslint": "8.1.4",
"gulp-typescript": "5.0.1",
"react-devtools": "3.6.3",
"react-native-webview": "^7.0.5",
"run-sequence": "2.2.1",
"tslint": "5.20.0",
"typescript": "3.6.2"
},
"dependencies": {
"lodash-es": "4.17.14"
"dependencies": {},
"peerDependencies": {
"lodash-es": "4.17.14",
"react-native-webview": "^7.0.5"
}
}

Просмотреть файл

@ -1,5 +1,6 @@
import * as React from 'react';
import { Platform, StyleProp, ViewStyle, WebView } from 'react-native';
import { Platform, StyleProp, ViewStyle } from 'react-native';
import { WebView } from 'react-native-webview';
interface IProps {
url: string;
@ -22,7 +23,7 @@ export class Svg extends React.Component<IProps> {
scrollEnabled={false}
style={[
{
flex: 1,
alignSelf: 'stretch',
backgroundColor: 'transparent',
@ -36,16 +37,13 @@ export class Svg extends React.Component<IProps> {
private get html() {
return (
`<html>
<head>
</head>
<body
style="margin:0; padding:0; overflow:hidden; background-color: 'transparent'; height:100%; width:100%;"
>
<img src="${this.src}"
alt="${this.alt}"
style="position:fixed; top:0; left:0; background-color: 'transparent'; height:100%; width:100%;"
/>
</body>
<head>
<meta charset="UTF-8">
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,shrink-to-fit=no" name="viewport">
</head>
<body style="margin: 0;">
<img src="${this.src}" alt="${this.alt}" />
</body>
</html>`
);
}

Просмотреть файл

@ -18,6 +18,7 @@
"license": "ISC",
"dependencies": {
"antd": "^3.20.5",
"lodash-es": "4.17.14",
"prop-types": "^15.6.2",
"react": "16.3.1",
"react-art": "16.3.1",
@ -27,6 +28,7 @@
"react-native": "^0.56.0",
"react-native-vector-icons": "^5.0.0",
"react-native-web": "0.6.0",
"react-native-webview": "^7.0.5",
"react-redux": "^5.0.7",
"react-router": "^4.3.1",
"react-split-pane": "^0.1.87",

Просмотреть файл

@ -1,5 +1,6 @@
import * as React from 'react';
import { Platform, WebView } from 'react-native';
import { Platform } from 'react-native';
import { WebView } from 'react-native-webview';
export class Svg extends React.Component {
constructor(props) {
super(props);
@ -16,16 +17,13 @@ export class Svg extends React.Component {
}
get html() {
return (`<html>
<head>
</head>
<body
style="margin:0; padding:0; overflow:hidden; background-color: 'transparent'; height:100%; width:100%;"
>
<img src="${this.src}"
alt="${this.alt}"
style="position:fixed; top:0; left:0; background-color: 'transparent'; height:100%; width:100%;"
/>
</body>
<head>
<meta charset="UTF-8">
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,shrink-to-fit=no" name="viewport">
</head>
<body style="margin: 0;">
<img src="${this.src}" alt="${this.alt}" />
</body>
</html>`);
}
get src() {

Просмотреть файл

@ -1,4 +1,3 @@
/// <reference types="react" />
import { OpenUrlActionModel } from '../../Models/Actions/OpenUrlAction';
import { ShowCardActionModel } from '../../Models/Actions/ShowCardAction';
import { SubmitActionModel } from '../../Models/Actions/SubmitAction';

Просмотреть файл

@ -1,4 +1,3 @@
/// <reference types="react" />
import { ContentModel } from '../../Models/Abstract/ContentModel';
export declare class ContentFactory {
static createView(model: ContentModel, index: number, theme: 'default' | 'emphasis'): JSX.Element[];

Просмотреть файл

@ -1,4 +1,3 @@
/// <reference types="react" />
export declare class DebugOutputFactory {
static createDebugOutputBanner(info: string, theme: 'default' | 'emphasis', level: 'info' | 'warning' | 'error' | 'success'): JSX.Element;
}

Просмотреть файл

@ -3043,7 +3043,7 @@ escape-html@~1.0.3:
version "1.0.3"
resolved "http://registry.npm.taobao.org/escape-html/download/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "http://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@ -4166,7 +4166,7 @@ interpret@^1.1.0:
version "1.1.0"
resolved "http://registry.npm.taobao.org/interpret/download/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614"
invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2, invariant@^2.2.4:
invariant@2.2.4, invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2, invariant@^2.2.4:
version "2.2.4"
resolved "http://registry.npm.taobao.org/invariant/download/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
dependencies:
@ -4680,6 +4680,11 @@ locate-path@^3.0.0:
p-locate "^3.0.0"
path-exists "^3.0.0"
lodash-es@4.17.14:
version "4.17.14"
resolved "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.14.tgz#12a95a963cc5955683cee3b74e85458954f37ecc"
integrity sha512-7zchRrGa8UZXjD/4ivUWP1867jDkhzTG2c/uj739utSd7O/pFFdxspCemIFKEEjErbcqRzn8nKnGsi7mvTgRPA==
lodash-es@^4.17.5:
version "4.17.10"
resolved "http://registry.npm.taobao.org/lodash-es/download/lodash-es-4.17.10.tgz#62cd7104cdf5dd87f235a837f0ede0e8e5117e05"
@ -6687,6 +6692,14 @@ react-native-web@0.6.0:
prop-types "^15.6.0"
react-timer-mixin "^0.13.3"
react-native-webview@^7.0.5:
version "7.0.5"
resolved "https://registry.npmjs.org/react-native-webview/-/react-native-webview-7.0.5.tgz#1dd9d4f2856bda86a40222eca3612bf2152bacd3"
integrity sha512-FWY3tjbyV3Uhuw1JxJ0zs2HspJ5HAsIfkJaquURsVWQnTdZPnkSQjHWQp0PzGIwJ1PPVOA/gnhRmd7SZU/Br5Q==
dependencies:
escape-string-regexp "1.0.5"
invariant "2.2.4"
react-native@^0.56.0:
version "0.56.0"
resolved "http://registry.npm.taobao.org/react-native/download/react-native-0.56.0.tgz#66686f781ec39a44376aadd4bbc55c8573ab61e5"

Просмотреть файл

@ -65,7 +65,7 @@
"@types/lodash-es@4.17.3":
version "4.17.3"
resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.3.tgz#87eb0b3673b076b8ee655f1890260a136af09a2d"
resolved "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.3.tgz#87eb0b3673b076b8ee655f1890260a136af09a2d"
integrity sha512-iHI0i7ZAL1qepz1Y7f3EKg/zUMDwDfTzitx+AlHhJJvXwenP682ZyGbgPSc5Ej3eEAKVbNWKFuwOadCj5vBbYQ==
dependencies:
"@types/lodash" "*"
@ -100,15 +100,15 @@
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.1.tgz#48fd98c1561fe718b61733daed46ff115b496e18"
integrity sha512-eqz8c/0kwNi/OEHQfvIuJVLTst3in0e7uTKeuY+WL/zfKn0xVujOTp42bS/vUUokhK5P2BppLd9JXMOMHcgbjA==
"@types/react-native@0.57.36":
version "0.57.36"
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.57.36.tgz#b8e8c2c119fd0f9227f32ee260b7abf223f47960"
integrity sha512-6u2WWupQ+mVRsICZqiy3BCGi9vivluhut/+Z1dbjXKn9ms9MrCVvnyQ0jyooqhtmtRzquH6mYYNYArGYdEajjg==
"@types/react-native@0.60.0":
version "0.60.0"
resolved "https://registry.npmjs.org/@types/react-native/-/react-native-0.60.0.tgz#992ecf1e59c4a92ffa1c1b92c669802e433acd05"
integrity sha512-9av+Wgh3j7nQzK6MXIGMqc57M53Ilfcyhq49SRzO/Jv9e7PdQNjJrCiXoHSvtKwuQpwxMkomAfnbcxxkp0zzBw==
dependencies:
"@types/prop-types" "*"
"@types/react" "*"
"@types/react@*", "@types/react@16.8.3":
"@types/react@*":
version "16.8.3"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.3.tgz#7b67956f682bea30a5a09b3242c0784ff196c848"
integrity sha512-PjPocAxL9SNLjYMP4dfOShW/rj9FDBJGu3JFRt0zEYf77xfihB6fq8zfDpMrV6s82KnAi7F1OEe5OsQX25Ybdw==
@ -116,6 +116,14 @@
"@types/prop-types" "*"
csstype "^2.2.0"
"@types/react@16.8.6":
version "16.8.6"
resolved "https://registry.npmjs.org/@types/react/-/react-16.8.6.tgz#fa1de3fe56cc9b6afeddc73d093d7f30fd5e31cc"
integrity sha512-bN9qDjEMltmHrl0PZRI4IF2AbB7V5UlRfG+OOduckVnRQ4VzXVSzy/1eLAh778IEqhTnW0mmgL9yShfinNverA==
dependencies:
"@types/prop-types" "*"
csstype "^2.2.0"
abbrev@1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
@ -1447,7 +1455,7 @@ es6-weak-map@^2.0.1:
es6-iterator "^2.0.1"
es6-symbol "^3.1.1"
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
@ -2468,6 +2476,13 @@ into-stream@^3.1.0:
from2 "^2.1.1"
p-is-promise "^1.1.0"
invariant@2.2.4:
version "2.2.4"
resolved "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
dependencies:
loose-envify "^1.0.0"
invert-kv@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
@ -2843,7 +2858,7 @@ jpegtran-bin@^4.0.0:
bin-wrapper "^4.0.0"
logalot "^2.0.0"
js-tokens@^4.0.0:
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
@ -3030,11 +3045,6 @@ load-json-file@^1.0.0:
pinkie-promise "^2.0.0"
strip-bom "^2.0.0"
lodash-es@4.17.14:
version "4.17.14"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.14.tgz#12a95a963cc5955683cee3b74e85458954f37ecc"
integrity sha512-7zchRrGa8UZXjD/4ivUWP1867jDkhzTG2c/uj739utSd7O/pFFdxspCemIFKEEjErbcqRzn8nKnGsi7mvTgRPA==
logalot@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/logalot/-/logalot-2.1.0.tgz#5f8e8c90d304edf12530951a5554abb8c5e3f552"
@ -3048,6 +3058,13 @@ longest@^1.0.0:
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
integrity sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=
loose-envify@^1.0.0:
version "1.4.0"
resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
dependencies:
js-tokens "^3.0.0 || ^4.0.0"
loud-rejection@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f"
@ -3973,6 +3990,14 @@ react-devtools@3.6.3:
react-devtools-core "^3.6.0"
update-notifier "^2.1.0"
react-native-webview@^7.0.5:
version "7.0.5"
resolved "https://registry.npmjs.org/react-native-webview/-/react-native-webview-7.0.5.tgz#1dd9d4f2856bda86a40222eca3612bf2152bacd3"
integrity sha512-FWY3tjbyV3Uhuw1JxJ0zs2HspJ5HAsIfkJaquURsVWQnTdZPnkSQjHWQp0PzGIwJ1PPVOA/gnhRmd7SZU/Br5Q==
dependencies:
escape-string-regexp "1.0.5"
invariant "2.2.4"
read-pkg-up@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"