fix(deps): updated dependancies and types (#847)
* wip * Update WebViewShared.tsx * Update config.yml
This commit is contained in:
parent
36ffbe0700
commit
85b921ce64
|
@ -1,7 +1,7 @@
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
working_directory: ~/code
|
working_directory: ~/code
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:10.6.0-browsers
|
- image: circleci/node:12.9.1-browsers
|
||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
jobs:
|
jobs:
|
||||||
|
|
28
.eslintrc.js
28
.eslintrc.js
|
@ -20,10 +20,17 @@ module.exports = {
|
||||||
// Remove this rule because we only destructure props, but never state
|
// Remove this rule because we only destructure props, but never state
|
||||||
'react/destructuring-assignment': 'off',
|
'react/destructuring-assignment': 'off',
|
||||||
'react/prop-types': 'off',
|
'react/prop-types': 'off',
|
||||||
|
'react/jsx-props-no-spreading': 'off',
|
||||||
|
'react/static-property-placement': 'off',
|
||||||
|
'react/state-in-constructor': 'off',
|
||||||
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
||||||
'@typescript-eslint/array-type': ['error', 'array'],
|
'@typescript-eslint/array-type': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
default: 'array',
|
||||||
|
},
|
||||||
|
],
|
||||||
'@typescript-eslint/generic-type-naming': ['error', '^[a-zA-Z]+$'],
|
'@typescript-eslint/generic-type-naming': ['error', '^[a-zA-Z]+$'],
|
||||||
'@typescript-eslint/no-angle-bracket-type-assertion': 'error',
|
|
||||||
'@typescript-eslint/no-array-constructor': 'error',
|
'@typescript-eslint/no-array-constructor': 'error',
|
||||||
'@typescript-eslint/no-empty-interface': 'error',
|
'@typescript-eslint/no-empty-interface': 'error',
|
||||||
'@typescript-eslint/no-explicit-any': 'error',
|
'@typescript-eslint/no-explicit-any': 'error',
|
||||||
|
@ -32,10 +39,18 @@ module.exports = {
|
||||||
'@typescript-eslint/no-misused-new': 'error',
|
'@typescript-eslint/no-misused-new': 'error',
|
||||||
'@typescript-eslint/no-namespace': 'error',
|
'@typescript-eslint/no-namespace': 'error',
|
||||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||||
'@typescript-eslint/no-object-literal-type-assertion': 'error',
|
'@typescript-eslint/consistent-type-assertions': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
assertionStyle: 'as',
|
||||||
|
},
|
||||||
|
],
|
||||||
'@typescript-eslint/no-parameter-properties': 'error',
|
'@typescript-eslint/no-parameter-properties': 'error',
|
||||||
'@typescript-eslint/no-this-alias': 'error',
|
'@typescript-eslint/no-this-alias': 'error',
|
||||||
'@typescript-eslint/no-triple-slash-reference': 'error',
|
'@typescript-eslint/triple-slash-reference': [
|
||||||
|
'error',
|
||||||
|
{ path: 'never', types: 'never', lib: 'never' },
|
||||||
|
],
|
||||||
'@typescript-eslint/no-type-alias': [
|
'@typescript-eslint/no-type-alias': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
|
@ -48,7 +63,10 @@ module.exports = {
|
||||||
'error',
|
'error',
|
||||||
{ ignoreRestSiblings: true },
|
{ ignoreRestSiblings: true },
|
||||||
],
|
],
|
||||||
'@typescript-eslint/prefer-interface': 'error',
|
'@typescript-eslint/consistent-type-definitions': [
|
||||||
|
'error',
|
||||||
|
'interface',
|
||||||
|
],
|
||||||
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
||||||
'@typescript-eslint/type-annotation-spacing': 'error',
|
'@typescript-eslint/type-annotation-spacing': 'error',
|
||||||
},
|
},
|
||||||
|
|
41
package.json
41
package.json
|
@ -27,34 +27,33 @@
|
||||||
"react-native": ">=0.60 <0.62"
|
"react-native": ">=0.60 <0.62"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"escape-string-regexp": "1.0.5",
|
"escape-string-regexp": "2.0.0",
|
||||||
"invariant": "2.2.4"
|
"invariant": "2.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.3.4",
|
"@babel/core": "7.5.5",
|
||||||
"@semantic-release/git": "7.0.5",
|
"@semantic-release/git": "7.0.16",
|
||||||
"@types/escape-string-regexp": "1.0.0",
|
"@types/invariant": "^2.2.30",
|
||||||
"@types/invariant": "^2.2.29",
|
"@types/jest": "24.0.18",
|
||||||
"@types/jest": "24.0.11",
|
|
||||||
"@types/react": "16.8.8",
|
"@types/react": "16.8.8",
|
||||||
"@types/react-native": "0.57.40",
|
"@types/react-native": "0.60.11",
|
||||||
"@typescript-eslint/eslint-plugin": "1.4.2",
|
"@typescript-eslint/eslint-plugin": "2.1.0",
|
||||||
"@typescript-eslint/parser": "1.4.2",
|
"@typescript-eslint/parser": "2.1.0",
|
||||||
"babel-eslint": "10.0.1",
|
"babel-eslint": "10.0.3",
|
||||||
"babel-jest": "^24.0.0",
|
"babel-jest": "^24.9.0",
|
||||||
"eslint": "5.15.1",
|
"eslint": "6.3.0",
|
||||||
"eslint-config-airbnb": "17.1.0",
|
"eslint-config-airbnb": "18.0.1",
|
||||||
"eslint-config-prettier": "4.1.0",
|
"eslint-config-prettier": "6.2.0",
|
||||||
"eslint-plugin-import": "2.16.0",
|
"eslint-plugin-import": "2.18.2",
|
||||||
"eslint-plugin-jsx-a11y": "6.2.1",
|
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||||
"eslint-plugin-react": "7.12.4",
|
"eslint-plugin-react": "7.14.3",
|
||||||
"eslint-plugin-react-native": "3.6.0",
|
"eslint-plugin-react-native": "3.7.0",
|
||||||
"jest": "24.5.0",
|
"jest": "24.9.0",
|
||||||
"metro-react-native-babel-preset": "0.53.1",
|
"metro-react-native-babel-preset": "0.53.1",
|
||||||
"react": "16.8.3",
|
"react": "16.8.3",
|
||||||
"react-native": "0.60.5",
|
"react-native": "0.60.5",
|
||||||
"semantic-release": "15.10.3",
|
"semantic-release": "15.13.24",
|
||||||
"typescript": "3.3.3333"
|
"typescript": "3.6.2"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -26,12 +26,12 @@ import {
|
||||||
AndroidWebViewProps,
|
AndroidWebViewProps,
|
||||||
NativeWebViewAndroid,
|
NativeWebViewAndroid,
|
||||||
State,
|
State,
|
||||||
CustomUIManager,
|
RNCWebViewUIManager,
|
||||||
} from './WebViewTypes';
|
} from './WebViewTypes';
|
||||||
|
|
||||||
import styles from './WebView.styles';
|
import styles from './WebView.styles';
|
||||||
|
|
||||||
const UIManager = NotTypedUIManager as CustomUIManager;
|
const UIManager = NotTypedUIManager as RNCWebViewUIManager;
|
||||||
|
|
||||||
const RNCWebView = requireNativeComponent(
|
const RNCWebView = requireNativeComponent(
|
||||||
'RNCWebView',
|
'RNCWebView',
|
||||||
|
@ -73,7 +73,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().goForward,
|
this.getCommands().goForward,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +80,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().goBack,
|
this.getCommands().goBack,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,7 +90,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().reload,
|
this.getCommands().reload,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -100,7 +97,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().stopLoading,
|
this.getCommands().stopLoading,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,7 +104,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().requestFocus,
|
this.getCommands().requestFocus,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -268,7 +263,7 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
||||||
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
||||||
this.onShouldStartLoadWithRequestCallback,
|
this.onShouldStartLoadWithRequestCallback,
|
||||||
// casting cause it's in the default props
|
// casting cause it's in the default props
|
||||||
originWhitelist as ReadonlyArray<string>,
|
originWhitelist as readonly string[],
|
||||||
onShouldStartLoadWithRequestProp,
|
onShouldStartLoadWithRequestProp,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,12 @@ import {
|
||||||
NativeWebViewIOS,
|
NativeWebViewIOS,
|
||||||
ViewManager,
|
ViewManager,
|
||||||
State,
|
State,
|
||||||
CustomUIManager,
|
RNCWebViewUIManager,
|
||||||
} from './WebViewTypes';
|
} from './WebViewTypes';
|
||||||
|
|
||||||
import styles from './WebView.styles';
|
import styles from './WebView.styles';
|
||||||
|
|
||||||
const UIManager = NotTypedUIManager as CustomUIManager;
|
const UIManager = NotTypedUIManager as RNCWebViewUIManager;
|
||||||
|
|
||||||
const { resolveAssetSource } = Image;
|
const { resolveAssetSource } = Image;
|
||||||
const processDecelerationRate = (
|
const processDecelerationRate = (
|
||||||
|
@ -82,7 +82,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().goForward,
|
this.getCommands().goForward,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,7 +92,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().goBack,
|
this.getCommands().goBack,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,7 +103,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().reload,
|
this.getCommands().reload,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,7 +113,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().stopLoading,
|
this.getCommands().stopLoading,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -127,7 +123,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
||||||
UIManager.dispatchViewManagerCommand(
|
UIManager.dispatchViewManagerCommand(
|
||||||
this.getWebViewHandle(),
|
this.getWebViewHandle(),
|
||||||
this.getCommands().requestFocus,
|
this.getCommands().requestFocus,
|
||||||
null,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -301,7 +296,7 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
||||||
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
||||||
this.onShouldStartLoadWithRequestCallback,
|
this.onShouldStartLoadWithRequestCallback,
|
||||||
// casting cause it's in the default props
|
// casting cause it's in the default props
|
||||||
originWhitelist as ReadonlyArray<string>,
|
originWhitelist as readonly string[],
|
||||||
onShouldStartLoadWithRequestProp,
|
onShouldStartLoadWithRequestProp,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ const originWhitelistToRegex = (originWhitelist: string): string =>
|
||||||
`^${escapeStringRegexp(originWhitelist).replace(/\\\*/g, '.*')}`;
|
`^${escapeStringRegexp(originWhitelist).replace(/\\\*/g, '.*')}`;
|
||||||
|
|
||||||
const passesWhitelist = (
|
const passesWhitelist = (
|
||||||
compiledWhitelist: ReadonlyArray<string>,
|
compiledWhitelist: readonly string[],
|
||||||
url: string,
|
url: string,
|
||||||
) => {
|
) => {
|
||||||
const origin = extractOrigin(url);
|
const origin = extractOrigin(url);
|
||||||
|
@ -26,8 +26,8 @@ const passesWhitelist = (
|
||||||
};
|
};
|
||||||
|
|
||||||
const compileWhitelist = (
|
const compileWhitelist = (
|
||||||
originWhitelist: ReadonlyArray<string>,
|
originWhitelist: readonly string[],
|
||||||
): ReadonlyArray<string> =>
|
): readonly string[] =>
|
||||||
['about:blank', ...(originWhitelist || [])].map(originWhitelistToRegex);
|
['about:blank', ...(originWhitelist || [])].map(originWhitelistToRegex);
|
||||||
|
|
||||||
const createOnShouldStartLoadWithRequest = (
|
const createOnShouldStartLoadWithRequest = (
|
||||||
|
@ -36,7 +36,7 @@ const createOnShouldStartLoadWithRequest = (
|
||||||
url: string,
|
url: string,
|
||||||
lockIdentifier: number,
|
lockIdentifier: number,
|
||||||
) => void,
|
) => void,
|
||||||
originWhitelist: ReadonlyArray<string>,
|
originWhitelist: readonly string[],
|
||||||
onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest,
|
onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest,
|
||||||
) => {
|
) => {
|
||||||
return ({ nativeEvent }: WebViewNavigationEvent) => {
|
return ({ nativeEvent }: WebViewNavigationEvent) => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* eslint-disable react/no-multi-comp */
|
/* eslint-disable react/no-multi-comp, max-classes-per-file */
|
||||||
|
|
||||||
import { ReactElement, Component } from 'react';
|
import { ReactElement, Component } from 'react';
|
||||||
import {
|
import {
|
||||||
|
@ -11,30 +11,22 @@ import {
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
|
||||||
export interface WebViewCommands {
|
export interface WebViewCommands {
|
||||||
goForward: Function;
|
goForward: number;
|
||||||
goBack: Function;
|
goBack: number;
|
||||||
reload: Function;
|
reload: number;
|
||||||
stopLoading: Function;
|
stopLoading: number;
|
||||||
postMessage: Function;
|
postMessage: number;
|
||||||
injectJavaScript: Function;
|
injectJavaScript: number;
|
||||||
loadUrl: Function;
|
loadUrl: number;
|
||||||
requestFocus: Function;
|
requestFocus: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomUIManager extends UIManagerStatic {
|
export interface RNCWebViewUIManager extends UIManagerStatic {
|
||||||
getViewManagerConfig: (
|
getViewManagerConfig: (
|
||||||
name: string,
|
name: 'RNCWebView',
|
||||||
) => {
|
) => {
|
||||||
Commands: WebViewCommands;
|
Commands: WebViewCommands;
|
||||||
};
|
};
|
||||||
dispatchViewManagerCommand: (
|
|
||||||
viewHandle: number,
|
|
||||||
command: Function,
|
|
||||||
params: object | null,
|
|
||||||
) => void;
|
|
||||||
RNCWebView: {
|
|
||||||
Commands: WebViewCommands;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebViewState = 'IDLE' | 'LOADING' | 'ERROR';
|
type WebViewState = 'IDLE' | 'LOADING' | 'ERROR';
|
||||||
|
@ -246,7 +238,7 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
|
||||||
saveFormDataDisabled?: boolean;
|
saveFormDataDisabled?: boolean;
|
||||||
textZoom?: number;
|
textZoom?: number;
|
||||||
thirdPartyCookiesEnabled?: boolean;
|
thirdPartyCookiesEnabled?: boolean;
|
||||||
urlPrefixesForDefaultIntent?: ReadonlyArray<string>;
|
urlPrefixesForDefaultIntent?: readonly string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
|
export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
|
||||||
|
@ -262,7 +254,7 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
|
||||||
| 'scrollableAxes'
|
| 'scrollableAxes'
|
||||||
| 'never'
|
| 'never'
|
||||||
| 'always';
|
| 'always';
|
||||||
dataDetectorTypes?: DataDetectorTypes | ReadonlyArray<DataDetectorTypes>;
|
dataDetectorTypes?: DataDetectorTypes | readonly DataDetectorTypes[];
|
||||||
decelerationRate?: number;
|
decelerationRate?: number;
|
||||||
directionalLockEnabled?: boolean;
|
directionalLockEnabled?: boolean;
|
||||||
hideKeyboardAccessoryView?: boolean;
|
hideKeyboardAccessoryView?: boolean;
|
||||||
|
@ -360,7 +352,7 @@ export interface IOSWebViewProps extends WebViewSharedProps {
|
||||||
*
|
*
|
||||||
* @platform ios
|
* @platform ios
|
||||||
*/
|
*/
|
||||||
dataDetectorTypes?: DataDetectorTypes | ReadonlyArray<DataDetectorTypes>;
|
dataDetectorTypes?: DataDetectorTypes | readonly DataDetectorTypes[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boolean that determines whether HTML5 videos play inline or use the
|
* Boolean that determines whether HTML5 videos play inline or use the
|
||||||
|
@ -500,7 +492,7 @@ export interface AndroidWebViewProps extends WebViewSharedProps {
|
||||||
* Use this to list URLs that WebView cannot handle, e.g. a PDF url.
|
* Use this to list URLs that WebView cannot handle, e.g. a PDF url.
|
||||||
* @platform android
|
* @platform android
|
||||||
*/
|
*/
|
||||||
urlPrefixesForDefaultIntent?: ReadonlyArray<string>;
|
urlPrefixesForDefaultIntent?: readonly string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only
|
* Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only
|
||||||
|
@ -662,7 +654,7 @@ export interface WebViewSharedProps extends ViewProps {
|
||||||
* this whitelist, we will open the URL in Safari.
|
* this whitelist, we will open the URL in Safari.
|
||||||
* The default whitelisted origins are "http://*" and "https://*".
|
* The default whitelisted origins are "http://*" and "https://*".
|
||||||
*/
|
*/
|
||||||
originWhitelist?: ReadonlyArray<string>;
|
originWhitelist?: readonly string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that allows custom handling of any web view requests. Return
|
* Function that allows custom handling of any web view requests. Return
|
||||||
|
|
Loading…
Reference in New Issue