From 125d5dc9c54dd243742a204746b5a227d7b1e723 Mon Sep 17 00:00:00 2001 From: Laurin Quast Date: Thu, 24 Jan 2019 13:15:58 +0100 Subject: [PATCH] fix: omit packager assets from caching (#1438) --- CHANGELOG.md | 4 ++ Video.js | 2 + examples/video-caching/App.ios.js | 78 ++++++++++++++++++------- examples/video-caching/ios/Podfile | 2 +- examples/video-caching/ios/Podfile.lock | 10 ++-- examples/video-caching/rn-cli.config.js | 16 ++++- ios/Video/RCTVideo.m | 5 +- 7 files changed, 87 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24a19ba4..280ada24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Changelog +### next + +* Fix loading package resolved videos when using video-caching [#1438](https://github.com/react-native-community/react-native-video/pull/1438) + ### Version 4.3.0 * Fix iOS video not displaying after switching source [#1395](https://github.com/react-native-community/react-native-video/pull/1395) * Add the filterEnabled flag, fixes iOS video start time regression [#1384](https://github.com/react-native-community/react-native-video/pull/1384) diff --git a/Video.js b/Video.js index 92544467..ff893efb 100644 --- a/Video.js +++ b/Video.js @@ -213,6 +213,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) let uri = source.uri || ''; if (uri && uri.match(/^\//)) { @@ -241,6 +242,7 @@ export default class Video extends Component { uri, isNetwork, isAsset, + shouldCache, type: source.type || '', mainVer: source.mainVer || 0, patchVer: source.patchVer || 0, diff --git a/examples/video-caching/App.ios.js b/examples/video-caching/App.ios.js index 20f69745..f38f945a 100644 --- a/examples/video-caching/App.ios.js +++ b/examples/video-caching/App.ios.js @@ -5,39 +5,70 @@ */ import React, { Component } from "react"; -import { StyleSheet, Text, View, Dimensions, TouchableOpacity } from "react-native"; +import { Alert, StyleSheet, Text, View, Dimensions, TouchableOpacity } from "react-native"; import Video from "react-native-video"; const { height, width } = Dimensions.get("screen"); type Props = {}; -export default class App extends Component { + +type State = { + showLocal: boolean +}; + +function Button({ text, onPress }: { text: string, onPress: () => void }) { + return ( + + {text} + + ) +} + +export default class App extends Component { + state = { + showLocal: false + } render() { return (