Bump javascript dependencies (#1914)

Also update linting rules to match other community repositories.
This commit is contained in:
Benoit Dion 2020-02-22 13:56:31 -05:00 committed by GitHub
parent f0867d7eef
commit 4f07aab8b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 45 deletions

View File

@ -1,4 +1,3 @@
{ {
"extends": "airbnb", "extends": "@react-native-community",
"parser": "babel-eslint"
} }

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"requirePragma": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": false,
"jsxBracketSameLine": true,
"parser": "flow"
}

View File

@ -14,5 +14,5 @@ export default {
PROCESS: 'CIPhotoEffectProcess', PROCESS: 'CIPhotoEffectProcess',
TONAL: 'CIPhotoEffectTonal', TONAL: 'CIPhotoEffectTonal',
TRANSFER: 'CIPhotoEffectTransfer', TRANSFER: 'CIPhotoEffectTransfer',
SEPIA: 'CISepiaTone' SEPIA: 'CISepiaTone',
}; };

View File

@ -1,5 +1,5 @@
export default { export default {
SRT: 'application/x-subrip', SRT: 'application/x-subrip',
TTML: 'application/ttml+xml', TTML: 'application/ttml+xml',
VTT: 'text/vtt' VTT: 'text/vtt',
}; };

View File

@ -23,7 +23,7 @@ export default class Video extends Component {
showPoster: !!props.poster, showPoster: !!props.poster,
androidFullScreen: false, androidFullScreen: false,
videoContainerLayout_x: 0, videoContainerLayout_x: 0,
videoContainerLayout_y: 0 videoContainerLayout_y: 0,
}; };
this.getDimension(); this.getDimension();
} }
@ -46,9 +46,9 @@ export default class Video extends Component {
UIManager.measure(findNodeHandle(this._videoContainer), (x, y) => { UIManager.measure(findNodeHandle(this._videoContainer), (x, y) => {
this.setState({ this.setState({
videoContainerLayout_x: x, videoContainerLayout_x: x,
videoContainerLayout_y: y videoContainerLayout_y: y,
}) });
}) });
} }
setNativeProps(nativeProps) { setNativeProps(nativeProps) {
@ -57,12 +57,12 @@ export default class Video extends Component {
toTypeString(x) { toTypeString(x) {
switch (typeof x) { switch (typeof x) {
case "object": case 'object':
return x instanceof Date return x instanceof Date
? x.toISOString() ? x.toISOString()
: JSON.stringify(x); // object, null : JSON.stringify(x); // object, null
case "undefined": case 'undefined':
return ""; return '';
default: // boolean, number, string default: // boolean, number, string
return x.toString(); return x.toString();
} }
@ -79,14 +79,14 @@ export default class Video extends Component {
} }
seek = (time, tolerance = 100) => { 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') { if (Platform.OS === 'ios') {
this.setNativeProps({ this.setNativeProps({
seek: { seek: {
time, time,
tolerance tolerance,
} },
}); });
} else { } else {
this.setNativeProps({ seek: time }); this.setNativeProps({ seek: time });
@ -172,7 +172,7 @@ export default class Video extends Component {
}; };
_onFullscreenPlayerWillPresent = (event) => { _onFullscreenPlayerWillPresent = (event) => {
Platform.OS === 'android' && this.setState({ androidFullScreen: true }) Platform.OS === 'android' && this.setState({ androidFullScreen: true });
if (this.props.onFullscreenPlayerWillPresent) { if (this.props.onFullscreenPlayerWillPresent) {
this.props.onFullscreenPlayerWillPresent(event.nativeEvent); this.props.onFullscreenPlayerWillPresent(event.nativeEvent);
} }
@ -185,7 +185,7 @@ export default class Video extends Component {
}; };
_onFullscreenPlayerWillDismiss = (event) => { _onFullscreenPlayerWillDismiss = (event) => {
Platform.OS === 'android' && this.setState({ androidFullScreen: false }) Platform.OS === 'android' && this.setState({ androidFullScreen: false });
if (this.props.onFullscreenPlayerWillDismiss) { if (this.props.onFullscreenPlayerWillDismiss) {
this.props.onFullscreenPlayerWillDismiss(event.nativeEvent); this.props.onFullscreenPlayerWillDismiss(event.nativeEvent);
} }
@ -201,7 +201,7 @@ export default class Video extends Component {
if (!this.props.audioOnly) { if (!this.props.audioOnly) {
this._hidePoster(); this._hidePoster();
} }
if (this.props.onReadyForDisplay) { if (this.props.onReadyForDisplay) {
this.props.onReadyForDisplay(event.nativeEvent); this.props.onReadyForDisplay(event.nativeEvent);
} }
@ -271,7 +271,7 @@ export default class Video extends Component {
render() { render() {
const resizeMode = this.props.resizeMode; const resizeMode = this.props.resizeMode;
const source = resolveAssetSource(this.props.source) || {}; const source = resolveAssetSource(this.props.source) || {};
const shouldCache = !Boolean(source.__packager_asset) const shouldCache = !source.__packager_asset;
let uri = source.uri || ''; let uri = source.uri || '';
if (uri && uri.match(/^\//)) { if (uri && uri.match(/^\//)) {
@ -310,7 +310,7 @@ export default class Video extends Component {
type: source.type || '', type: source.type || '',
mainVer: source.mainVer || 0, mainVer: source.mainVer || 0,
patchVer: source.patchVer || 0, patchVer: source.patchVer || 0,
requestHeaders: source.headers ? this.stringsOnlyObject(source.headers) : {} requestHeaders: source.headers ? this.stringsOnlyObject(source.headers) : {},
}, },
onVideoLoadStart: this._onLoadStart, onVideoLoadStart: this._onLoadStart,
onVideoLoad: this._onLoad, onVideoLoad: this._onLoad,
@ -350,14 +350,17 @@ export default class Video extends Component {
width: this.width, width: this.width,
height: this.height, height: this.height,
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
justifyContent: "center", justifyContent: 'center',
zIndex: 99999, 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. 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 ( return (
<View ref={(videoContainer) => this._videoContainer = videoContainer} style={[nativeProps.style, videoStyle]}> <View ref={(videoContainer) => {
this._videoContainer = videoContainer;
return videoContainer;
}} style={[nativeProps.style, videoStyle]}>
<RCTVideo <RCTVideo
ref={this._assignRoot} ref={this._assignRoot}
{...nativeProps} {...nativeProps}
@ -388,14 +391,14 @@ Video.propTypes = {
FilterType.PROCESS, FilterType.PROCESS,
FilterType.TONAL, FilterType.TONAL,
FilterType.TRANSFER, FilterType.TRANSFER,
FilterType.SEPIA FilterType.SEPIA,
]), ]),
filterEnabled: PropTypes.bool, filterEnabled: PropTypes.bool,
/* Native only */ /* Native only */
src: PropTypes.object, src: PropTypes.object,
seek: PropTypes.oneOfType([ seek: PropTypes.oneOfType([
PropTypes.number, PropTypes.number,
PropTypes.object PropTypes.object,
]), ]),
fullscreen: PropTypes.bool, fullscreen: PropTypes.bool,
onVideoLoadStart: PropTypes.func, onVideoLoadStart: PropTypes.func,
@ -417,10 +420,10 @@ Video.propTypes = {
/* Wrapper component */ /* Wrapper component */
source: PropTypes.oneOfType([ source: PropTypes.oneOfType([
PropTypes.shape({ PropTypes.shape({
uri: PropTypes.string uri: PropTypes.string,
}), }),
// Opaque type returned by require('./video.mp4') // Opaque type returned by require('./video.mp4')
PropTypes.number PropTypes.number,
]), ]),
minLoadRetryCount: PropTypes.number, minLoadRetryCount: PropTypes.number,
maxBitRate: PropTypes.number, maxBitRate: PropTypes.number,
@ -434,22 +437,22 @@ Video.propTypes = {
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
value: PropTypes.oneOfType([ value: PropTypes.oneOfType([
PropTypes.string, PropTypes.string,
PropTypes.number PropTypes.number,
]) ]),
}), }),
selectedVideoTrack: PropTypes.shape({ selectedVideoTrack: PropTypes.shape({
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
value: PropTypes.oneOfType([ value: PropTypes.oneOfType([
PropTypes.string, PropTypes.string,
PropTypes.number PropTypes.number,
]) ]),
}), }),
selectedTextTrack: PropTypes.shape({ selectedTextTrack: PropTypes.shape({
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
value: PropTypes.oneOfType([ value: PropTypes.oneOfType([
PropTypes.string, PropTypes.string,
PropTypes.number PropTypes.number,
]) ]),
}), }),
textTracks: PropTypes.arrayOf( textTracks: PropTypes.arrayOf(
PropTypes.shape({ PropTypes.shape({
@ -460,7 +463,7 @@ Video.propTypes = {
TextTrackType.TTML, TextTrackType.TTML,
TextTrackType.VTT, TextTrackType.VTT,
]), ]),
language: PropTypes.string.isRequired language: PropTypes.string.isRequired,
}) })
), ),
paused: PropTypes.bool, paused: PropTypes.bool,

View File

@ -28,22 +28,21 @@
"url": "git@github.com:react-native-community/react-native-video.git" "url": "git@github.com:react-native-community/react-native-video.git"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "5.0.0-beta8", "babel-eslint": "10.0.3",
"eslint": "1.10.3", "eslint": "6.8.0",
"eslint-config-airbnb": "4.0.0", "@react-native-community/eslint-config": "0.0.7",
"eslint-plugin-react": "3.16.1", "react": "^16.12.0",
"react": "^16.7.0", "react-dom": "^16.12.0",
"react-dom": "^16.7.0", "react-hot-loader": "^4.12.19",
"react-hot-loader": "^4.6.3", "react-native": "^0.61.5"
"react-native": "^0.57.8"
}, },
"dependencies": { "dependencies": {
"keymirror": "^0.1.1", "keymirror": "^0.1.1",
"prop-types": "^15.5.10", "prop-types": "^15.7.2",
"shaka-player": "^2.4.4" "shaka-player": "^2.5.9"
}, },
"scripts": { "scripts": {
"test": "node_modules/.bin/eslint *.js" "lint": "yarn eslint *.js"
}, },
"files": [ "files": [
"android-exoplayer", "android-exoplayer",