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
|
||||
working_directory: ~/code
|
||||
docker:
|
||||
- image: circleci/node:10.6.0-browsers
|
||||
- image: circleci/node:12.9.1-browsers
|
||||
|
||||
version: 2
|
||||
jobs:
|
||||
|
|
28
.eslintrc.js
28
.eslintrc.js
|
@ -20,10 +20,17 @@ module.exports = {
|
|||
// Remove this rule because we only destructure props, but never state
|
||||
'react/destructuring-assignment': '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/array-type': ['error', 'array'],
|
||||
'@typescript-eslint/array-type': [
|
||||
'error',
|
||||
{
|
||||
default: 'array',
|
||||
},
|
||||
],
|
||||
'@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-empty-interface': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
|
@ -32,10 +39,18 @@ module.exports = {
|
|||
'@typescript-eslint/no-misused-new': 'error',
|
||||
'@typescript-eslint/no-namespace': '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-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': [
|
||||
'error',
|
||||
{
|
||||
|
@ -48,7 +63,10 @@ module.exports = {
|
|||
'error',
|
||||
{ ignoreRestSiblings: true },
|
||||
],
|
||||
'@typescript-eslint/prefer-interface': 'error',
|
||||
'@typescript-eslint/consistent-type-definitions': [
|
||||
'error',
|
||||
'interface',
|
||||
],
|
||||
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
||||
'@typescript-eslint/type-annotation-spacing': 'error',
|
||||
},
|
||||
|
|
41
package.json
41
package.json
|
@ -27,34 +27,33 @@
|
|||
"react-native": ">=0.60 <0.62"
|
||||
},
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "1.0.5",
|
||||
"escape-string-regexp": "2.0.0",
|
||||
"invariant": "2.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.3.4",
|
||||
"@semantic-release/git": "7.0.5",
|
||||
"@types/escape-string-regexp": "1.0.0",
|
||||
"@types/invariant": "^2.2.29",
|
||||
"@types/jest": "24.0.11",
|
||||
"@babel/core": "7.5.5",
|
||||
"@semantic-release/git": "7.0.16",
|
||||
"@types/invariant": "^2.2.30",
|
||||
"@types/jest": "24.0.18",
|
||||
"@types/react": "16.8.8",
|
||||
"@types/react-native": "0.57.40",
|
||||
"@typescript-eslint/eslint-plugin": "1.4.2",
|
||||
"@typescript-eslint/parser": "1.4.2",
|
||||
"babel-eslint": "10.0.1",
|
||||
"babel-jest": "^24.0.0",
|
||||
"eslint": "5.15.1",
|
||||
"eslint-config-airbnb": "17.1.0",
|
||||
"eslint-config-prettier": "4.1.0",
|
||||
"eslint-plugin-import": "2.16.0",
|
||||
"eslint-plugin-jsx-a11y": "6.2.1",
|
||||
"eslint-plugin-react": "7.12.4",
|
||||
"eslint-plugin-react-native": "3.6.0",
|
||||
"jest": "24.5.0",
|
||||
"@types/react-native": "0.60.11",
|
||||
"@typescript-eslint/eslint-plugin": "2.1.0",
|
||||
"@typescript-eslint/parser": "2.1.0",
|
||||
"babel-eslint": "10.0.3",
|
||||
"babel-jest": "^24.9.0",
|
||||
"eslint": "6.3.0",
|
||||
"eslint-config-airbnb": "18.0.1",
|
||||
"eslint-config-prettier": "6.2.0",
|
||||
"eslint-plugin-import": "2.18.2",
|
||||
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||
"eslint-plugin-react": "7.14.3",
|
||||
"eslint-plugin-react-native": "3.7.0",
|
||||
"jest": "24.9.0",
|
||||
"metro-react-native-babel-preset": "0.53.1",
|
||||
"react": "16.8.3",
|
||||
"react-native": "0.60.5",
|
||||
"semantic-release": "15.10.3",
|
||||
"typescript": "3.3.3333"
|
||||
"semantic-release": "15.13.24",
|
||||
"typescript": "3.6.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -26,12 +26,12 @@ import {
|
|||
AndroidWebViewProps,
|
||||
NativeWebViewAndroid,
|
||||
State,
|
||||
CustomUIManager,
|
||||
RNCWebViewUIManager,
|
||||
} from './WebViewTypes';
|
||||
|
||||
import styles from './WebView.styles';
|
||||
|
||||
const UIManager = NotTypedUIManager as CustomUIManager;
|
||||
const UIManager = NotTypedUIManager as RNCWebViewUIManager;
|
||||
|
||||
const RNCWebView = requireNativeComponent(
|
||||
'RNCWebView',
|
||||
|
@ -73,7 +73,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().goForward,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -81,7 +80,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().goBack,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -92,7 +90,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().reload,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -100,7 +97,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().stopLoading,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -108,7 +104,6 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().requestFocus,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -268,7 +263,7 @@ class WebView extends React.Component<AndroidWebViewProps, State> {
|
|||
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
||||
this.onShouldStartLoadWithRequestCallback,
|
||||
// casting cause it's in the default props
|
||||
originWhitelist as ReadonlyArray<string>,
|
||||
originWhitelist as readonly string[],
|
||||
onShouldStartLoadWithRequestProp,
|
||||
);
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ import {
|
|||
NativeWebViewIOS,
|
||||
ViewManager,
|
||||
State,
|
||||
CustomUIManager,
|
||||
RNCWebViewUIManager,
|
||||
} from './WebViewTypes';
|
||||
|
||||
import styles from './WebView.styles';
|
||||
|
||||
const UIManager = NotTypedUIManager as CustomUIManager;
|
||||
const UIManager = NotTypedUIManager as RNCWebViewUIManager;
|
||||
|
||||
const { resolveAssetSource } = Image;
|
||||
const processDecelerationRate = (
|
||||
|
@ -82,7 +82,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().goForward,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -93,7 +92,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().goBack,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -105,7 +103,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().reload,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -116,7 +113,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().stopLoading,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -127,7 +123,6 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
|||
UIManager.dispatchViewManagerCommand(
|
||||
this.getWebViewHandle(),
|
||||
this.getCommands().requestFocus,
|
||||
null,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -301,7 +296,7 @@ class WebView extends React.Component<IOSWebViewProps, State> {
|
|||
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
||||
this.onShouldStartLoadWithRequestCallback,
|
||||
// casting cause it's in the default props
|
||||
originWhitelist as ReadonlyArray<string>,
|
||||
originWhitelist as readonly string[],
|
||||
onShouldStartLoadWithRequestProp,
|
||||
);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ const originWhitelistToRegex = (originWhitelist: string): string =>
|
|||
`^${escapeStringRegexp(originWhitelist).replace(/\\\*/g, '.*')}`;
|
||||
|
||||
const passesWhitelist = (
|
||||
compiledWhitelist: ReadonlyArray<string>,
|
||||
compiledWhitelist: readonly string[],
|
||||
url: string,
|
||||
) => {
|
||||
const origin = extractOrigin(url);
|
||||
|
@ -26,8 +26,8 @@ const passesWhitelist = (
|
|||
};
|
||||
|
||||
const compileWhitelist = (
|
||||
originWhitelist: ReadonlyArray<string>,
|
||||
): ReadonlyArray<string> =>
|
||||
originWhitelist: readonly string[],
|
||||
): readonly string[] =>
|
||||
['about:blank', ...(originWhitelist || [])].map(originWhitelistToRegex);
|
||||
|
||||
const createOnShouldStartLoadWithRequest = (
|
||||
|
@ -36,7 +36,7 @@ const createOnShouldStartLoadWithRequest = (
|
|||
url: string,
|
||||
lockIdentifier: number,
|
||||
) => void,
|
||||
originWhitelist: ReadonlyArray<string>,
|
||||
originWhitelist: readonly string[],
|
||||
onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest,
|
||||
) => {
|
||||
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 {
|
||||
|
@ -11,30 +11,22 @@ import {
|
|||
} from 'react-native';
|
||||
|
||||
export interface WebViewCommands {
|
||||
goForward: Function;
|
||||
goBack: Function;
|
||||
reload: Function;
|
||||
stopLoading: Function;
|
||||
postMessage: Function;
|
||||
injectJavaScript: Function;
|
||||
loadUrl: Function;
|
||||
requestFocus: Function;
|
||||
goForward: number;
|
||||
goBack: number;
|
||||
reload: number;
|
||||
stopLoading: number;
|
||||
postMessage: number;
|
||||
injectJavaScript: number;
|
||||
loadUrl: number;
|
||||
requestFocus: number;
|
||||
}
|
||||
|
||||
export interface CustomUIManager extends UIManagerStatic {
|
||||
export interface RNCWebViewUIManager extends UIManagerStatic {
|
||||
getViewManagerConfig: (
|
||||
name: string,
|
||||
name: 'RNCWebView',
|
||||
) => {
|
||||
Commands: WebViewCommands;
|
||||
};
|
||||
dispatchViewManagerCommand: (
|
||||
viewHandle: number,
|
||||
command: Function,
|
||||
params: object | null,
|
||||
) => void;
|
||||
RNCWebView: {
|
||||
Commands: WebViewCommands;
|
||||
};
|
||||
}
|
||||
|
||||
type WebViewState = 'IDLE' | 'LOADING' | 'ERROR';
|
||||
|
@ -246,7 +238,7 @@ export interface AndroidNativeWebViewProps extends CommonNativeWebViewProps {
|
|||
saveFormDataDisabled?: boolean;
|
||||
textZoom?: number;
|
||||
thirdPartyCookiesEnabled?: boolean;
|
||||
urlPrefixesForDefaultIntent?: ReadonlyArray<string>;
|
||||
urlPrefixesForDefaultIntent?: readonly string[];
|
||||
}
|
||||
|
||||
export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
|
||||
|
@ -262,7 +254,7 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
|
|||
| 'scrollableAxes'
|
||||
| 'never'
|
||||
| 'always';
|
||||
dataDetectorTypes?: DataDetectorTypes | ReadonlyArray<DataDetectorTypes>;
|
||||
dataDetectorTypes?: DataDetectorTypes | readonly DataDetectorTypes[];
|
||||
decelerationRate?: number;
|
||||
directionalLockEnabled?: boolean;
|
||||
hideKeyboardAccessoryView?: boolean;
|
||||
|
@ -360,7 +352,7 @@ export interface IOSWebViewProps extends WebViewSharedProps {
|
|||
*
|
||||
* @platform ios
|
||||
*/
|
||||
dataDetectorTypes?: DataDetectorTypes | ReadonlyArray<DataDetectorTypes>;
|
||||
dataDetectorTypes?: DataDetectorTypes | readonly DataDetectorTypes[];
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @platform android
|
||||
*/
|
||||
urlPrefixesForDefaultIntent?: ReadonlyArray<string>;
|
||||
urlPrefixesForDefaultIntent?: readonly string[];
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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
|
||||
|
|
Loading…
Reference in New Issue