From 4f07aab8b1d62d1df1bfbcef514a5f587de629ad Mon Sep 17 00:00:00 2001 From: Benoit Dion <573574+benoitdion@users.noreply.github.com> Date: Sat, 22 Feb 2020 13:56:31 -0500 Subject: [PATCH] Bump javascript dependencies (#1914) Also update linting rules to match other community repositories. --- .eslintrc | 3 +-- .prettierrc | 8 ++++++ FilterType.js | 2 +- TextTrackType.js | 2 +- Video.js | 63 +++++++++++++++++++++++++----------------------- package.json | 21 ++++++++-------- 6 files changed, 54 insertions(+), 45 deletions(-) create mode 100644 .prettierrc diff --git a/.eslintrc b/.eslintrc index bb38fe3b..24a2055d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,4 +1,3 @@ { - "extends": "airbnb", - "parser": "babel-eslint" + "extends": "@react-native-community", } \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..1d4c3eff --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "requirePragma": true, + "singleQuote": true, + "trailingComma": "all", + "bracketSpacing": false, + "jsxBracketSameLine": true, + "parser": "flow" +} \ No newline at end of file diff --git a/FilterType.js b/FilterType.js index bd477d73..3d8d9cb4 100644 --- a/FilterType.js +++ b/FilterType.js @@ -14,5 +14,5 @@ export default { PROCESS: 'CIPhotoEffectProcess', TONAL: 'CIPhotoEffectTonal', TRANSFER: 'CIPhotoEffectTransfer', - SEPIA: 'CISepiaTone' + SEPIA: 'CISepiaTone', }; diff --git a/TextTrackType.js b/TextTrackType.js index 9dc14077..9f06e5dd 100644 --- a/TextTrackType.js +++ b/TextTrackType.js @@ -1,5 +1,5 @@ export default { SRT: 'application/x-subrip', TTML: 'application/ttml+xml', - VTT: 'text/vtt' + VTT: 'text/vtt', }; diff --git a/Video.js b/Video.js index 08b71dca..e6a313aa 100644 --- a/Video.js +++ b/Video.js @@ -23,7 +23,7 @@ export default class Video extends Component { showPoster: !!props.poster, androidFullScreen: false, videoContainerLayout_x: 0, - videoContainerLayout_y: 0 + videoContainerLayout_y: 0, }; this.getDimension(); } @@ -46,9 +46,9 @@ export default class Video extends Component { UIManager.measure(findNodeHandle(this._videoContainer), (x, y) => { this.setState({ videoContainerLayout_x: x, - videoContainerLayout_y: y - }) - }) + videoContainerLayout_y: y, + }); + }); } setNativeProps(nativeProps) { @@ -57,12 +57,12 @@ export default class Video extends Component { toTypeString(x) { switch (typeof x) { - case "object": + case 'object': return x instanceof Date ? x.toISOString() : JSON.stringify(x); // object, null - case "undefined": - return ""; + case 'undefined': + return ''; default: // boolean, number, string return x.toString(); } @@ -79,14 +79,14 @@ export default class Video extends Component { } seek = (time, tolerance = 100) => { - if (isNaN(time)) throw new Error('Specified time is not a number'); + if (isNaN(time)) {throw new Error('Specified time is not a number');} if (Platform.OS === 'ios') { this.setNativeProps({ seek: { time, - tolerance - } + tolerance, + }, }); } else { this.setNativeProps({ seek: time }); @@ -172,7 +172,7 @@ export default class Video extends Component { }; _onFullscreenPlayerWillPresent = (event) => { - Platform.OS === 'android' && this.setState({ androidFullScreen: true }) + Platform.OS === 'android' && this.setState({ androidFullScreen: true }); if (this.props.onFullscreenPlayerWillPresent) { this.props.onFullscreenPlayerWillPresent(event.nativeEvent); } @@ -185,7 +185,7 @@ export default class Video extends Component { }; _onFullscreenPlayerWillDismiss = (event) => { - Platform.OS === 'android' && this.setState({ androidFullScreen: false }) + Platform.OS === 'android' && this.setState({ androidFullScreen: false }); if (this.props.onFullscreenPlayerWillDismiss) { this.props.onFullscreenPlayerWillDismiss(event.nativeEvent); } @@ -201,7 +201,7 @@ export default class Video extends Component { if (!this.props.audioOnly) { this._hidePoster(); } - + if (this.props.onReadyForDisplay) { this.props.onReadyForDisplay(event.nativeEvent); } @@ -271,7 +271,7 @@ export default class Video extends Component { render() { const resizeMode = this.props.resizeMode; const source = resolveAssetSource(this.props.source) || {}; - const shouldCache = !Boolean(source.__packager_asset) + const shouldCache = !source.__packager_asset; let uri = source.uri || ''; if (uri && uri.match(/^\//)) { @@ -310,7 +310,7 @@ export default class Video extends Component { type: source.type || '', mainVer: source.mainVer || 0, patchVer: source.patchVer || 0, - requestHeaders: source.headers ? this.stringsOnlyObject(source.headers) : {} + requestHeaders: source.headers ? this.stringsOnlyObject(source.headers) : {}, }, onVideoLoadStart: this._onLoadStart, onVideoLoad: this._onLoad, @@ -350,14 +350,17 @@ export default class Video extends Component { width: this.width, height: this.height, backgroundColor: '#ffffff', - justifyContent: "center", + justifyContent: 'center', zIndex: 99999, marginTop: -1 * (this.state.videoContainerLayout_y ? parseFloat(this.state.videoContainerLayout_y) : 0), //margin: 0 - is not working properly. So, updated all the margin individually with 0. - marginLeft: -1 * (this.state.videoContainerLayout_x ? parseFloat(this.state.videoContainerLayout_x) : 0) - } : {} + marginLeft: -1 * (this.state.videoContainerLayout_x ? parseFloat(this.state.videoContainerLayout_x) : 0), + } : {}; return ( - this._videoContainer = videoContainer} style={[nativeProps.style, videoStyle]}> + { + this._videoContainer = videoContainer; + return videoContainer; + }} style={[nativeProps.style, videoStyle]}>