├── .babelrc
├── .gitignore
├── CachedImage.js
├── CachedImageExample
├── .babelrc
├── .buckconfig
├── .flowconfig
├── .gitattributes
├── .gitignore
├── .watchmanconfig
├── __tests__
│ └── index.js
├── android
│ ├── app
│ │ ├── BUCK
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── cachedimageexample
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MainApplication.java
│ │ │ └── res
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ └── values
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── keystores
│ │ ├── BUCK
│ │ └── debug.keystore.properties
│ └── settings.gradle
├── app.json
├── image1.jpg
├── index.js
├── ios
│ ├── CachedImageExample-tvOS
│ │ └── Info.plist
│ ├── CachedImageExample-tvOSTests
│ │ └── Info.plist
│ ├── CachedImageExample.xcodeproj
│ │ ├── project.pbxproj
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ ├── CachedImageExample-tvOS.xcscheme
│ │ │ └── CachedImageExample.xcscheme
│ ├── CachedImageExample
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Base.lproj
│ │ │ └── LaunchScreen.xib
│ │ ├── Images.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── Info.plist
│ │ └── main.m
│ └── CachedImageExampleTests
│ │ ├── CachedImageExampleTests.m
│ │ └── Info.plist
├── loading.jpg
└── package.json
├── ImageCacheManager.js
├── ImageCacheManagerOptionsPropTypes.js
├── ImageCachePreloader.js
├── ImageCacheProvider.js
├── LICENSE
├── README.md
├── __tests__
├── ImageCacheManager-test.js
├── SimpleMemoryCache.js
└── SimpleMemoryFs.js
├── index.d.ts
├── index.js
├── package.json
├── utils
├── fsUtils.js
└── pathUtils.js
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["react-native"]
3 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 |
6 | # Runtime data
7 | pids
8 | *.pid
9 | *.seed
10 |
11 | # Directory for instrumented libs generated by jscoverage/JSCover
12 | lib-cov
13 |
14 | # Coverage directory used by tools like istanbul
15 | coverage
16 |
17 | # nyc test coverage
18 | .nyc_output
19 |
20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21 | .grunt
22 |
23 | # node-waf configuration
24 | .lock-wscript
25 |
26 | # Compiled binary addons (http://nodejs.org/api/addons.html)
27 | build/Release
28 |
29 | # Dependency directories
30 | node_modules
31 | jspm_packages
32 |
33 | # Optional npm cache directory
34 | .npm
35 |
36 | # Optional REPL history
37 | .node_repl_history
38 | /.idea/
39 |
40 | .DS_Store
41 |
--------------------------------------------------------------------------------
/CachedImage.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const _ = require('lodash');
4 | const React = require('react');
5 | const ReactNative = require('react-native');
6 |
7 | const PropTypes = require('prop-types');
8 |
9 | const ImageCacheManagerOptionsPropTypes = require('./ImageCacheManagerOptionsPropTypes');
10 |
11 | const flattenStyle = ReactNative.StyleSheet.flatten;
12 |
13 | const ImageCacheManager = require('./ImageCacheManager');
14 |
15 | const {
16 | View,
17 | ImageBackground,
18 | ActivityIndicator,
19 | Platform,
20 | StyleSheet,
21 | } = ReactNative;
22 | import NetInfo from "@react-native-community/netinfo";
23 |
24 | const styles = StyleSheet.create({
25 | image: {
26 | backgroundColor: 'transparent'
27 | },
28 | loader: {
29 | backgroundColor: 'transparent',
30 | },
31 | loaderPlaceholder: {
32 | backgroundColor: 'transparent',
33 | alignItems: 'center',
34 | justifyContent: 'center'
35 | }
36 | });
37 |
38 | function getImageProps(props) {
39 | return _.omit(props, ['source', 'defaultSource', 'fallbackSource', 'LoadingIndicator', 'activityIndicatorProps', 'style', 'useQueryParamsInCacheKey', 'renderImage', 'resolveHeaders']);
40 | }
41 |
42 | const CACHED_IMAGE_REF = 'cachedImage';
43 |
44 | class CachedImage extends React.Component {
45 |
46 | static propTypes = {
47 | renderImage: PropTypes.func.isRequired,
48 | activityIndicatorProps: PropTypes.object.isRequired,
49 |
50 | // ImageCacheManager options
51 | ...ImageCacheManagerOptionsPropTypes,
52 | };
53 |
54 | static defaultProps = {
55 | renderImage: props => (),
56 | activityIndicatorProps: {},
57 | };
58 |
59 | static contextTypes = {
60 | getImageCacheManager: PropTypes.func,
61 | };
62 |
63 | constructor(props) {
64 | super(props);
65 | this._isMounted = false;
66 | this.state = {
67 | isCacheable: true,
68 | cachedImagePath: null,
69 | networkAvailable: true
70 | };
71 |
72 | this.getImageCacheManagerOptions = this.getImageCacheManagerOptions.bind(this);
73 | this.getImageCacheManager = this.getImageCacheManager.bind(this);
74 | this.safeSetState = this.safeSetState.bind(this);
75 | this.handleConnectivityChange = this.handleConnectivityChange.bind(this);
76 | this.processSource = this.processSource.bind(this);
77 | this.renderLoader = this.renderLoader.bind(this);
78 | }
79 |
80 | UNSAFE_componentWillMount() {
81 | this._isMounted = true;
82 | this.netinfoUnsubscribe = NetInfo.addEventListener(this.handleConnectivityChange);
83 | this.processSource(this.props.source);
84 | }
85 |
86 | componentWillUnmount() {
87 | this._isMounted = false;
88 | this.netinfoUnsubscribe();
89 | }
90 |
91 | UNSAFE_componentWillReceiveProps(nextProps) {
92 | if (!_.isEqual(this.props.source, nextProps.source)) {
93 | this.processSource(nextProps.source);
94 | }
95 | }
96 |
97 | setNativeProps(nativeProps) {
98 | try {
99 | this.refs[CACHED_IMAGE_REF].setNativeProps(nativeProps);
100 | } catch (e) {
101 | console.error(e);
102 | }
103 | }
104 |
105 | getImageCacheManagerOptions() {
106 | return _.pick(this.props, _.keys(ImageCacheManagerOptionsPropTypes));
107 | }
108 |
109 | getImageCacheManager() {
110 | // try to get ImageCacheManager from context
111 | if (this.context && this.context.getImageCacheManager) {
112 | return this.context.getImageCacheManager();
113 | }
114 | // create a new one if context is not available
115 | const options = this.getImageCacheManagerOptions();
116 | return ImageCacheManager(options);
117 | }
118 |
119 | safeSetState(newState) {
120 | if (!this._isMounted) {
121 | return;
122 | }
123 | return this.setState(newState);
124 | }
125 |
126 | handleConnectivityChange({ isConnected }) {
127 | this.safeSetState({
128 | networkAvailable: isConnected
129 | });
130 | }
131 |
132 | processSource(source) {
133 | const url = _.get(source, ['uri'], null);
134 | const options = this.getImageCacheManagerOptions();
135 | const imageCacheManager = this.getImageCacheManager();
136 |
137 | imageCacheManager.downloadAndCacheUrl(url, options)
138 | .then(cachedImagePath => {
139 | this.safeSetState({
140 | cachedImagePath
141 | });
142 | })
143 | .catch(err => {
144 | // console.warn(err);
145 | this.safeSetState({
146 | cachedImagePath: null,
147 | isCacheable: false
148 | });
149 | });
150 | }
151 |
152 | render() {
153 | if (this.state.isCacheable && !this.state.cachedImagePath) {
154 | return this.renderLoader();
155 | }
156 | const props = getImageProps(this.props);
157 | const style = this.props.style || styles.image;
158 | const source = (this.state.isCacheable && this.state.cachedImagePath) ? {
159 | uri: 'file://' + this.state.cachedImagePath
160 | } : this.props.source;
161 | if (this.props.fallbackSource && !this.state.cachedImagePath) {
162 | return this.props.renderImage({
163 | ...props,
164 | key: `${props.key || source.uri}error`,
165 | style,
166 | source: this.props.fallbackSource
167 | });
168 | }
169 | return this.props.renderImage({
170 | ...props,
171 | key: props.key || source.uri,
172 | style,
173 | source
174 | });
175 | }
176 |
177 | renderLoader() {
178 | const imageProps = getImageProps(this.props);
179 | const imageStyle = [this.props.style, styles.loaderPlaceholder];
180 |
181 | const activityIndicatorProps = _.omit(this.props.activityIndicatorProps, ['style']);
182 | const activityIndicatorStyle = this.props.activityIndicatorProps.style || styles.loader;
183 |
184 | const LoadingIndicator = this.props.loadingIndicator;
185 |
186 | const source = this.props.defaultSource;
187 |
188 | // if the imageStyle has borderRadius it will break the loading image view on android
189 | // so we only show the ActivityIndicator
190 | if (!source || (Platform.OS === 'android' && flattenStyle(imageStyle).borderRadius)) {
191 | if (LoadingIndicator) {
192 | return (
193 |
194 |
195 |
196 | );
197 | }
198 | return (
199 |
202 | );
203 | }
204 | // otherwise render an image with the defaultSource with the ActivityIndicator on top of it
205 | return this.props.renderImage({
206 | ...imageProps,
207 | style: imageStyle,
208 | key: source.uri,
209 | source,
210 | children: (
211 | LoadingIndicator
212 | ?
213 |
214 |
215 | :
218 | )
219 | });
220 | }
221 |
222 | }
223 |
224 | module.exports = CachedImage;
225 |
--------------------------------------------------------------------------------
/CachedImageExample/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["react-native"]
3 | }
4 |
--------------------------------------------------------------------------------
/CachedImageExample/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/CachedImageExample/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 | ; We fork some components by platform
3 | .*/*[.]android.js
4 |
5 | ; Ignore "BUCK" generated dirs
6 | /\.buckd/
7 |
8 | ; Ignore unexpected extra "@providesModule"
9 | .*/node_modules/.*/node_modules/fbjs/.*
10 |
11 | ; Ignore duplicate module providers
12 | ; For RN Apps installed via npm, "Libraries" folder is inside
13 | ; "node_modules/react-native" but in the source repo it is in the root
14 | .*/Libraries/react-native/React.js
15 | .*/Libraries/react-native/ReactNative.js
16 |
17 | [include]
18 |
19 | [libs]
20 | node_modules/react-native/Libraries/react-native/react-native-interface.js
21 | node_modules/react-native/flow
22 | flow/
23 |
24 | [options]
25 | emoji=true
26 |
27 | module.system=haste
28 |
29 | experimental.strict_type_args=true
30 |
31 | munge_underscores=true
32 |
33 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
34 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
35 |
36 | suppress_type=$FlowIssue
37 | suppress_type=$FlowFixMe
38 | suppress_type=$FixMe
39 |
40 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
41 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
42 |
43 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
44 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
45 |
46 | unsafe.enable_getters_and_setters=true
47 |
48 | [version]
49 | ^0.47.0
--------------------------------------------------------------------------------
/CachedImageExample/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 |
--------------------------------------------------------------------------------
/CachedImageExample/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 |
33 | # node.js
34 | #
35 | node_modules/
36 | npm-debug.log
37 | yarn-error.log
38 |
39 | # BUCK
40 | buck-out/
41 | \.buckd/
42 | android/app/libs
43 | *.keystore
44 |
--------------------------------------------------------------------------------
/CachedImageExample/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/CachedImageExample/__tests__/index.js:
--------------------------------------------------------------------------------
1 | import 'react-native';
2 | import React from 'react';
3 | import Index from '../index.android.js';
4 |
5 | // Note: test renderer must be required after react-native.
6 | import renderer from 'react-test-renderer';
7 |
8 | it('renders correctly', () => {
9 | const tree = renderer.create(
10 |
11 | );
12 | });
13 |
--------------------------------------------------------------------------------
/CachedImageExample/android/app/BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | lib_deps = []
12 |
13 | for jarfile in glob(['libs/*.jar']):
14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15 | lib_deps.append(':' + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
21 | for aarfile in glob(['libs/*.aar']):
22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23 | lib_deps.append(':' + name)
24 | android_prebuilt_aar(
25 | name = name,
26 | aar = aarfile,
27 | )
28 |
29 | android_library(
30 | name = "all-libs",
31 | exported_deps = lib_deps,
32 | )
33 |
34 | android_library(
35 | name = "app-code",
36 | srcs = glob([
37 | "src/main/java/**/*.java",
38 | ]),
39 | deps = [
40 | ":all-libs",
41 | ":build_config",
42 | ":res",
43 | ],
44 | )
45 |
46 | android_build_config(
47 | name = "build_config",
48 | package = "com.cachedimageexample",
49 | )
50 |
51 | android_resource(
52 | name = "res",
53 | package = "com.cachedimageexample",
54 | res = "src/main/res",
55 | )
56 |
57 | android_binary(
58 | name = "app",
59 | keystore = "//android/keystores:debug",
60 | manifest = "src/main/AndroidManifest.xml",
61 | package_type = "debug",
62 | deps = [
63 | ":app-code",
64 | ],
65 | )
66 |
--------------------------------------------------------------------------------
/CachedImageExample/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | import com.android.build.OutputFile
4 |
5 | /**
6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7 | * and bundleReleaseJsAndAssets).
8 | * These basically call `react-native bundle` with the correct arguments during the Android build
9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 | * bundle directly from the development server. Below you can see all the possible configurations
11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the
12 | * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 | *
14 | * project.ext.react = [
15 | * // the name of the generated asset file containing your JS bundle
16 | * bundleAssetName: "index.android.bundle",
17 | *
18 | * // the entry file for bundle generation
19 | * entryFile: "index.android.js",
20 | *
21 | * // whether to bundle JS and assets in debug mode
22 | * bundleInDebug: false,
23 | *
24 | * // whether to bundle JS and assets in release mode
25 | * bundleInRelease: true,
26 | *
27 | * // whether to bundle JS and assets in another build variant (if configured).
28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29 | * // The configuration property can be in the following formats
30 | * // 'bundleIn${productFlavor}${buildType}'
31 | * // 'bundleIn${buildType}'
32 | * // bundleInFreeDebug: true,
33 | * // bundleInPaidRelease: true,
34 | * // bundleInBeta: true,
35 | *
36 | * // whether to disable dev mode in custom build variants (by default only disabled in release)
37 | * // for example: to disable dev mode in the staging build type (if configured)
38 | * devDisabledInStaging: true,
39 | * // The configuration property can be in the following formats
40 | * // 'devDisabledIn${productFlavor}${buildType}'
41 | * // 'devDisabledIn${buildType}'
42 | *
43 | * // the root of your project, i.e. where "package.json" lives
44 | * root: "../../",
45 | *
46 | * // where to put the JS bundle asset in debug mode
47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48 | *
49 | * // where to put the JS bundle asset in release mode
50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51 | *
52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
53 | * // require('./image.png')), in debug mode
54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55 | *
56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
57 | * // require('./image.png')), in release mode
58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59 | *
60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64 | * // for example, you might want to remove it from here.
65 | * inputExcludes: ["android/**", "ios/**"],
66 | *
67 | * // override which node gets called and with what additional arguments
68 | * nodeExecutableAndArgs: ["node"],
69 | *
70 | * // supply additional arguments to the packager
71 | * extraPackagerArgs: []
72 | * ]
73 | */
74 |
75 | apply from: "../../node_modules/react-native/react.gradle"
76 |
77 | /**
78 | * Set this to true to create two separate APKs instead of one:
79 | * - An APK that only works on ARM devices
80 | * - An APK that only works on x86 devices
81 | * The advantage is the size of the APK is reduced by about 4MB.
82 | * Upload all the APKs to the Play Store and people will download
83 | * the correct one based on the CPU architecture of their device.
84 | */
85 | def enableSeparateBuildPerCPUArchitecture = false
86 |
87 | /**
88 | * Run Proguard to shrink the Java bytecode in release builds.
89 | */
90 | def enableProguardInReleaseBuilds = false
91 |
92 | android {
93 | compileSdkVersion 23
94 | buildToolsVersion "23.0.1"
95 |
96 | defaultConfig {
97 | applicationId "com.cachedimageexample"
98 | minSdkVersion 16
99 | targetSdkVersion 22
100 | versionCode 1
101 | versionName "1.0"
102 | ndk {
103 | abiFilters "armeabi-v7a", "x86"
104 | }
105 | }
106 | splits {
107 | abi {
108 | reset()
109 | enable enableSeparateBuildPerCPUArchitecture
110 | universalApk false // If true, also generate a universal APK
111 | include "armeabi-v7a", "x86"
112 | }
113 | }
114 | buildTypes {
115 | release {
116 | minifyEnabled enableProguardInReleaseBuilds
117 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
118 | }
119 | }
120 | // applicationVariants are e.g. debug, release
121 | applicationVariants.all { variant ->
122 | variant.outputs.each { output ->
123 | // For each separate APK per architecture, set a unique version code as described here:
124 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
125 | def versionCodes = ["armeabi-v7a":1, "x86":2]
126 | def abi = output.getFilter(OutputFile.ABI)
127 | if (abi != null) { // null for the universal-debug, universal-release variants
128 | output.versionCodeOverride =
129 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
130 | }
131 | }
132 | }
133 | }
134 |
135 | dependencies {
136 | compile project(':rn-fetch-blob')
137 | compile fileTree(dir: "libs", include: ["*.jar"])
138 | compile "com.android.support:appcompat-v7:23.0.1"
139 | compile "com.facebook.react:react-native:+" // From node_modules
140 | }
141 |
142 | // Run this once to be able to run the application with BUCK
143 | // puts all compile dependencies into folder libs for BUCK to use
144 | task copyDownloadableDepsToLibs(type: Copy) {
145 | from configurations.compile
146 | into 'libs'
147 | }
148 |
--------------------------------------------------------------------------------
/CachedImageExample/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Disabling obfuscation is useful if you collect stack traces from production crashes
20 | # (unless you are using a system that supports de-obfuscate the stack traces).
21 | -dontobfuscate
22 |
23 | # React Native
24 |
25 | # Keep our interfaces so they can be used by other ProGuard rules.
26 | # See http://sourceforge.net/p/proguard/bugs/466/
27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
30 |
31 | # Do not strip any method/class that is annotated with @DoNotStrip
32 | -keep @com.facebook.proguard.annotations.DoNotStrip class *
33 | -keep @com.facebook.common.internal.DoNotStrip class *
34 | -keepclassmembers class * {
35 | @com.facebook.proguard.annotations.DoNotStrip *;
36 | @com.facebook.common.internal.DoNotStrip *;
37 | }
38 |
39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
40 | void set*(***);
41 | *** get*();
42 | }
43 |
44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; }
46 | -keepclassmembers,includedescriptorclasses class * { native ; }
47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; }
48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; }
49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; }
50 |
51 | -dontwarn com.facebook.react.**
52 |
53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
55 | -dontwarn android.text.StaticLayout
56 |
57 | # okhttp
58 |
59 | -keepattributes Signature
60 | -keepattributes *Annotation*
61 | -keep class okhttp3.** { *; }
62 | -keep interface okhttp3.** { *; }
63 | -dontwarn okhttp3.**
64 |
65 | # okio
66 |
67 | -keep class sun.misc.Unsafe { *; }
68 | -dontwarn java.nio.file.*
69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
70 | -dontwarn okio.**
71 |
--------------------------------------------------------------------------------
/CachedImageExample/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
15 |
16 |
22 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/CachedImageExample/android/app/src/main/java/com/cachedimageexample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.cachedimageexample;
2 |
3 | import com.facebook.react.ReactActivity;
4 |
5 | public class MainActivity extends ReactActivity {
6 |
7 | /**
8 | * Returns the name of the main component registered from JavaScript.
9 | * This is used to schedule rendering of the component.
10 | */
11 | @Override
12 | protected String getMainComponentName() {
13 | return "CachedImageExample";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/CachedImageExample/android/app/src/main/java/com/cachedimageexample/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.cachedimageexample;
2 |
3 | import android.util.Log;
4 | import android.app.Application;
5 |
6 | import com.facebook.react.ReactApplication;
7 | import com.facebook.react.ReactInstanceManager;
8 | import com.facebook.react.ReactNativeHost;
9 | import com.facebook.react.ReactPackage;
10 | import com.facebook.react.shell.MainReactPackage;
11 |
12 | import com.facebook.soloader.SoLoader;
13 |
14 | import com.RNFetchBlob.RNFetchBlobPackage;
15 |
16 | import java.util.Arrays;
17 | import java.util.List;
18 |
19 | public class MainApplication extends Application implements ReactApplication {
20 |
21 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
22 | @Override
23 | public boolean getUseDeveloperSupport() {
24 | return BuildConfig.DEBUG;
25 | }
26 |
27 | @Override
28 | protected String getJSMainModuleName() {
29 | return "index";
30 | }
31 |
32 | @Override
33 | protected List getPackages() {
34 | return Arrays.asList(
35 | new MainReactPackage(),
36 | new RNFetchBlobPackage()
37 | );
38 | }
39 | };
40 |
41 | @Override
42 | public ReactNativeHost getReactNativeHost() {
43 | return mReactNativeHost;
44 | }
45 |
46 | @Override
47 | public void onCreate() {
48 | super.onCreate();
49 | SoLoader.init(this, /* native exopackage */ false);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/CachedImageExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fungilation/react-native-cached-image/68f57aeb30e313d4fc5215b8fc841303d6c81ba8/CachedImageExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/CachedImageExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fungilation/react-native-cached-image/68f57aeb30e313d4fc5215b8fc841303d6c81ba8/CachedImageExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/CachedImageExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fungilation/react-native-cached-image/68f57aeb30e313d4fc5215b8fc841303d6c81ba8/CachedImageExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/CachedImageExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fungilation/react-native-cached-image/68f57aeb30e313d4fc5215b8fc841303d6c81ba8/CachedImageExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/CachedImageExample/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | CachedImageExample
3 |
4 |
--------------------------------------------------------------------------------
/CachedImageExample/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CachedImageExample/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.2.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | mavenLocal()
18 | jcenter()
19 | maven {
20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
21 | url "$rootDir/../node_modules/react-native/android"
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/CachedImageExample/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | android.useDeprecatedNdk=true
21 |
--------------------------------------------------------------------------------
/CachedImageExample/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fungilation/react-native-cached-image/68f57aeb30e313d4fc5215b8fc841303d6c81ba8/CachedImageExample/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/CachedImageExample/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6 |
--------------------------------------------------------------------------------
/CachedImageExample/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/CachedImageExample/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/CachedImageExample/android/keystores/BUCK:
--------------------------------------------------------------------------------
1 | keystore(
2 | name = "debug",
3 | properties = "debug.keystore.properties",
4 | store = "debug.keystore",
5 | visibility = [
6 | "PUBLIC",
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/CachedImageExample/android/keystores/debug.keystore.properties:
--------------------------------------------------------------------------------
1 | key.store=debug.keystore
2 | key.alias=androiddebugkey
3 | key.store.password=android
4 | key.alias.password=android
5 |
--------------------------------------------------------------------------------
/CachedImageExample/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'CachedImageExample'
2 | include ':rn-fetch-blob'
3 | project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android')
4 |
5 | include ':app'
6 |
--------------------------------------------------------------------------------
/CachedImageExample/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "CachedImageExample",
3 | "displayName": "CachedImageExample"
4 | }
--------------------------------------------------------------------------------
/CachedImageExample/image1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fungilation/react-native-cached-image/68f57aeb30e313d4fc5215b8fc841303d6c81ba8/CachedImageExample/image1.jpg
--------------------------------------------------------------------------------
/CachedImageExample/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const React = require('react');
4 | const ReactNative = require('react-native');
5 |
6 | const _ = require('lodash');
7 |
8 | const {
9 | View,
10 | ScrollView,
11 | Button,
12 | Dimensions,
13 | StyleSheet,
14 | AppRegistry,
15 | ListView,
16 | } = ReactNative;
17 |
18 | const {
19 | CachedImage,
20 | ImageCacheProvider,
21 | ImageCacheManager,
22 | } = require('react-native-cached-image');
23 |
24 | const {
25 | width
26 | } = Dimensions.get('window');
27 |
28 | const styles = StyleSheet.create({
29 | container: {
30 | flex: 1,
31 | marginTop: 20
32 | },
33 | buttons: {
34 | flexDirection: 'row'
35 | },
36 | button: {
37 | flex: 1,
38 | alignItems: 'center',
39 | justifyContent: 'center'
40 | },
41 | image: {
42 | width,
43 | height: 300
44 | }
45 | });
46 |
47 | const loading = require('./loading.jpg');
48 |
49 | const image1 = 'https://wallpaperbrowse.com/media/images/bcf39e88-5731-43bb-9d4b-e5b3b2b1fdf2.jpg';
50 | const image2 = 'https://d22cb02g3nv58u.cloudfront.net/0.676.0/assets/images/icons/fun-types/full/baby-shower-full.jpg';
51 |
52 | const images = [
53 | 'https://d22cb02g3nv58u.cloudfront.net/0.676.0/assets/images/icons/fun-types/full/after-work-drinks-full.jpg',
54 | 'https://i.ytimg.com/vi/b6m-XlOxjbk/hqdefault.jpg',
55 | 'https://d22cb02g3nv58u.cloudfront.net/0.676.0/assets/images/icons/fun-types/full/wrong-image.jpg',
56 | 'https://d22cb02g3nv58u.cloudfront.net/0.676.0/assets/images/icons/fun-types/full/bar-crawl-full.jpg',
57 | 'https://d22cb02g3nv58u.cloudfront.net/0.676.0/assets/images/icons/fun-types/full/cheeseburger-full.jpg',
58 | 'https://d22cb02g3nv58u.cloudfront.net/0.676.0/assets/images/icons/fun-types/full/friendsgiving-full.jpg',
59 | 'https://d22cb02g3nv58u.cloudfront.net/0.676.0/assets/images/icons/fun-types/full/dogs-play-date-full.jpg'
60 | ];
61 |
62 | function formatBytes(bytes, decimals) {
63 | if (bytes === 0) {
64 | return '0 B';
65 | }
66 | const k = 1000;
67 | const dm = decimals + 1 || 3;
68 | const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
69 | const i = Math.floor(Math.log(bytes) / Math.log(k));
70 | return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
71 | }
72 |
73 | const defaultImageCacheManager = ImageCacheManager();
74 |
75 | class CachedImageExample extends React.Component {
76 |
77 | constructor(props) {
78 | super(props);
79 |
80 | const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
81 | this.state = {
82 | showNextImage: false,
83 | dataSource: ds.cloneWithRows(images)
84 | };
85 |
86 | this.cacheImages = this.cacheImages.bind(this);
87 |
88 | }
89 |
90 | UNSAFE_componentWillMount() {
91 | defaultImageCacheManager.downloadAndCacheUrl(image1);
92 | }
93 |
94 | clearCache() {
95 | defaultImageCacheManager.clearCache()
96 | .then(() => {
97 | ReactNative.Alert.alert('Cache cleared');
98 | });
99 | }
100 |
101 | getCacheInfo() {
102 | defaultImageCacheManager.getCacheInfo()
103 | .then(({size, files}) => {
104 | // console.log(size, files);
105 | ReactNative.Alert.alert('Cache Info', `files: ${files.length}\nsize: ${formatBytes(size)}`);
106 | });
107 | }
108 |
109 | cacheImages() {
110 | this.setState({
111 | dataSource: this.state.dataSource.cloneWithRows([])
112 | }, () => {
113 | this.setState({
114 | dataSource: this.state.dataSource.cloneWithRows(images)
115 | });
116 | });
117 | }
118 |
119 | renderRow(uri) {
120 | return (
121 |
126 | );
127 | }
128 |
129 | render() {
130 | return (
131 |
132 |
133 |
138 |
143 |
148 |
149 |
150 |
154 |
158 |
159 | ReactNative.Alert.alert('onPreloadComplete')}
162 | ttl={60}
163 | numberOfConcurrentPreloads={0}>
164 |
169 |
170 |
171 | );
172 | }
173 |
174 | }
175 |
176 | AppRegistry.registerComponent('CachedImageExample', () => CachedImageExample);
177 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample-tvOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UIViewControllerBasedStatusBarAppearance
38 |
39 | NSLocationWhenInUseUsageDescription
40 |
41 | NSAppTransportSecurity
42 |
43 |
44 | NSExceptionDomains
45 |
46 | localhost
47 |
48 | NSExceptionAllowsInsecureHTTPLoads
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample-tvOSTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
11 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
12 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
13 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
14 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
15 | 00E356F31AD99517003FC87E /* CachedImageExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* CachedImageExampleTests.m */; };
16 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
17 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
18 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
19 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
20 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
21 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
22 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
23 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
24 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
25 | 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
26 | 2D02E4C31E0B4AEC006451C7 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
27 | 2D02E4C41E0B4AEC006451C7 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
28 | 2D02E4C51E0B4AEC006451C7 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
29 | 2D02E4C61E0B4AEC006451C7 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
30 | 2D02E4C71E0B4AEC006451C7 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
31 | 2D02E4C81E0B4AEC006451C7 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
32 | 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
33 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
34 | B1219DD41F2609FE001916E8 /* libRNFetchBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B19920D11E91305700803196 /* libRNFetchBlob.a */; };
35 | /* End PBXBuildFile section */
36 |
37 | /* Begin PBXContainerItemProxy section */
38 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = {
39 | isa = PBXContainerItemProxy;
40 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
41 | proxyType = 2;
42 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
43 | remoteInfo = RCTActionSheet;
44 | };
45 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = {
46 | isa = PBXContainerItemProxy;
47 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
48 | proxyType = 2;
49 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
50 | remoteInfo = RCTGeolocation;
51 | };
52 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = {
53 | isa = PBXContainerItemProxy;
54 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
55 | proxyType = 2;
56 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676;
57 | remoteInfo = RCTImage;
58 | };
59 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = {
60 | isa = PBXContainerItemProxy;
61 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
62 | proxyType = 2;
63 | remoteGlobalIDString = 58B511DB1A9E6C8500147676;
64 | remoteInfo = RCTNetwork;
65 | };
66 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = {
67 | isa = PBXContainerItemProxy;
68 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
69 | proxyType = 2;
70 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
71 | remoteInfo = RCTVibration;
72 | };
73 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
74 | isa = PBXContainerItemProxy;
75 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
76 | proxyType = 1;
77 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
78 | remoteInfo = CachedImageExample;
79 | };
80 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
81 | isa = PBXContainerItemProxy;
82 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
83 | proxyType = 2;
84 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
85 | remoteInfo = RCTSettings;
86 | };
87 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = {
88 | isa = PBXContainerItemProxy;
89 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
90 | proxyType = 2;
91 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A;
92 | remoteInfo = RCTWebSocket;
93 | };
94 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = {
95 | isa = PBXContainerItemProxy;
96 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
97 | proxyType = 2;
98 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
99 | remoteInfo = React;
100 | };
101 | 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = {
102 | isa = PBXContainerItemProxy;
103 | containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */;
104 | proxyType = 2;
105 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
106 | remoteInfo = RCTAnimation;
107 | };
108 | 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = {
109 | isa = PBXContainerItemProxy;
110 | containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */;
111 | proxyType = 2;
112 | remoteGlobalIDString = 2D2A28201D9B03D100D4039D;
113 | remoteInfo = "RCTAnimation-tvOS";
114 | };
115 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = {
116 | isa = PBXContainerItemProxy;
117 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
118 | proxyType = 2;
119 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
120 | remoteInfo = RCTLinking;
121 | };
122 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = {
123 | isa = PBXContainerItemProxy;
124 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
125 | proxyType = 2;
126 | remoteGlobalIDString = 58B5119B1A9E6C1200147676;
127 | remoteInfo = RCTText;
128 | };
129 | B1219DAD1F2609DE001916E8 /* PBXContainerItemProxy */ = {
130 | isa = PBXContainerItemProxy;
131 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
132 | proxyType = 1;
133 | remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7;
134 | remoteInfo = "CachedImageExample-tvOS";
135 | };
136 | B1219DCB1F2609F5001916E8 /* PBXContainerItemProxy */ = {
137 | isa = PBXContainerItemProxy;
138 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
139 | proxyType = 2;
140 | remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
141 | remoteInfo = "third-party";
142 | };
143 | B1219DCD1F2609F5001916E8 /* PBXContainerItemProxy */ = {
144 | isa = PBXContainerItemProxy;
145 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
146 | proxyType = 2;
147 | remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
148 | remoteInfo = "third-party-tvOS";
149 | };
150 | B1219DCF1F2609F5001916E8 /* PBXContainerItemProxy */ = {
151 | isa = PBXContainerItemProxy;
152 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
153 | proxyType = 2;
154 | remoteGlobalIDString = 139D7E881E25C6D100323FB7;
155 | remoteInfo = "double-conversion";
156 | };
157 | B1219DD11F2609F5001916E8 /* PBXContainerItemProxy */ = {
158 | isa = PBXContainerItemProxy;
159 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
160 | proxyType = 2;
161 | remoteGlobalIDString = 3D383D621EBD27B9005632C8;
162 | remoteInfo = "double-conversion-tvOS";
163 | };
164 | B1270D871DF34CB700F5EFCB /* PBXContainerItemProxy */ = {
165 | isa = PBXContainerItemProxy;
166 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
167 | proxyType = 2;
168 | remoteGlobalIDString = 2D2A283A1D9B042B00D4039D;
169 | remoteInfo = "RCTImage-tvOS";
170 | };
171 | B1270D8B1DF34CB700F5EFCB /* PBXContainerItemProxy */ = {
172 | isa = PBXContainerItemProxy;
173 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
174 | proxyType = 2;
175 | remoteGlobalIDString = 2D2A28471D9B043800D4039D;
176 | remoteInfo = "RCTLinking-tvOS";
177 | };
178 | B1270D8F1DF34CB700F5EFCB /* PBXContainerItemProxy */ = {
179 | isa = PBXContainerItemProxy;
180 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
181 | proxyType = 2;
182 | remoteGlobalIDString = 2D2A28541D9B044C00D4039D;
183 | remoteInfo = "RCTNetwork-tvOS";
184 | };
185 | B1270D931DF34CB700F5EFCB /* PBXContainerItemProxy */ = {
186 | isa = PBXContainerItemProxy;
187 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
188 | proxyType = 2;
189 | remoteGlobalIDString = 2D2A28611D9B046600D4039D;
190 | remoteInfo = "RCTSettings-tvOS";
191 | };
192 | B1270D971DF34CB700F5EFCB /* PBXContainerItemProxy */ = {
193 | isa = PBXContainerItemProxy;
194 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
195 | proxyType = 2;
196 | remoteGlobalIDString = 2D2A287B1D9B048500D4039D;
197 | remoteInfo = "RCTText-tvOS";
198 | };
199 | B1270D9C1DF34CB700F5EFCB /* PBXContainerItemProxy */ = {
200 | isa = PBXContainerItemProxy;
201 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
202 | proxyType = 2;
203 | remoteGlobalIDString = 2D2A28881D9B049200D4039D;
204 | remoteInfo = "RCTWebSocket-tvOS";
205 | };
206 | B1270DA01DF34CB700F5EFCB /* PBXContainerItemProxy */ = {
207 | isa = PBXContainerItemProxy;
208 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
209 | proxyType = 2;
210 | remoteGlobalIDString = 2D2A28131D9B038B00D4039D;
211 | remoteInfo = "React-tvOS";
212 | };
213 | B13BE7821E3E2B0A00C046E0 /* PBXContainerItemProxy */ = {
214 | isa = PBXContainerItemProxy;
215 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
216 | proxyType = 2;
217 | remoteGlobalIDString = 3D3C059A1DE3340900C268FA;
218 | remoteInfo = yoga;
219 | };
220 | B13BE7841E3E2B0A00C046E0 /* PBXContainerItemProxy */ = {
221 | isa = PBXContainerItemProxy;
222 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
223 | proxyType = 2;
224 | remoteGlobalIDString = 3D3C06751DE3340C00C268FA;
225 | remoteInfo = "yoga-tvOS";
226 | };
227 | B13BE7861E3E2B0A00C046E0 /* PBXContainerItemProxy */ = {
228 | isa = PBXContainerItemProxy;
229 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
230 | proxyType = 2;
231 | remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4;
232 | remoteInfo = cxxreact;
233 | };
234 | B13BE7881E3E2B0A00C046E0 /* PBXContainerItemProxy */ = {
235 | isa = PBXContainerItemProxy;
236 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
237 | proxyType = 2;
238 | remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4;
239 | remoteInfo = "cxxreact-tvOS";
240 | };
241 | B13BE78A1E3E2B0A00C046E0 /* PBXContainerItemProxy */ = {
242 | isa = PBXContainerItemProxy;
243 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
244 | proxyType = 2;
245 | remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4;
246 | remoteInfo = jschelpers;
247 | };
248 | B13BE78C1E3E2B0A00C046E0 /* PBXContainerItemProxy */ = {
249 | isa = PBXContainerItemProxy;
250 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
251 | proxyType = 2;
252 | remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4;
253 | remoteInfo = "jschelpers-tvOS";
254 | };
255 | B19920D01E91305700803196 /* PBXContainerItemProxy */ = {
256 | isa = PBXContainerItemProxy;
257 | containerPortal = 7308BE64683240A988168F6A /* RNFetchBlob.xcodeproj */;
258 | proxyType = 2;
259 | remoteGlobalIDString = A15C300E1CD25C330074CB35;
260 | remoteInfo = RNFetchBlob;
261 | };
262 | /* End PBXContainerItemProxy section */
263 |
264 | /* Begin PBXFileReference section */
265 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; };
266 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; };
267 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; };
268 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; };
269 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; };
270 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; };
271 | 00E356EE1AD99517003FC87E /* CachedImageExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CachedImageExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
272 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
273 | 00E356F21AD99517003FC87E /* CachedImageExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CachedImageExampleTests.m; sourceTree = ""; };
274 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; };
275 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; };
276 | 13B07F961A680F5B00A75B9A /* CachedImageExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CachedImageExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
277 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = CachedImageExample/AppDelegate.h; sourceTree = ""; };
278 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = CachedImageExample/AppDelegate.m; sourceTree = ""; };
279 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
280 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = CachedImageExample/Images.xcassets; sourceTree = ""; };
281 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = CachedImageExample/Info.plist; sourceTree = ""; };
282 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = CachedImageExample/main.m; sourceTree = ""; };
283 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; };
284 | 2D02E47B1E0B4A5D006451C7 /* CachedImageExample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "CachedImageExample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
285 | 2D02E4901E0B4A5D006451C7 /* CachedImageExample-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "CachedImageExample-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
286 | 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; };
287 | 7308BE64683240A988168F6A /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFetchBlob.xcodeproj; path = "../node_modules/rn-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = ""; };
288 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; };
289 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; };
290 | /* End PBXFileReference section */
291 |
292 | /* Begin PBXFrameworksBuildPhase section */
293 | 00E356EB1AD99517003FC87E /* Frameworks */ = {
294 | isa = PBXFrameworksBuildPhase;
295 | buildActionMask = 2147483647;
296 | files = (
297 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */,
298 | );
299 | runOnlyForDeploymentPostprocessing = 0;
300 | };
301 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
302 | isa = PBXFrameworksBuildPhase;
303 | buildActionMask = 2147483647;
304 | files = (
305 | B1219DD41F2609FE001916E8 /* libRNFetchBlob.a in Frameworks */,
306 | 146834051AC3E58100842450 /* libReact.a in Frameworks */,
307 | 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */,
308 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
309 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
310 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
311 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
312 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
313 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
314 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
315 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
316 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
317 | );
318 | runOnlyForDeploymentPostprocessing = 0;
319 | };
320 | 2D02E4781E0B4A5D006451C7 /* Frameworks */ = {
321 | isa = PBXFrameworksBuildPhase;
322 | buildActionMask = 2147483647;
323 | files = (
324 | 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */,
325 | 2D02E4C31E0B4AEC006451C7 /* (null) in Frameworks */,
326 | 2D02E4C41E0B4AEC006451C7 /* (null) in Frameworks */,
327 | 2D02E4C51E0B4AEC006451C7 /* (null) in Frameworks */,
328 | 2D02E4C61E0B4AEC006451C7 /* (null) in Frameworks */,
329 | 2D02E4C71E0B4AEC006451C7 /* (null) in Frameworks */,
330 | 2D02E4C81E0B4AEC006451C7 /* (null) in Frameworks */,
331 | );
332 | runOnlyForDeploymentPostprocessing = 0;
333 | };
334 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = {
335 | isa = PBXFrameworksBuildPhase;
336 | buildActionMask = 2147483647;
337 | files = (
338 | );
339 | runOnlyForDeploymentPostprocessing = 0;
340 | };
341 | /* End PBXFrameworksBuildPhase section */
342 |
343 | /* Begin PBXGroup section */
344 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = {
345 | isa = PBXGroup;
346 | children = (
347 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */,
348 | );
349 | name = Products;
350 | sourceTree = "";
351 | };
352 | 00C302B61ABCB90400DB3ED1 /* Products */ = {
353 | isa = PBXGroup;
354 | children = (
355 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */,
356 | );
357 | name = Products;
358 | sourceTree = "";
359 | };
360 | 00C302BC1ABCB91800DB3ED1 /* Products */ = {
361 | isa = PBXGroup;
362 | children = (
363 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */,
364 | B1270D881DF34CB700F5EFCB /* libRCTImage-tvOS.a */,
365 | );
366 | name = Products;
367 | sourceTree = "";
368 | };
369 | 00C302D41ABCB9D200DB3ED1 /* Products */ = {
370 | isa = PBXGroup;
371 | children = (
372 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */,
373 | B1270D901DF34CB700F5EFCB /* libRCTNetwork-tvOS.a */,
374 | );
375 | name = Products;
376 | sourceTree = "";
377 | };
378 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = {
379 | isa = PBXGroup;
380 | children = (
381 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */,
382 | );
383 | name = Products;
384 | sourceTree = "";
385 | };
386 | 00E356EF1AD99517003FC87E /* CachedImageExampleTests */ = {
387 | isa = PBXGroup;
388 | children = (
389 | 00E356F21AD99517003FC87E /* CachedImageExampleTests.m */,
390 | 00E356F01AD99517003FC87E /* Supporting Files */,
391 | );
392 | path = CachedImageExampleTests;
393 | sourceTree = "";
394 | };
395 | 00E356F01AD99517003FC87E /* Supporting Files */ = {
396 | isa = PBXGroup;
397 | children = (
398 | 00E356F11AD99517003FC87E /* Info.plist */,
399 | );
400 | name = "Supporting Files";
401 | sourceTree = "";
402 | };
403 | 139105B71AF99BAD00B5F7CC /* Products */ = {
404 | isa = PBXGroup;
405 | children = (
406 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */,
407 | B1270D941DF34CB700F5EFCB /* libRCTSettings-tvOS.a */,
408 | );
409 | name = Products;
410 | sourceTree = "";
411 | };
412 | 139FDEE71B06529A00C62182 /* Products */ = {
413 | isa = PBXGroup;
414 | children = (
415 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
416 | B1270D9D1DF34CB700F5EFCB /* libRCTWebSocket-tvOS.a */,
417 | );
418 | name = Products;
419 | sourceTree = "";
420 | };
421 | 13B07FAE1A68108700A75B9A /* CachedImageExample */ = {
422 | isa = PBXGroup;
423 | children = (
424 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */,
425 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */,
426 | 13B07FB01A68108700A75B9A /* AppDelegate.m */,
427 | 13B07FB51A68108700A75B9A /* Images.xcassets */,
428 | 13B07FB61A68108700A75B9A /* Info.plist */,
429 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
430 | 13B07FB71A68108700A75B9A /* main.m */,
431 | );
432 | name = CachedImageExample;
433 | sourceTree = "";
434 | };
435 | 146834001AC3E56700842450 /* Products */ = {
436 | isa = PBXGroup;
437 | children = (
438 | 146834041AC3E56700842450 /* libReact.a */,
439 | B1270DA11DF34CB700F5EFCB /* libReact.a */,
440 | B13BE7831E3E2B0A00C046E0 /* libyoga.a */,
441 | B13BE7851E3E2B0A00C046E0 /* libyoga.a */,
442 | B13BE7871E3E2B0A00C046E0 /* libcxxreact.a */,
443 | B13BE7891E3E2B0A00C046E0 /* libcxxreact.a */,
444 | B13BE78B1E3E2B0A00C046E0 /* libjschelpers.a */,
445 | B13BE78D1E3E2B0A00C046E0 /* libjschelpers.a */,
446 | B1219DCC1F2609F5001916E8 /* libthird-party.a */,
447 | B1219DCE1F2609F5001916E8 /* libthird-party.a */,
448 | B1219DD01F2609F5001916E8 /* libdouble-conversion.a */,
449 | B1219DD21F2609F5001916E8 /* libdouble-conversion.a */,
450 | );
451 | name = Products;
452 | sourceTree = "";
453 | };
454 | 5E91572E1DD0AC6500FF2AA8 /* Products */ = {
455 | isa = PBXGroup;
456 | children = (
457 | 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */,
458 | 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */,
459 | );
460 | name = Products;
461 | sourceTree = "";
462 | };
463 | 78C398B11ACF4ADC00677621 /* Products */ = {
464 | isa = PBXGroup;
465 | children = (
466 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */,
467 | B1270D8C1DF34CB700F5EFCB /* libRCTLinking-tvOS.a */,
468 | );
469 | name = Products;
470 | sourceTree = "";
471 | };
472 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
473 | isa = PBXGroup;
474 | children = (
475 | 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */,
476 | 146833FF1AC3E56700842450 /* React.xcodeproj */,
477 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
478 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */,
479 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */,
480 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */,
481 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
482 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */,
483 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
484 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
485 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
486 | 7308BE64683240A988168F6A /* RNFetchBlob.xcodeproj */,
487 | );
488 | name = Libraries;
489 | sourceTree = "";
490 | };
491 | 832341B11AAA6A8300B99B32 /* Products */ = {
492 | isa = PBXGroup;
493 | children = (
494 | 832341B51AAA6A8300B99B32 /* libRCTText.a */,
495 | B1270D981DF34CB700F5EFCB /* libRCTText-tvOS.a */,
496 | );
497 | name = Products;
498 | sourceTree = "";
499 | };
500 | 83CBB9F61A601CBA00E9B192 = {
501 | isa = PBXGroup;
502 | children = (
503 | 13B07FAE1A68108700A75B9A /* CachedImageExample */,
504 | 832341AE1AAA6A7D00B99B32 /* Libraries */,
505 | 00E356EF1AD99517003FC87E /* CachedImageExampleTests */,
506 | 83CBBA001A601CBA00E9B192 /* Products */,
507 | );
508 | indentWidth = 2;
509 | sourceTree = "";
510 | tabWidth = 2;
511 | };
512 | 83CBBA001A601CBA00E9B192 /* Products */ = {
513 | isa = PBXGroup;
514 | children = (
515 | 13B07F961A680F5B00A75B9A /* CachedImageExample.app */,
516 | 00E356EE1AD99517003FC87E /* CachedImageExampleTests.xctest */,
517 | 2D02E47B1E0B4A5D006451C7 /* CachedImageExample-tvOS.app */,
518 | 2D02E4901E0B4A5D006451C7 /* CachedImageExample-tvOSTests.xctest */,
519 | );
520 | name = Products;
521 | sourceTree = "";
522 | };
523 | B19920B41E91305700803196 /* Products */ = {
524 | isa = PBXGroup;
525 | children = (
526 | B19920D11E91305700803196 /* libRNFetchBlob.a */,
527 | );
528 | name = Products;
529 | sourceTree = "";
530 | };
531 | /* End PBXGroup section */
532 |
533 | /* Begin PBXNativeTarget section */
534 | 00E356ED1AD99517003FC87E /* CachedImageExampleTests */ = {
535 | isa = PBXNativeTarget;
536 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "CachedImageExampleTests" */;
537 | buildPhases = (
538 | 00E356EA1AD99517003FC87E /* Sources */,
539 | 00E356EB1AD99517003FC87E /* Frameworks */,
540 | 00E356EC1AD99517003FC87E /* Resources */,
541 | );
542 | buildRules = (
543 | );
544 | dependencies = (
545 | 00E356F51AD99517003FC87E /* PBXTargetDependency */,
546 | );
547 | name = CachedImageExampleTests;
548 | productName = CachedImageExampleTests;
549 | productReference = 00E356EE1AD99517003FC87E /* CachedImageExampleTests.xctest */;
550 | productType = "com.apple.product-type.bundle.unit-test";
551 | };
552 | 13B07F861A680F5B00A75B9A /* CachedImageExample */ = {
553 | isa = PBXNativeTarget;
554 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "CachedImageExample" */;
555 | buildPhases = (
556 | 13B07F871A680F5B00A75B9A /* Sources */,
557 | 13B07F8C1A680F5B00A75B9A /* Frameworks */,
558 | 13B07F8E1A680F5B00A75B9A /* Resources */,
559 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
560 | );
561 | buildRules = (
562 | );
563 | dependencies = (
564 | );
565 | name = CachedImageExample;
566 | productName = "Hello World";
567 | productReference = 13B07F961A680F5B00A75B9A /* CachedImageExample.app */;
568 | productType = "com.apple.product-type.application";
569 | };
570 | 2D02E47A1E0B4A5D006451C7 /* CachedImageExample-tvOS */ = {
571 | isa = PBXNativeTarget;
572 | buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "CachedImageExample-tvOS" */;
573 | buildPhases = (
574 | 2D02E4771E0B4A5D006451C7 /* Sources */,
575 | 2D02E4781E0B4A5D006451C7 /* Frameworks */,
576 | 2D02E4791E0B4A5D006451C7 /* Resources */,
577 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */,
578 | );
579 | buildRules = (
580 | );
581 | dependencies = (
582 | );
583 | name = "CachedImageExample-tvOS";
584 | productName = "CachedImageExample-tvOS";
585 | productReference = 2D02E47B1E0B4A5D006451C7 /* CachedImageExample-tvOS.app */;
586 | productType = "com.apple.product-type.application";
587 | };
588 | 2D02E48F1E0B4A5D006451C7 /* CachedImageExample-tvOSTests */ = {
589 | isa = PBXNativeTarget;
590 | buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "CachedImageExample-tvOSTests" */;
591 | buildPhases = (
592 | 2D02E48C1E0B4A5D006451C7 /* Sources */,
593 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */,
594 | 2D02E48E1E0B4A5D006451C7 /* Resources */,
595 | );
596 | buildRules = (
597 | );
598 | dependencies = (
599 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */,
600 | );
601 | name = "CachedImageExample-tvOSTests";
602 | productName = "CachedImageExample-tvOSTests";
603 | productReference = 2D02E4901E0B4A5D006451C7 /* CachedImageExample-tvOSTests.xctest */;
604 | productType = "com.apple.product-type.bundle.unit-test";
605 | };
606 | /* End PBXNativeTarget section */
607 |
608 | /* Begin PBXProject section */
609 | 83CBB9F71A601CBA00E9B192 /* Project object */ = {
610 | isa = PBXProject;
611 | attributes = {
612 | LastUpgradeCheck = 820;
613 | ORGANIZATIONNAME = Facebook;
614 | TargetAttributes = {
615 | 00E356ED1AD99517003FC87E = {
616 | CreatedOnToolsVersion = 6.2;
617 | TestTargetID = 13B07F861A680F5B00A75B9A;
618 | };
619 | 2D02E47A1E0B4A5D006451C7 = {
620 | CreatedOnToolsVersion = 8.2.1;
621 | ProvisioningStyle = Automatic;
622 | };
623 | 2D02E48F1E0B4A5D006451C7 = {
624 | CreatedOnToolsVersion = 8.2.1;
625 | ProvisioningStyle = Automatic;
626 | TestTargetID = 2D02E47A1E0B4A5D006451C7;
627 | };
628 | };
629 | };
630 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "CachedImageExample" */;
631 | compatibilityVersion = "Xcode 3.2";
632 | developmentRegion = English;
633 | hasScannedForEncodings = 0;
634 | knownRegions = (
635 | en,
636 | Base,
637 | );
638 | mainGroup = 83CBB9F61A601CBA00E9B192;
639 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
640 | projectDirPath = "";
641 | projectReferences = (
642 | {
643 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
644 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
645 | },
646 | {
647 | ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */;
648 | ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */;
649 | },
650 | {
651 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
652 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
653 | },
654 | {
655 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */;
656 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
657 | },
658 | {
659 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */;
660 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
661 | },
662 | {
663 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */;
664 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
665 | },
666 | {
667 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */;
668 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
669 | },
670 | {
671 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */;
672 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
673 | },
674 | {
675 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */;
676 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
677 | },
678 | {
679 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */;
680 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
681 | },
682 | {
683 | ProductGroup = 146834001AC3E56700842450 /* Products */;
684 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
685 | },
686 | {
687 | ProductGroup = B19920B41E91305700803196 /* Products */;
688 | ProjectRef = 7308BE64683240A988168F6A /* RNFetchBlob.xcodeproj */;
689 | },
690 | );
691 | projectRoot = "";
692 | targets = (
693 | 13B07F861A680F5B00A75B9A /* CachedImageExample */,
694 | 00E356ED1AD99517003FC87E /* CachedImageExampleTests */,
695 | 2D02E47A1E0B4A5D006451C7 /* CachedImageExample-tvOS */,
696 | 2D02E48F1E0B4A5D006451C7 /* CachedImageExample-tvOSTests */,
697 | );
698 | };
699 | /* End PBXProject section */
700 |
701 | /* Begin PBXReferenceProxy section */
702 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = {
703 | isa = PBXReferenceProxy;
704 | fileType = archive.ar;
705 | path = libRCTActionSheet.a;
706 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */;
707 | sourceTree = BUILT_PRODUCTS_DIR;
708 | };
709 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = {
710 | isa = PBXReferenceProxy;
711 | fileType = archive.ar;
712 | path = libRCTGeolocation.a;
713 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */;
714 | sourceTree = BUILT_PRODUCTS_DIR;
715 | };
716 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = {
717 | isa = PBXReferenceProxy;
718 | fileType = archive.ar;
719 | path = libRCTImage.a;
720 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */;
721 | sourceTree = BUILT_PRODUCTS_DIR;
722 | };
723 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = {
724 | isa = PBXReferenceProxy;
725 | fileType = archive.ar;
726 | path = libRCTNetwork.a;
727 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */;
728 | sourceTree = BUILT_PRODUCTS_DIR;
729 | };
730 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = {
731 | isa = PBXReferenceProxy;
732 | fileType = archive.ar;
733 | path = libRCTVibration.a;
734 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
735 | sourceTree = BUILT_PRODUCTS_DIR;
736 | };
737 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
738 | isa = PBXReferenceProxy;
739 | fileType = archive.ar;
740 | path = libRCTSettings.a;
741 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */;
742 | sourceTree = BUILT_PRODUCTS_DIR;
743 | };
744 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = {
745 | isa = PBXReferenceProxy;
746 | fileType = archive.ar;
747 | path = libRCTWebSocket.a;
748 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */;
749 | sourceTree = BUILT_PRODUCTS_DIR;
750 | };
751 | 146834041AC3E56700842450 /* libReact.a */ = {
752 | isa = PBXReferenceProxy;
753 | fileType = archive.ar;
754 | path = libReact.a;
755 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
756 | sourceTree = BUILT_PRODUCTS_DIR;
757 | };
758 | 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = {
759 | isa = PBXReferenceProxy;
760 | fileType = archive.ar;
761 | path = libRCTAnimation.a;
762 | remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
763 | sourceTree = BUILT_PRODUCTS_DIR;
764 | };
765 | 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = {
766 | isa = PBXReferenceProxy;
767 | fileType = archive.ar;
768 | path = libRCTAnimation.a;
769 | remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
770 | sourceTree = BUILT_PRODUCTS_DIR;
771 | };
772 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
773 | isa = PBXReferenceProxy;
774 | fileType = archive.ar;
775 | path = libRCTLinking.a;
776 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */;
777 | sourceTree = BUILT_PRODUCTS_DIR;
778 | };
779 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
780 | isa = PBXReferenceProxy;
781 | fileType = archive.ar;
782 | path = libRCTText.a;
783 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
784 | sourceTree = BUILT_PRODUCTS_DIR;
785 | };
786 | B1219DCC1F2609F5001916E8 /* libthird-party.a */ = {
787 | isa = PBXReferenceProxy;
788 | fileType = archive.ar;
789 | path = "libthird-party.a";
790 | remoteRef = B1219DCB1F2609F5001916E8 /* PBXContainerItemProxy */;
791 | sourceTree = BUILT_PRODUCTS_DIR;
792 | };
793 | B1219DCE1F2609F5001916E8 /* libthird-party.a */ = {
794 | isa = PBXReferenceProxy;
795 | fileType = archive.ar;
796 | path = "libthird-party.a";
797 | remoteRef = B1219DCD1F2609F5001916E8 /* PBXContainerItemProxy */;
798 | sourceTree = BUILT_PRODUCTS_DIR;
799 | };
800 | B1219DD01F2609F5001916E8 /* libdouble-conversion.a */ = {
801 | isa = PBXReferenceProxy;
802 | fileType = archive.ar;
803 | path = "libdouble-conversion.a";
804 | remoteRef = B1219DCF1F2609F5001916E8 /* PBXContainerItemProxy */;
805 | sourceTree = BUILT_PRODUCTS_DIR;
806 | };
807 | B1219DD21F2609F5001916E8 /* libdouble-conversion.a */ = {
808 | isa = PBXReferenceProxy;
809 | fileType = archive.ar;
810 | path = "libdouble-conversion.a";
811 | remoteRef = B1219DD11F2609F5001916E8 /* PBXContainerItemProxy */;
812 | sourceTree = BUILT_PRODUCTS_DIR;
813 | };
814 | B1270D881DF34CB700F5EFCB /* libRCTImage-tvOS.a */ = {
815 | isa = PBXReferenceProxy;
816 | fileType = archive.ar;
817 | path = "libRCTImage-tvOS.a";
818 | remoteRef = B1270D871DF34CB700F5EFCB /* PBXContainerItemProxy */;
819 | sourceTree = BUILT_PRODUCTS_DIR;
820 | };
821 | B1270D8C1DF34CB700F5EFCB /* libRCTLinking-tvOS.a */ = {
822 | isa = PBXReferenceProxy;
823 | fileType = archive.ar;
824 | path = "libRCTLinking-tvOS.a";
825 | remoteRef = B1270D8B1DF34CB700F5EFCB /* PBXContainerItemProxy */;
826 | sourceTree = BUILT_PRODUCTS_DIR;
827 | };
828 | B1270D901DF34CB700F5EFCB /* libRCTNetwork-tvOS.a */ = {
829 | isa = PBXReferenceProxy;
830 | fileType = archive.ar;
831 | path = "libRCTNetwork-tvOS.a";
832 | remoteRef = B1270D8F1DF34CB700F5EFCB /* PBXContainerItemProxy */;
833 | sourceTree = BUILT_PRODUCTS_DIR;
834 | };
835 | B1270D941DF34CB700F5EFCB /* libRCTSettings-tvOS.a */ = {
836 | isa = PBXReferenceProxy;
837 | fileType = archive.ar;
838 | path = "libRCTSettings-tvOS.a";
839 | remoteRef = B1270D931DF34CB700F5EFCB /* PBXContainerItemProxy */;
840 | sourceTree = BUILT_PRODUCTS_DIR;
841 | };
842 | B1270D981DF34CB700F5EFCB /* libRCTText-tvOS.a */ = {
843 | isa = PBXReferenceProxy;
844 | fileType = archive.ar;
845 | path = "libRCTText-tvOS.a";
846 | remoteRef = B1270D971DF34CB700F5EFCB /* PBXContainerItemProxy */;
847 | sourceTree = BUILT_PRODUCTS_DIR;
848 | };
849 | B1270D9D1DF34CB700F5EFCB /* libRCTWebSocket-tvOS.a */ = {
850 | isa = PBXReferenceProxy;
851 | fileType = archive.ar;
852 | path = "libRCTWebSocket-tvOS.a";
853 | remoteRef = B1270D9C1DF34CB700F5EFCB /* PBXContainerItemProxy */;
854 | sourceTree = BUILT_PRODUCTS_DIR;
855 | };
856 | B1270DA11DF34CB700F5EFCB /* libReact.a */ = {
857 | isa = PBXReferenceProxy;
858 | fileType = archive.ar;
859 | path = libReact.a;
860 | remoteRef = B1270DA01DF34CB700F5EFCB /* PBXContainerItemProxy */;
861 | sourceTree = BUILT_PRODUCTS_DIR;
862 | };
863 | B13BE7831E3E2B0A00C046E0 /* libyoga.a */ = {
864 | isa = PBXReferenceProxy;
865 | fileType = archive.ar;
866 | path = libyoga.a;
867 | remoteRef = B13BE7821E3E2B0A00C046E0 /* PBXContainerItemProxy */;
868 | sourceTree = BUILT_PRODUCTS_DIR;
869 | };
870 | B13BE7851E3E2B0A00C046E0 /* libyoga.a */ = {
871 | isa = PBXReferenceProxy;
872 | fileType = archive.ar;
873 | path = libyoga.a;
874 | remoteRef = B13BE7841E3E2B0A00C046E0 /* PBXContainerItemProxy */;
875 | sourceTree = BUILT_PRODUCTS_DIR;
876 | };
877 | B13BE7871E3E2B0A00C046E0 /* libcxxreact.a */ = {
878 | isa = PBXReferenceProxy;
879 | fileType = archive.ar;
880 | path = libcxxreact.a;
881 | remoteRef = B13BE7861E3E2B0A00C046E0 /* PBXContainerItemProxy */;
882 | sourceTree = BUILT_PRODUCTS_DIR;
883 | };
884 | B13BE7891E3E2B0A00C046E0 /* libcxxreact.a */ = {
885 | isa = PBXReferenceProxy;
886 | fileType = archive.ar;
887 | path = libcxxreact.a;
888 | remoteRef = B13BE7881E3E2B0A00C046E0 /* PBXContainerItemProxy */;
889 | sourceTree = BUILT_PRODUCTS_DIR;
890 | };
891 | B13BE78B1E3E2B0A00C046E0 /* libjschelpers.a */ = {
892 | isa = PBXReferenceProxy;
893 | fileType = archive.ar;
894 | path = libjschelpers.a;
895 | remoteRef = B13BE78A1E3E2B0A00C046E0 /* PBXContainerItemProxy */;
896 | sourceTree = BUILT_PRODUCTS_DIR;
897 | };
898 | B13BE78D1E3E2B0A00C046E0 /* libjschelpers.a */ = {
899 | isa = PBXReferenceProxy;
900 | fileType = archive.ar;
901 | path = libjschelpers.a;
902 | remoteRef = B13BE78C1E3E2B0A00C046E0 /* PBXContainerItemProxy */;
903 | sourceTree = BUILT_PRODUCTS_DIR;
904 | };
905 | B19920D11E91305700803196 /* libRNFetchBlob.a */ = {
906 | isa = PBXReferenceProxy;
907 | fileType = archive.ar;
908 | path = libRNFetchBlob.a;
909 | remoteRef = B19920D01E91305700803196 /* PBXContainerItemProxy */;
910 | sourceTree = BUILT_PRODUCTS_DIR;
911 | };
912 | /* End PBXReferenceProxy section */
913 |
914 | /* Begin PBXResourcesBuildPhase section */
915 | 00E356EC1AD99517003FC87E /* Resources */ = {
916 | isa = PBXResourcesBuildPhase;
917 | buildActionMask = 2147483647;
918 | files = (
919 | );
920 | runOnlyForDeploymentPostprocessing = 0;
921 | };
922 | 13B07F8E1A680F5B00A75B9A /* Resources */ = {
923 | isa = PBXResourcesBuildPhase;
924 | buildActionMask = 2147483647;
925 | files = (
926 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
927 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
928 | );
929 | runOnlyForDeploymentPostprocessing = 0;
930 | };
931 | 2D02E4791E0B4A5D006451C7 /* Resources */ = {
932 | isa = PBXResourcesBuildPhase;
933 | buildActionMask = 2147483647;
934 | files = (
935 | );
936 | runOnlyForDeploymentPostprocessing = 0;
937 | };
938 | 2D02E48E1E0B4A5D006451C7 /* Resources */ = {
939 | isa = PBXResourcesBuildPhase;
940 | buildActionMask = 2147483647;
941 | files = (
942 | );
943 | runOnlyForDeploymentPostprocessing = 0;
944 | };
945 | /* End PBXResourcesBuildPhase section */
946 |
947 | /* Begin PBXShellScriptBuildPhase section */
948 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
949 | isa = PBXShellScriptBuildPhase;
950 | buildActionMask = 2147483647;
951 | files = (
952 | );
953 | inputPaths = (
954 | );
955 | name = "Bundle React Native code and images";
956 | outputPaths = (
957 | );
958 | runOnlyForDeploymentPostprocessing = 0;
959 | shellPath = /bin/sh;
960 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
961 | };
962 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
963 | isa = PBXShellScriptBuildPhase;
964 | buildActionMask = 2147483647;
965 | files = (
966 | );
967 | inputPaths = (
968 | );
969 | name = "Bundle React Native Code And Images";
970 | outputPaths = (
971 | );
972 | runOnlyForDeploymentPostprocessing = 0;
973 | shellPath = /bin/sh;
974 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
975 | };
976 | /* End PBXShellScriptBuildPhase section */
977 |
978 | /* Begin PBXSourcesBuildPhase section */
979 | 00E356EA1AD99517003FC87E /* Sources */ = {
980 | isa = PBXSourcesBuildPhase;
981 | buildActionMask = 2147483647;
982 | files = (
983 | 00E356F31AD99517003FC87E /* CachedImageExampleTests.m in Sources */,
984 | );
985 | runOnlyForDeploymentPostprocessing = 0;
986 | };
987 | 13B07F871A680F5B00A75B9A /* Sources */ = {
988 | isa = PBXSourcesBuildPhase;
989 | buildActionMask = 2147483647;
990 | files = (
991 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
992 | 13B07FC11A68108700A75B9A /* main.m in Sources */,
993 | );
994 | runOnlyForDeploymentPostprocessing = 0;
995 | };
996 | 2D02E4771E0B4A5D006451C7 /* Sources */ = {
997 | isa = PBXSourcesBuildPhase;
998 | buildActionMask = 2147483647;
999 | files = (
1000 | );
1001 | runOnlyForDeploymentPostprocessing = 0;
1002 | };
1003 | 2D02E48C1E0B4A5D006451C7 /* Sources */ = {
1004 | isa = PBXSourcesBuildPhase;
1005 | buildActionMask = 2147483647;
1006 | files = (
1007 | );
1008 | runOnlyForDeploymentPostprocessing = 0;
1009 | };
1010 | /* End PBXSourcesBuildPhase section */
1011 |
1012 | /* Begin PBXTargetDependency section */
1013 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
1014 | isa = PBXTargetDependency;
1015 | target = 13B07F861A680F5B00A75B9A /* CachedImageExample */;
1016 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
1017 | };
1018 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = {
1019 | isa = PBXTargetDependency;
1020 | target = 2D02E47A1E0B4A5D006451C7 /* CachedImageExample-tvOS */;
1021 | targetProxy = B1219DAD1F2609DE001916E8 /* PBXContainerItemProxy */;
1022 | };
1023 | /* End PBXTargetDependency section */
1024 |
1025 | /* Begin PBXVariantGroup section */
1026 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
1027 | isa = PBXVariantGroup;
1028 | children = (
1029 | 13B07FB21A68108700A75B9A /* Base */,
1030 | );
1031 | name = LaunchScreen.xib;
1032 | path = CachedImageExample;
1033 | sourceTree = "";
1034 | };
1035 | /* End PBXVariantGroup section */
1036 |
1037 | /* Begin XCBuildConfiguration section */
1038 | 00E356F61AD99517003FC87E /* Debug */ = {
1039 | isa = XCBuildConfiguration;
1040 | buildSettings = {
1041 | BUNDLE_LOADER = "$(TEST_HOST)";
1042 | GCC_PREPROCESSOR_DEFINITIONS = (
1043 | "DEBUG=1",
1044 | "$(inherited)",
1045 | );
1046 | INFOPLIST_FILE = CachedImageExampleTests/Info.plist;
1047 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1048 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1049 | LIBRARY_SEARCH_PATHS = (
1050 | "$(inherited)",
1051 | "\"$(SRCROOT)/$(TARGET_NAME)\"",
1052 | "\"$(SRCROOT)/$(TARGET_NAME)\"",
1053 | );
1054 | OTHER_LDFLAGS = (
1055 | "-ObjC",
1056 | "-lc++",
1057 | );
1058 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
1059 | PRODUCT_NAME = "$(TARGET_NAME)";
1060 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CachedImageExample.app/CachedImageExample";
1061 | };
1062 | name = Debug;
1063 | };
1064 | 00E356F71AD99517003FC87E /* Release */ = {
1065 | isa = XCBuildConfiguration;
1066 | buildSettings = {
1067 | BUNDLE_LOADER = "$(TEST_HOST)";
1068 | COPY_PHASE_STRIP = NO;
1069 | INFOPLIST_FILE = CachedImageExampleTests/Info.plist;
1070 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1071 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1072 | LIBRARY_SEARCH_PATHS = (
1073 | "$(inherited)",
1074 | "\"$(SRCROOT)/$(TARGET_NAME)\"",
1075 | "\"$(SRCROOT)/$(TARGET_NAME)\"",
1076 | );
1077 | OTHER_LDFLAGS = (
1078 | "-ObjC",
1079 | "-lc++",
1080 | );
1081 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
1082 | PRODUCT_NAME = "$(TARGET_NAME)";
1083 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CachedImageExample.app/CachedImageExample";
1084 | };
1085 | name = Release;
1086 | };
1087 | 13B07F941A680F5B00A75B9A /* Debug */ = {
1088 | isa = XCBuildConfiguration;
1089 | buildSettings = {
1090 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1091 | CURRENT_PROJECT_VERSION = 1;
1092 | DEAD_CODE_STRIPPING = NO;
1093 | HEADER_SEARCH_PATHS = "$(SRCROOT)/../node_modules/react-native-fs/**";
1094 | INFOPLIST_FILE = CachedImageExample/Info.plist;
1095 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1096 | OTHER_LDFLAGS = (
1097 | "$(inherited)",
1098 | "-ObjC",
1099 | "-lc++",
1100 | );
1101 | PRODUCT_BUNDLE_IDENTIFIER = com.example.CachedImageExample;
1102 | PRODUCT_NAME = CachedImageExample;
1103 | VERSIONING_SYSTEM = "apple-generic";
1104 | };
1105 | name = Debug;
1106 | };
1107 | 13B07F951A680F5B00A75B9A /* Release */ = {
1108 | isa = XCBuildConfiguration;
1109 | buildSettings = {
1110 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1111 | CURRENT_PROJECT_VERSION = 1;
1112 | HEADER_SEARCH_PATHS = "$(SRCROOT)/../node_modules/react-native-fs/**";
1113 | INFOPLIST_FILE = CachedImageExample/Info.plist;
1114 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1115 | OTHER_LDFLAGS = (
1116 | "$(inherited)",
1117 | "-ObjC",
1118 | "-lc++",
1119 | );
1120 | PRODUCT_BUNDLE_IDENTIFIER = com.example.CachedImageExample;
1121 | PRODUCT_NAME = CachedImageExample;
1122 | VERSIONING_SYSTEM = "apple-generic";
1123 | };
1124 | name = Release;
1125 | };
1126 | 2D02E4971E0B4A5E006451C7 /* Debug */ = {
1127 | isa = XCBuildConfiguration;
1128 | buildSettings = {
1129 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
1130 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1131 | CLANG_ANALYZER_NONNULL = YES;
1132 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
1133 | CLANG_WARN_INFINITE_RECURSION = YES;
1134 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1135 | DEBUG_INFORMATION_FORMAT = dwarf;
1136 | ENABLE_TESTABILITY = YES;
1137 | GCC_NO_COMMON_BLOCKS = YES;
1138 | INFOPLIST_FILE = "CachedImageExample-tvOS/Info.plist";
1139 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1140 | OTHER_LDFLAGS = (
1141 | "-ObjC",
1142 | "-lc++",
1143 | );
1144 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.CachedImageExample-tvOS";
1145 | PRODUCT_NAME = "$(TARGET_NAME)";
1146 | SDKROOT = appletvos;
1147 | TARGETED_DEVICE_FAMILY = 3;
1148 | TVOS_DEPLOYMENT_TARGET = 9.2;
1149 | };
1150 | name = Debug;
1151 | };
1152 | 2D02E4981E0B4A5E006451C7 /* Release */ = {
1153 | isa = XCBuildConfiguration;
1154 | buildSettings = {
1155 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
1156 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
1157 | CLANG_ANALYZER_NONNULL = YES;
1158 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
1159 | CLANG_WARN_INFINITE_RECURSION = YES;
1160 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1161 | COPY_PHASE_STRIP = NO;
1162 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1163 | GCC_NO_COMMON_BLOCKS = YES;
1164 | INFOPLIST_FILE = "CachedImageExample-tvOS/Info.plist";
1165 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1166 | OTHER_LDFLAGS = (
1167 | "-ObjC",
1168 | "-lc++",
1169 | );
1170 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.CachedImageExample-tvOS";
1171 | PRODUCT_NAME = "$(TARGET_NAME)";
1172 | SDKROOT = appletvos;
1173 | TARGETED_DEVICE_FAMILY = 3;
1174 | TVOS_DEPLOYMENT_TARGET = 9.2;
1175 | };
1176 | name = Release;
1177 | };
1178 | 2D02E4991E0B4A5E006451C7 /* Debug */ = {
1179 | isa = XCBuildConfiguration;
1180 | buildSettings = {
1181 | BUNDLE_LOADER = "$(TEST_HOST)";
1182 | CLANG_ANALYZER_NONNULL = YES;
1183 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
1184 | CLANG_WARN_INFINITE_RECURSION = YES;
1185 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1186 | DEBUG_INFORMATION_FORMAT = dwarf;
1187 | ENABLE_TESTABILITY = YES;
1188 | GCC_NO_COMMON_BLOCKS = YES;
1189 | INFOPLIST_FILE = "CachedImageExample-tvOSTests/Info.plist";
1190 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1191 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.CachedImageExample-tvOSTests";
1192 | PRODUCT_NAME = "$(TARGET_NAME)";
1193 | SDKROOT = appletvos;
1194 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CachedImageExample-tvOS.app/CachedImageExample-tvOS";
1195 | TVOS_DEPLOYMENT_TARGET = 10.1;
1196 | };
1197 | name = Debug;
1198 | };
1199 | 2D02E49A1E0B4A5E006451C7 /* Release */ = {
1200 | isa = XCBuildConfiguration;
1201 | buildSettings = {
1202 | BUNDLE_LOADER = "$(TEST_HOST)";
1203 | CLANG_ANALYZER_NONNULL = YES;
1204 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
1205 | CLANG_WARN_INFINITE_RECURSION = YES;
1206 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1207 | COPY_PHASE_STRIP = NO;
1208 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1209 | GCC_NO_COMMON_BLOCKS = YES;
1210 | INFOPLIST_FILE = "CachedImageExample-tvOSTests/Info.plist";
1211 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1212 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.CachedImageExample-tvOSTests";
1213 | PRODUCT_NAME = "$(TARGET_NAME)";
1214 | SDKROOT = appletvos;
1215 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CachedImageExample-tvOS.app/CachedImageExample-tvOS";
1216 | TVOS_DEPLOYMENT_TARGET = 10.1;
1217 | };
1218 | name = Release;
1219 | };
1220 | 83CBBA201A601CBA00E9B192 /* Debug */ = {
1221 | isa = XCBuildConfiguration;
1222 | buildSettings = {
1223 | ALWAYS_SEARCH_USER_PATHS = NO;
1224 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
1225 | CLANG_CXX_LIBRARY = "libc++";
1226 | CLANG_ENABLE_MODULES = YES;
1227 | CLANG_ENABLE_OBJC_ARC = YES;
1228 | CLANG_WARN_BOOL_CONVERSION = YES;
1229 | CLANG_WARN_CONSTANT_CONVERSION = YES;
1230 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1231 | CLANG_WARN_EMPTY_BODY = YES;
1232 | CLANG_WARN_ENUM_CONVERSION = YES;
1233 | CLANG_WARN_INFINITE_RECURSION = YES;
1234 | CLANG_WARN_INT_CONVERSION = YES;
1235 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1236 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1237 | CLANG_WARN_UNREACHABLE_CODE = YES;
1238 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
1239 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1240 | COPY_PHASE_STRIP = NO;
1241 | ENABLE_STRICT_OBJC_MSGSEND = YES;
1242 | ENABLE_TESTABILITY = YES;
1243 | GCC_C_LANGUAGE_STANDARD = gnu99;
1244 | GCC_DYNAMIC_NO_PIC = NO;
1245 | GCC_NO_COMMON_BLOCKS = YES;
1246 | GCC_OPTIMIZATION_LEVEL = 0;
1247 | GCC_PREPROCESSOR_DEFINITIONS = (
1248 | "DEBUG=1",
1249 | "$(inherited)",
1250 | );
1251 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
1252 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
1253 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
1254 | GCC_WARN_UNDECLARED_SELECTOR = YES;
1255 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
1256 | GCC_WARN_UNUSED_FUNCTION = YES;
1257 | GCC_WARN_UNUSED_VARIABLE = YES;
1258 | HEADER_SEARCH_PATHS = (
1259 | "$(inherited)",
1260 | "$(SRCROOT)/../node_modules/react-native/React/**",
1261 | "$(SRCROOT)/../node_modules/react-native/ReactCommon/**",
1262 | "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**",
1263 | );
1264 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1265 | MTL_ENABLE_DEBUG_INFO = YES;
1266 | ONLY_ACTIVE_ARCH = YES;
1267 | SDKROOT = iphoneos;
1268 | };
1269 | name = Debug;
1270 | };
1271 | 83CBBA211A601CBA00E9B192 /* Release */ = {
1272 | isa = XCBuildConfiguration;
1273 | buildSettings = {
1274 | ALWAYS_SEARCH_USER_PATHS = NO;
1275 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
1276 | CLANG_CXX_LIBRARY = "libc++";
1277 | CLANG_ENABLE_MODULES = YES;
1278 | CLANG_ENABLE_OBJC_ARC = YES;
1279 | CLANG_WARN_BOOL_CONVERSION = YES;
1280 | CLANG_WARN_CONSTANT_CONVERSION = YES;
1281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1282 | CLANG_WARN_EMPTY_BODY = YES;
1283 | CLANG_WARN_ENUM_CONVERSION = YES;
1284 | CLANG_WARN_INFINITE_RECURSION = YES;
1285 | CLANG_WARN_INT_CONVERSION = YES;
1286 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1287 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
1288 | CLANG_WARN_UNREACHABLE_CODE = YES;
1289 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
1290 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1291 | COPY_PHASE_STRIP = YES;
1292 | ENABLE_NS_ASSERTIONS = NO;
1293 | ENABLE_STRICT_OBJC_MSGSEND = YES;
1294 | GCC_C_LANGUAGE_STANDARD = gnu99;
1295 | GCC_NO_COMMON_BLOCKS = YES;
1296 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
1297 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
1298 | GCC_WARN_UNDECLARED_SELECTOR = YES;
1299 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
1300 | GCC_WARN_UNUSED_FUNCTION = YES;
1301 | GCC_WARN_UNUSED_VARIABLE = YES;
1302 | HEADER_SEARCH_PATHS = (
1303 | "$(inherited)",
1304 | "$(SRCROOT)/../node_modules/react-native/React/**",
1305 | "$(SRCROOT)/../node_modules/react-native/ReactCommon/**",
1306 | "$(SRCROOT)/../node_modules/react-native-fs/**",
1307 | "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**",
1308 | );
1309 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1310 | MTL_ENABLE_DEBUG_INFO = NO;
1311 | SDKROOT = iphoneos;
1312 | VALIDATE_PRODUCT = YES;
1313 | };
1314 | name = Release;
1315 | };
1316 | /* End XCBuildConfiguration section */
1317 |
1318 | /* Begin XCConfigurationList section */
1319 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "CachedImageExampleTests" */ = {
1320 | isa = XCConfigurationList;
1321 | buildConfigurations = (
1322 | 00E356F61AD99517003FC87E /* Debug */,
1323 | 00E356F71AD99517003FC87E /* Release */,
1324 | );
1325 | defaultConfigurationIsVisible = 0;
1326 | defaultConfigurationName = Release;
1327 | };
1328 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "CachedImageExample" */ = {
1329 | isa = XCConfigurationList;
1330 | buildConfigurations = (
1331 | 13B07F941A680F5B00A75B9A /* Debug */,
1332 | 13B07F951A680F5B00A75B9A /* Release */,
1333 | );
1334 | defaultConfigurationIsVisible = 0;
1335 | defaultConfigurationName = Release;
1336 | };
1337 | 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "CachedImageExample-tvOS" */ = {
1338 | isa = XCConfigurationList;
1339 | buildConfigurations = (
1340 | 2D02E4971E0B4A5E006451C7 /* Debug */,
1341 | 2D02E4981E0B4A5E006451C7 /* Release */,
1342 | );
1343 | defaultConfigurationIsVisible = 0;
1344 | defaultConfigurationName = Release;
1345 | };
1346 | 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "CachedImageExample-tvOSTests" */ = {
1347 | isa = XCConfigurationList;
1348 | buildConfigurations = (
1349 | 2D02E4991E0B4A5E006451C7 /* Debug */,
1350 | 2D02E49A1E0B4A5E006451C7 /* Release */,
1351 | );
1352 | defaultConfigurationIsVisible = 0;
1353 | defaultConfigurationName = Release;
1354 | };
1355 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "CachedImageExample" */ = {
1356 | isa = XCConfigurationList;
1357 | buildConfigurations = (
1358 | 83CBBA201A601CBA00E9B192 /* Debug */,
1359 | 83CBBA211A601CBA00E9B192 /* Release */,
1360 | );
1361 | defaultConfigurationIsVisible = 0;
1362 | defaultConfigurationName = Release;
1363 | };
1364 | /* End XCConfigurationList section */
1365 | };
1366 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
1367 | }
1368 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample.xcodeproj/xcshareddata/xcschemes/CachedImageExample-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample.xcodeproj/xcshareddata/xcschemes/CachedImageExample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | @interface AppDelegate : UIResponder
13 |
14 | @property (nonatomic, strong) UIWindow *window;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample/AppDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import "AppDelegate.h"
11 |
12 | #import
13 | #import
14 |
15 | @implementation AppDelegate
16 |
17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
18 | {
19 | NSURL *jsCodeLocation;
20 |
21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
22 |
23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
24 | moduleName:@"CachedImageExample"
25 | initialProperties:nil
26 | launchOptions:launchOptions];
27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
28 |
29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
30 | UIViewController *rootViewController = [UIViewController new];
31 | rootViewController.view = rootView;
32 | self.window.rootViewController = rootViewController;
33 | [self.window makeKeyAndVisible];
34 | return YES;
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | CachedImageExample
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UIViewControllerBasedStatusBarAppearance
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExample/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | #import "AppDelegate.h"
13 |
14 | int main(int argc, char * argv[]) {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExampleTests/CachedImageExampleTests.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 | #import
12 |
13 | #import "RCTLog.h"
14 | #import "RCTRootView.h"
15 |
16 | #define TIMEOUT_SECONDS 600
17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
18 |
19 | @interface CachedImageExampleTests : XCTestCase
20 |
21 | @end
22 |
23 | @implementation CachedImageExampleTests
24 |
25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
26 | {
27 | if (test(view)) {
28 | return YES;
29 | }
30 | for (UIView *subview in [view subviews]) {
31 | if ([self findSubviewInView:subview matching:test]) {
32 | return YES;
33 | }
34 | }
35 | return NO;
36 | }
37 |
38 | - (void)testRendersWelcomeScreen
39 | {
40 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
42 | BOOL foundElement = NO;
43 |
44 | __block NSString *redboxError = nil;
45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
46 | if (level >= RCTLogLevelError) {
47 | redboxError = message;
48 | }
49 | });
50 |
51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54 |
55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57 | return YES;
58 | }
59 | return NO;
60 | }];
61 | }
62 |
63 | RCTSetLogFunction(RCTDefaultLogFunction);
64 |
65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
67 | }
68 |
69 |
70 | @end
71 |
--------------------------------------------------------------------------------
/CachedImageExample/ios/CachedImageExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/CachedImageExample/loading.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fungilation/react-native-cached-image/68f57aeb30e313d4fc5215b8fc841303d6c81ba8/CachedImageExample/loading.jpg
--------------------------------------------------------------------------------
/CachedImageExample/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "CachedImageExample",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "node node_modules/react-native/local-cli/cli.js start",
7 | "test": "jest",
8 | "dev": "yarn && rm -rf ./node_modules/react-native-cached-image; sane 'rsync -av --include='utils/' --include='utils/*.js' --include='*.js' --include='package.json' --exclude='*' ../ ./node_modules/react-native-cached-image' ../ --glob '**/*.js' --glob 'package.json'"
9 | },
10 | "dependencies": {
11 | "react": "16.0.0-alpha.12",
12 | "react-native": "^0.48.3",
13 | "react-native-cached-image": "../"
14 | },
15 | "devDependencies": {
16 | "babel-jest": "^21.0.2",
17 | "babel-preset-react-native": "^3.0.2",
18 | "jest": "^21.0.2",
19 | "react-test-renderer": "^15.6.1",
20 | "sane": "^2.0.0"
21 | },
22 | "jest": {
23 | "preset": "react-native"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/ImageCacheManager.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const _ = require('lodash');
4 |
5 | const fsUtils = require('./utils/fsUtils');
6 | const pathUtils = require('./utils/pathUtils');
7 | const MemoryCache = require('react-native-clcasher/MemoryCache').default;
8 |
9 | module.exports = (defaultOptions = {}, urlCache = MemoryCache, fs = fsUtils, path = pathUtils) => {
10 |
11 | const defaultDefaultOptions = {
12 | headers: {},
13 | ttl: 3600 * 24 * 30, // 60 * 60 * 24 * 14, // 2 weeks
14 | useQueryParamsInCacheKey: false,
15 | cacheLocation: fs.getCacheDir(),
16 | allowSelfSignedSSL: true, // false,
17 | };
18 |
19 | // apply default options
20 | _.defaults(defaultOptions, defaultDefaultOptions);
21 |
22 | function isCacheable(url) {
23 | return _.isString(url) && (_.startsWith(url.toLowerCase(), 'http://') || _.startsWith(url.toLowerCase(), 'https://'));
24 | }
25 |
26 | function cacheUrl(url, options, getCachedFile) {
27 | if (!isCacheable(url)) {
28 | return Promise.reject(new Error('Url is not cacheable'));
29 | }
30 | // allow CachedImage to provide custom options
31 | _.defaults(options, defaultOptions);
32 | // cacheableUrl contains only the needed query params
33 | const cacheableUrl = path.getCacheableUrl(url, options.useQueryParamsInCacheKey);
34 | // note: urlCache may remove the entry if it expired so we need to remove the leftover file manually
35 | return urlCache.get(cacheableUrl)
36 | .then(fileRelativePath => {
37 | if (!fileRelativePath) {
38 | // console.log('ImageCacheManager: url cache miss', cacheableUrl);
39 | throw new Error('URL expired or not in cache');
40 | }
41 | // console.log('ImageCacheManager: url cache hit', cacheableUrl);
42 | const cachedFilePath = `${options.cacheLocation}/${fileRelativePath}`;
43 |
44 | return fs.exists(cachedFilePath)
45 | .then((exists) => {
46 | if (exists) {
47 | return cachedFilePath
48 | } else {
49 | throw new Error('file under URL stored in url cache doesn\'t exsts');
50 | }
51 | });
52 | })
53 | // url is not found in the cache or is expired
54 | .catch(() => {
55 | const fileRelativePath = path.getImageRelativeFilePath(cacheableUrl);
56 | const filePath = `${options.cacheLocation}/${fileRelativePath}`
57 |
58 | // remove expired file if exists
59 | return fs.deleteFile(filePath)
60 | // get the image to cache (download / copy / etc)
61 | .then(() => getCachedFile(filePath))
62 | // add to cache
63 | .then(() => urlCache.set(cacheableUrl, fileRelativePath, options.ttl))
64 | // return filePath
65 | .then(() => filePath);
66 | });
67 | }
68 |
69 | return {
70 |
71 | /**
72 | * download an image and cache the result according to the given options
73 | * @param url
74 | * @param options
75 | * @returns {Promise}
76 | */
77 | downloadAndCacheUrl(url, options = {}) {
78 | return cacheUrl(
79 | url,
80 | options,
81 | filePath => fs.downloadFile(url, filePath, options.headers)
82 | );
83 | },
84 |
85 | /**
86 | * seed the cache for a specific url with a local file
87 | * @param url
88 | * @param seedPath
89 | * @param options
90 | * @returns {Promise}
91 | */
92 | seedAndCacheUrl(url, seedPath, options = {}) {
93 | return cacheUrl(
94 | url,
95 | options,
96 | filePath => fs.copyFile(seedPath, filePath)
97 | );
98 | },
99 |
100 | /**
101 | * delete the cache entry and file for a given url
102 | * @param url
103 | * @param options
104 | * @returns {Promise}
105 | */
106 | deleteUrl(url, options = {}) {
107 | if (!isCacheable(url)) {
108 | return Promise.reject(new Error('Url is not cacheable'));
109 | }
110 | _.defaults(options, defaultOptions);
111 | const cacheableUrl = path.getCacheableUrl(url, options.useQueryParamsInCacheKey);
112 | const filePath = path.getImageFilePath(cacheableUrl, options.cacheLocation);
113 | // remove file from cache
114 | return urlCache.remove(cacheableUrl)
115 | // remove file from disc
116 | .then(() => fs.deleteFile(filePath));
117 | },
118 |
119 | /**
120 | * delete all cached file from the filesystem and cache
121 | * @param options
122 | * @returns {Promise}
123 | */
124 | clearCache(options = {}) {
125 | _.defaults(options, defaultOptions);
126 | return urlCache.flush()
127 | .then(() => fs.cleanDir(options.cacheLocation));
128 | },
129 |
130 | /**
131 | * return info about the cache, list of files and the total size of the cache
132 | * @param options
133 | * @returns {Promise.<{file: Array, size: Number}>}
134 | */
135 | getCacheInfo(options = {}) {
136 | _.defaults(options, defaultOptions);
137 | return fs.getDirInfo(options.cacheLocation);
138 | },
139 |
140 | };
141 | };
142 |
--------------------------------------------------------------------------------
/ImageCacheManagerOptionsPropTypes.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const PropTypes = require('prop-types');
4 |
5 | module.exports = {
6 | headers: PropTypes.object,
7 | ttl: PropTypes.number,
8 | useQueryParamsInCacheKey: PropTypes.oneOfType([
9 | PropTypes.bool,
10 | PropTypes.arrayOf(PropTypes.string)
11 | ]),
12 | cacheLocation: PropTypes.string,
13 | allowSelfSignedSSL: PropTypes.bool
14 | };
15 |
--------------------------------------------------------------------------------
/ImageCachePreloader.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const _ = require('lodash');
4 |
5 | function createPreloader(list) {
6 | const urls = _.clone(list);
7 | return {
8 | next() {
9 | return urls.shift();
10 | }
11 | };
12 | }
13 |
14 | function runPreloadTask(prefetcher, imageCacheManager) {
15 | const url = prefetcher.next();
16 | if (!url) {
17 | return Promise.resolve();
18 | }
19 | // console.log('START', url);
20 | return imageCacheManager.downloadAndCacheUrl(url)
21 | // allow prefetch task to fail without terminating other prefetch tasks
22 | .catch(_.noop)
23 | // .then(() => {
24 | // console.log('END', url);
25 | // })
26 | // then run next task
27 | .then(() => runPreloadTask(prefetcher, imageCacheManager));
28 | }
29 |
30 | module.exports = {
31 |
32 | /**
33 | * download and cache an list of urls
34 | * @param urls
35 | * @param imageCacheManager
36 | * @param numberOfConcurrentPreloads
37 | * @returns {Promise}
38 | */
39 | preloadImages(urls, imageCacheManager, numberOfConcurrentPreloads) {
40 | const preloader = createPreloader(urls);
41 | const numberOfWorkers = numberOfConcurrentPreloads > 0 ? numberOfConcurrentPreloads : urls.length;
42 | const promises = _.times(numberOfWorkers, () =>
43 | runPreloadTask(preloader, imageCacheManager)
44 | );
45 | return Promise.all(promises);
46 | },
47 |
48 | };
49 |
--------------------------------------------------------------------------------
/ImageCacheProvider.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const _ = require('lodash');
4 | const React = require('react');
5 | const ReactNative = require('react-native');
6 |
7 | const PropTypes = require('prop-types');
8 |
9 | const ImageCacheManagerOptionsPropTypes = require('./ImageCacheManagerOptionsPropTypes');
10 |
11 | const ImageCacheManager = require('./ImageCacheManager');
12 | const ImageCachePreloader = require('./ImageCachePreloader');
13 |
14 | class ImageCacheProvider extends React.Component {
15 | static propTypes = {
16 | // only a single child so we can render it without adding a View
17 | children: PropTypes.element,
18 |
19 | // ImageCacheManager options
20 | ...ImageCacheManagerOptionsPropTypes,
21 |
22 | // Preload urls
23 | urlsToPreload: PropTypes.arrayOf(PropTypes.string).isRequired,
24 | numberOfConcurrentPreloads: PropTypes.number.isRequired,
25 |
26 | onPreloadComplete: PropTypes.func.isRequired,
27 | };
28 |
29 | static defaultProps = {
30 | urlsToPreload: [],
31 | numberOfConcurrentPreloads: 0,
32 | onPreloadComplete: _.noop,
33 | };
34 |
35 | static childContextTypes = {
36 | getImageCacheManager: PropTypes.func,
37 | };
38 |
39 | constructor(props) {
40 | super(props);
41 |
42 | this.getImageCacheManagerOptions = this.getImageCacheManagerOptions.bind(this);
43 | this.getImageCacheManager = this.getImageCacheManager.bind(this);
44 | this.preloadImages = this.preloadImages.bind(this);
45 |
46 | }
47 |
48 | getChildContext() {
49 | const self = this;
50 | return {
51 | getImageCacheManager() {
52 | return self.getImageCacheManager();
53 | }
54 | };
55 | }
56 |
57 | UNSAFE_componentWillMount() {
58 | this.preloadImages(this.props.urlsToPreload);
59 | }
60 |
61 | UNSAFE_componentWillReceiveProps(nextProps) {
62 | // reset imageCacheManager in case any option changed
63 | this.imageCacheManager = null;
64 | // preload new images if needed
65 | if (this.props.urlsToPreload !== nextProps.urlsToPreload) {
66 | this.preloadImages(nextProps.urlsToPreload);
67 | }
68 | }
69 |
70 | getImageCacheManagerOptions() {
71 | return _.pick(this.props, _.keys(ImageCacheManagerOptionsPropTypes));
72 | }
73 |
74 | getImageCacheManager() {
75 | if (!this.imageCacheManager) {
76 | const options = this.getImageCacheManagerOptions();
77 | this.imageCacheManager = ImageCacheManager(options);
78 | }
79 | return this.imageCacheManager;
80 | }
81 |
82 | preloadImages(urlsToPreload) {
83 | const imageCacheManager = this.getImageCacheManager();
84 | ImageCachePreloader.preloadImages(urlsToPreload, imageCacheManager, this.props.numberOfConcurrentPreloads)
85 | .then(() => this.props.onPreloadComplete());
86 | }
87 |
88 | render() {
89 | return React.Children.only(this.props.children);
90 | }
91 |
92 | }
93 |
94 | module.exports = ImageCacheProvider;
95 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Kfir Golan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DEPRECATED
2 |
3 | Just use React Native's Image, suits my needs as of RN 0.62.
4 |
5 | Otherwise, this fork works up to RN 0.61. In 0.62, I'm hitting 100% cpu pegged in JSC, haven't investigated further on exactly how. But certain images just completely blocks JSC when loaded in CachedImage.
6 |
7 | Issue: https://github.com/facebook/react-native/issues/28537
8 |
9 | # react-native-cached-image
10 |
11 | CachedImage component for react-native
12 |
13 | This package is greatly inspired by [@jayesbe](https://github.com/jayesbe)'s amazing [react-native-cacheable-image](https://github.com/jayesbe/react-native-cacheable-image) but adds some functionality that we were missing when trying to handle caching images in our react-native app.
14 |
15 | ## Installation
16 |
17 | npm install react-native-cached-image @react-native-community/netinfo rn-fetch-blob --save
18 | - or -
19 | yarn add react-native-cached-image @react-native-community/netinfo rn-fetch-blob
20 |
21 | We use [`rn-fetch-blob`](https://github.com/joltup/rn-fetch-blob#installation) to handle file system access in this package and it requires an extra step during the installation.
22 |
23 | _You should only have to do this once._
24 |
25 | react-native link rn-fetch-blob
26 |
27 | Or, if you want to add Android permissions to AndroidManifest.xml automatically, use this one:
28 |
29 | RNFB_ANDROID_PERMISSIONS=true react-native link rn-fetch-blob
30 |
31 | ### Network Status - Android only
32 | Add the following line to your android/app/src/AndroidManifest.xml
33 |
34 |
35 |
36 | ## Usage
37 |
38 | TODO - add usage example
39 |
40 | ```jsx
41 | import React from 'react';
42 | import {
43 | CachedImage,
44 | ImageCacheProvider
45 | } from 'react-native-cached-image';
46 |
47 | const images = [
48 | 'https://example.com/images/1.jpg',
49 | 'https://example.com/images/2.jpg',
50 | 'https://example.com/images/3.jpg',
51 | // ...
52 | ];
53 |
54 | export default class Example extends React.Component {
55 | render() {
56 | return (
57 | console.log('hey there')}>
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | );
69 | }
70 | }
71 | ```
72 |
73 | ## API
74 |
75 | This package exposes 3 modules:
76 | ```jsx
77 | const {
78 | CachedImage, // react-native component that is a drop-in replacement for your react-native `Image` components
79 | ImageCacheProvider, // a top level component that provides accsess to the underlying `ImageCacheManager` and preloads images
80 | ImageCacheManager, // the logic behind cache machanism - ttl, fs, url resolving etc.
81 | } = require('react-native-cached-image');
82 | ```
83 |
84 | ### ImageCacheManager
85 | This is where all the cache magic takes place.
86 | The API usually takes a *URL* and a set of [`ImageCacheManagerOptions`](#imagecachemanageroptions).
87 |
88 | #### `ImageCacheManager.downloadAndCacheUrl(url: String, options: ImageCacheManagerOptions): Promise`
89 | Check the cache for the the URL (after removing fixing the query string according to `ImageCacheManagerOptions.useQueryParamsInCacheKey`).
90 | If the URL exists in cache and is not expired, resolve with the local cached file path.
91 | Otherwise, download the file to the cache folder, add it to the cache and then return the cached file path.
92 |
93 | #### `ImageCacheManager.seedAndCacheUrl(url: String, seedPath: String, options: ImageCacheManagerOptions): Promise`
94 | Check the cache for the the URL (after removing fixing the query string according to `ImageCacheManagerOptions.useQueryParamsInCacheKey`).
95 | If the URL exists in cache and is not expired, resolve with the local cached file path.
96 | Otherwise, copy the seed file into the cache folder, add it to the cache and then return the cached file path.
97 |
98 | #### `ImageCacheManager.deleteUrl(url: String, options: ImageCacheManagerOptions): Promise`
99 | Removes the cache entry for the URL and the local file corresponding to it, if it exists.
100 |
101 | #### `ImageCacheManager.clearCache(options: ImageCacheManagerOptions): Promise`
102 | Clear the URL cache and remove files in the cache folder (as stated in the `ImageCacheManagerOptions.cacheLocation`)
103 |
104 | #### `ImageCacheManager.getCacheInfo(options: ImageCacheManagerOptions): Promise.<{file: Array, size: Number}>`
105 | Returns info about the cache, list of files and the total size of the cache.
106 |
107 |
108 | ### CachedImage
109 | `CachedImage` is a drop in replacement for the `Image` component that will attempt to cache remote URLs for better performance.
110 | It's main use is to hide the cache layer from the user and provide a simple way to cache images.
111 | `CachedImage` uses an instance of `ImageCacheManager` to interact with the cache, if there is an instance provided by `ImageCacheProvider` via the context it will be used, otherwise a new instance will be created with the options from the component's props.
112 |
113 | ```jsx
114 |
120 | ```
121 |
122 | ##### Props
123 | * `renderImage` - a function that returns a component, used to override the underlying `Image` component.
124 | * `activityIndicatorProps` - props for the `ActivityIndicator` that is shown while the image is downloaded.
125 | * `defaultSource` - prop to display a background image while the source image is downloaded. This will work even in android, but will not display background image if there you set borderRadius on this component style prop
126 | * `loadingIndicator` - _component_ prop to set custom `ActivityIndicator`.
127 | * `fallbackSource` - prop to set placeholder image. when `source.uri` is null or cached failed, the `fallbackSource` will be display.
128 | * any of the `ImageCacheManagerOptionsPropTypes` props - customize the `ImageCacheManager` for this specific `CachedImage` instance.
129 |
130 | ### ImageCacheProvider
131 | This is a top-level component with 2 major functions:
132 | 1. Provide the customized `ImageCacheManager` to nested `CachedImage`.
133 | 2. Preload a set of URLs.
134 |
135 | ##### Props
136 | * `urlsToPreload` - an array of URLs to preload when the component mounts. default []
137 | * `numberOfConcurrentPreloads` - control the number of concurrent downloads, usually used when the `urlsToPreload` array is very big. default `urlsToPreload.length`
138 | * `onPreloadComplete` - callback for when the preload is complete and all images are cached.
139 |
140 | ### ImageCacheManagerOptions
141 | A set of options that are provided to the `ImageCacheManager` and provide ways to customize it to your needs.
142 |
143 | ```jsx
144 | type ImageCacheManagerOptions = {
145 | headers: PropTypes.object, // an object to be used as the headers when sending the request for the url. default {}
146 |
147 | ttl: PropTypes.number, // the number of seconds each url will stay in the cache. default 2 weeks
148 |
149 | useQueryParamsInCacheKey: PropTypes.oneOfType([ // when handling a URL with query params, this indicates how it should be treated:
150 | PropTypes.bool, // if a bool value is given the whole query string will be used / ignored
151 | PropTypes.arrayOf(PropTypes.string) // if an array of strings is given, only these keys will be taken from the query string.
152 | ]), // default false
153 |
154 | cacheLocation: PropTypes.string, // the path to the root of the cache folder. default the device cache dir
155 |
156 | allowSelfSignedSSL: PropTypes.bool, // true to allow self signed SSL URLs to be downloaded. default false
157 | };
158 |
159 | ```
160 |
161 |
162 | ## Contributing
163 |
164 | Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
165 |
--------------------------------------------------------------------------------
/__tests__/ImageCacheManager-test.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | jest.mock('rn-fetch-blob', () => ({default: {fs: {}}}));
4 | jest.mock('react-native-clcasher/MemoryCache', () => ({default: {}}));
5 |
6 | import ImageCacheManager from '../ImageCacheManager';
7 | import SimpleMemoryCache from './SimpleMemoryCache';
8 | import SimpleMemoryFs from './SimpleMemoryFs';
9 |
10 | const icm = ImageCacheManager({}, SimpleMemoryCache, SimpleMemoryFs);
11 |
12 | describe('ImageCacheManager', () => {
13 |
14 | beforeEach(() => icm.clearCache());
15 |
16 | describe('downloadAndCacheUrl', () => {
17 |
18 | it('should fail if URL is not cacheable', () => {
19 | return icm.getCacheInfo()
20 | .then(res => console.log(res))
21 | .then(() => {
22 | return expect(icm.downloadAndCacheUrl('not a real url')).rejects.toBeDefined();
23 | });
24 | });
25 |
26 | it('should download a file when not in cache', () => {
27 | return icm.getCacheInfo()
28 | .then(res => console.log(res))
29 | .then(() => icm.downloadAndCacheUrl('https://example.com/image.jpg'))
30 | .then(() => icm.getCacheInfo())
31 | .then(res => console.log(res))
32 | });
33 |
34 | it('should add new entry to the cache if not in cache', () => {
35 |
36 | });
37 |
38 | it('should return file name if image is in cache', () => {
39 |
40 | });
41 |
42 | it('should not return cached entry if expired', () => {
43 |
44 | });
45 |
46 | });
47 |
48 | });
--------------------------------------------------------------------------------
/__tests__/SimpleMemoryCache.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const DEFAULT_EXPIRES = 999999;
4 |
5 | function currentTime() {
6 | return Math.floor((new Date().getTime() / 1000));
7 | }
8 |
9 | let cache = {};
10 |
11 | const SimpleMemoryCache = {};
12 |
13 | SimpleMemoryCache.set = (key, value, expires = DEFAULT_EXPIRES) => {
14 | cache[key] = {
15 | value: value,
16 | expires: currentTime() + parseInt(expires)
17 | };
18 | return Promise.resolve();
19 | };
20 |
21 | SimpleMemoryCache.get = (key) => {
22 | const curTime = currentTime();
23 | const v = cache[key];
24 | if (v && v.expires && v.expires >= curTime) {
25 | return Promise.resolve(v.value);
26 | }
27 | return Promise.resolve();
28 | };
29 |
30 | SimpleMemoryCache.remove = async (key) => {
31 | delete cache[key];
32 | return Promise.resolve();
33 | };
34 |
35 | SimpleMemoryCache.flush = async () => {
36 | cache = {};
37 | return Promise.resolve();
38 | };
39 | export default SimpleMemoryCache;
--------------------------------------------------------------------------------
/__tests__/SimpleMemoryFs.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const _ = require('lodash');
4 |
5 | let fs = {};
6 |
7 | /**
8 | * wrapper around common filesystem actions
9 | */
10 | module.exports = {
11 |
12 | /**
13 | * returns the local cache dir
14 | * @returns {String}
15 | */
16 | getCacheDir() {
17 | return '/imagesCacheDir';
18 | },
19 |
20 | /**
21 | * returns a promise that is resolved when the download of the requested file
22 | * is complete and the file is saved.
23 | * if the download fails, or was stopped the partial file is deleted, and the
24 | * promise is rejected
25 | * @param fromUrl String source url
26 | * @param toFile String destination path
27 | * @param headers Object with headers to use when downloading the file
28 | * @returns {Promise}
29 | */
30 | downloadFile(fromUrl, toFile, headers) {
31 | fs[toFile] = fromUrl;
32 | return Promise.resolve(toFile);
33 | },
34 |
35 | /**
36 | * remove the file in filePath if it exists.
37 | * this method always resolves
38 | * @param filePath
39 | * @returns {Promise}
40 | */
41 | deleteFile(filePath) {
42 | delete fs[filePath];
43 | return Promise.resolve();
44 | },
45 |
46 | /**
47 | * copy a file from fromFile to toFile
48 | * @param fromFile
49 | * @param toFile
50 | * @returns {Promise}
51 | */
52 | copyFile(fromFile, toFile) {
53 | fs[toFile] = fs[fromFile] || fromFile;
54 | return Promise.resolve();
55 | },
56 |
57 | /**
58 | * remove the contents of dirPath
59 | * @param dirPath
60 | * @returns {Promise}
61 | */
62 | cleanDir(dirPath) {
63 | fs = _.omitBy(fs, (v, k) => _.startsWith(k, dirPath));
64 | return Promise.resolve();
65 | },
66 |
67 | /**
68 | * get info about files in a folder
69 | * @param dirPath
70 | * @returns {Promise.<{file:Array, size:Number}>}
71 | */
72 | getDirInfo(dirPath) {
73 | const files = _(fs)
74 | .pickBy((v, k) => _.startsWith(k, dirPath))
75 | .map((v, k) => ({
76 | filename: k,
77 | source: v,
78 | size: 1
79 | }))
80 | .value();
81 | return Promise.resolve({
82 | files,
83 | size: files.length
84 | });
85 | },
86 |
87 | };
--------------------------------------------------------------------------------
/index.d.ts:
--------------------------------------------------------------------------------
1 | import * as ReactNative from "react-native";
2 | import * as React from 'react'
3 |
4 | declare module "react-native-cached-image" {
5 | namespace CachedImage {
6 | interface Image extends ReactNative.Image {
7 | /**
8 | * props for the ActivityIndicator that is shown while the image is downloaded.
9 | */
10 | activityIndicatorProps: ReactNative.ActivityIndicatorProperties
11 | /**
12 | * component prop to set custom ActivityIndicator
13 | */
14 | loadingIndicator: ReactNative.ComponentInterface
15 | /**
16 | * function when provided, the returned object will be used as the headers object
17 | * when sending the request to download the image. (default: () => Promise.resolve({}))
18 | */
19 | resolveHeaders: Promise<{}>
20 | /**
21 | * array|bool an array of keys to use from the source.
22 | * uri query string or a bool value stating whether to use the entire query string or not. (default: false)
23 | */
24 | useQueryParamsInCacheKey: string[] | boolean
25 | /**
26 | * string allows changing the root directory to use for caching.
27 | * The default directory is sufficient for most use-cases.
28 | * Images in this directory may be purged by Android automatically to free up space.
29 | * Use ImageCacheProvider.LOCATION.BUNDLE if the cached images are critical
30 | * (you will have to manage cleanup manually).
31 | * (default: ImageCacheProvider.LOCATION.CACHE)
32 | */
33 | cacheLocation: string
34 | /**
35 | * prop to display a background image while the source image is downloaded.
36 | * This will work even in android, but will not display background image
37 | * if there you set borderRadius on this component style prop
38 | */
39 | defaultSource: ReactNative.ImageURISource
40 | /**
41 | * prop to set placeholder image. when source.uri is null or cached failed, the fallbackSource will be display.
42 | */
43 | fallbackSource: string
44 | }
45 |
46 | interface CacheOptions {
47 | /** an object to be used as the headers when sending the request for the url */
48 | headers: object
49 | /** the number of seconds each url will stay in the cache. default 2 weeks */
50 | ttl: number
51 | /**
52 | * array|bool an array of keys to use from the source.
53 | * uri query string or a bool value stating whether to use the entire query string or not. (default: false)
54 | */
55 | useQueryParamsInCacheKey: string[] | boolean
56 | /**
57 | * the root directory to use for caching, corresponds to CachedImage prop of same name,
58 | * defaults to system cache directory
59 | */
60 | cacheLocation: string
61 | /** true to allow self signed SSL URLs to be downloaded. default false */
62 | allowSelfSignedSSL: boolean
63 | }
64 |
65 | interface ImageCacheProvider extends CacheOptions {
66 | /** an array of URLs to preload when the component mounts */
67 | urlsToPreload: string[]
68 | /** control the number of concurrent downloads, usually used when the urlsToPreload array is very big. default urlsToPreload.length */
69 | numberOfConcurrentPreloads: number
70 | /** callback for when the preload is complete and all images are cached. */
71 | onPreloadComplete: Function
72 | }
73 |
74 | interface CacheInfoFile {
75 | filename: string
76 | lastModified: number
77 | path: string
78 | size: number
79 | type: string
80 | }
81 |
82 | interface PromiseCacheInfo {
83 | files: CacheInfoFile[]
84 | size: number
85 | }
86 |
87 | interface ImageCacheManager {
88 | /** download an image and cache the result according to the given options */
89 | downloadAndCacheUrl(url: String, options:CacheOptions ): Promise
90 |
91 | /** Delete the cached image corresponding to the given url */
92 | deleteUrl(urls: string, options?: CacheOptions): Promise
93 |
94 | /**
95 | * Seed the cache of a specified url with a local image
96 | * Handy if you have a local copy of a remote image, e.g. you just uploaded local to url.
97 | */
98 | seedAndCacheUrl(url: string, seedPath: string, options?: CacheOptions): Promise
99 |
100 | /**
101 | * Clear the entire cache.
102 | */
103 | clearCache(): Promise
104 |
105 | /**
106 | * Return info about the cache, list of files and the total size of the cache.
107 | */
108 | getCacheInfo(options?: CacheOptions): Promise
109 | // LOCATION : {
110 | // CACHE: string
111 | // BUNDLE: string
112 | // }
113 | }
114 | interface ImageCachePreloader {
115 | preloadImages(urls: string[], imageCacheManager: ImageCacheManager, numberOfConcurrentPreloads: number): Promise
116 | }
117 | }
118 | export class CachedImage extends React.Component {}
119 | export class ImageCacheProvider extends React.Component {}
120 | export const ImageCacheManager: CachedImage.ImageCacheManager
121 | export const ImageCachePreloader: CachedImage.ImageCachePreloader
122 | }
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports.CachedImage = require('./CachedImage');
4 | module.exports.ImageCacheProvider = require('./ImageCacheProvider');
5 | module.exports.ImageCacheManager = require('./ImageCacheManager');
6 | module.exports.ImageCachePreloader = require('./ImageCachePreloader');
7 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-cached-image",
3 | "version": "1.4.3",
4 | "description": "CachedImage component for react-native",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "./node_modules/.bin/jest"
8 | },
9 | "jest": {
10 | "preset": "react-native",
11 | "globals": {
12 | "NODE_ENV": "test"
13 | },
14 | "testPathIgnorePatterns": [
15 | "/node_modules/",
16 | "/CachedImageExample/"
17 | ],
18 | "modulePathIgnorePatterns": [
19 | "/CachedImageExample/"
20 | ],
21 | "verbose": true
22 | },
23 | "repository": {
24 | "type": "git",
25 | "url": "https://github.com/kfiroo/react-native-cached-image"
26 | },
27 | "keywords": [
28 | "react-native",
29 | "cache",
30 | "image"
31 | ],
32 | "author": "kfiroo ",
33 | "license": "MIT",
34 | "bugs": {
35 | "url": "https://github.com/kfiroo/react-native-cached-image/issues"
36 | },
37 | "homepage": "https://github.com/kfiroo/react-native-cached-image",
38 | "files": [
39 | "index.js",
40 | "CachedImage.js",
41 | "ImageCacheProvider.js",
42 | "ImageCacheManager.js",
43 | "ImageCacheManagerOptionsPropTypes.js",
44 | "ImageCachePreloader.js",
45 | "utils/fsUtils.js",
46 | "utils/pathUtils.js"
47 | ],
48 | "typings": "./index.d.ts",
49 | "dependencies": {
50 | "crypto-js": "3.1.9-1",
51 | "lodash": "^4.17.10",
52 | "prop-types": "15.5.10",
53 | "react-native-clcasher": "1.0.0",
54 | "url-parse": "^1.4.1"
55 | },
56 | "peerDependencies": {
57 | "@react-native-community/netinfo": "^4.6.0",
58 | "rn-fetch-blob": "^0.11.2"
59 | },
60 | "devDependencies": {
61 | "babel-jest": "^21.0.2",
62 | "babel-preset-env": "*",
63 | "babel-preset-react-native": "^4.0.1",
64 | "jest": "^21.0.2",
65 | "jest-react-native": "^18.0.0",
66 | "react": "16.4.1",
67 | "react-native": "^0.48.3",
68 | "react-test-renderer": "^15.6.1",
69 | "regenerator-runtime": "^0.11.0"
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/utils/fsUtils.js:
--------------------------------------------------------------------------------
1 | "use strict"
2 |
3 | const _ = require("lodash")
4 |
5 | const RNFetchBlob = require("rn-fetch-blob").default
6 |
7 | const { fs } = RNFetchBlob
8 |
9 | const activeDownloads = {}
10 |
11 | function getDirPath(path) {
12 | // if path is a file (has ext) remove it
13 | if (path.charAt(path.length - 4) === "." || path.charAt(path.length - 5) === ".") {
14 | return _.initial(path.split("/")).join("/")
15 | }
16 | return path
17 | }
18 |
19 | function ensurePath(path) {
20 | const dirPath = getDirPath(path)
21 | return fs
22 | .isDir(dirPath)
23 | .then(isDir => {
24 | if (!isDir) {
25 | return (
26 | fs
27 | .mkdir(dirPath)
28 | // check if dir has indeed been created because
29 | // there's no exception on incorrect user-defined paths (?)...
30 | .then(() => fs.isDir(dirPath))
31 | .then(isDir => {
32 | if (!isDir) {
33 | throw new Error("Invalid cacheLocation")
34 | }
35 | })
36 | )
37 | }
38 | })
39 | .catch(err => {
40 | const errorMessage = err.message.toLowerCase()
41 | // ignore folder already exists errors
42 | if (errorMessage.includes("already exists") && (errorMessage.includes("folder") || errorMessage.includes("directory"))) {
43 | return
44 | }
45 |
46 | return Promise.reject(err)
47 | })
48 | }
49 |
50 | function collectFilesInfo(basePath) {
51 | return fs
52 | .stat(basePath)
53 | .then(info => {
54 | if (info.type === "file") {
55 | return [info]
56 | }
57 | return fs.ls(basePath).then(files => {
58 | const promises = _.map(files, file => {
59 | return collectFilesInfo(`${basePath}/${file}`)
60 | })
61 | return Promise.all(promises)
62 | })
63 | })
64 | .catch(err => {
65 | return []
66 | })
67 | }
68 |
69 | /**
70 | * wrapper around common filesystem actions
71 | */
72 | module.exports = {
73 | /**
74 | * returns the local cache dir
75 | * @returns {String}
76 | */
77 | getCacheDir() {
78 | return fs.dirs.CacheDir + "/imagesCacheDir"
79 | },
80 |
81 | /**
82 | * returns a promise that is resolved when the download of the requested file
83 | * is complete and the file is saved.
84 | * if the download fails, or was stopped the partial file is deleted, and the
85 | * promise is rejected
86 | * @param fromUrl String source url
87 | * @param toFile String destination path
88 | * @param headers Object with headers to use when downloading the file
89 | * @returns {Promise}
90 | */
91 | downloadFile(fromUrl, toFile, headers) {
92 | // use toFile as the key as is was created using the cacheKey
93 | if (!_.has(activeDownloads, toFile)) {
94 | // using a temporary file, if the download is accidentally interrupted, it will not produce a disabled file
95 | const tmpFile = toFile + ".tmp"
96 | // create an active download for this file
97 | activeDownloads[toFile] = ensurePath(toFile).then(() =>
98 | RNFetchBlob.config({
99 | path: tmpFile,
100 | })
101 | .fetch("GET", fromUrl, headers)
102 | .then(res => {
103 | if (res.respInfo.status === 304) {
104 | return Promise.resolve(toFile)
105 | }
106 | let status = Math.floor(res.respInfo.status / 100)
107 | if (status !== 2) {
108 | // TODO - log / return error?
109 | return Promise.reject()
110 | }
111 |
112 | return RNFetchBlob.fs.stat(tmpFile).then(fileStats => {
113 | // Verify if the content was fully downloaded!
114 | if (res.respInfo.headers["Content-Length"] && res.respInfo.headers["Content-Length"] != fileStats.size) {
115 | return Promise.reject()
116 | }
117 |
118 | // the download is complete and rename the temporary file
119 | return fs.mv(tmpFile, toFile)
120 | })
121 | })
122 | .catch(error => {
123 | // cleanup. will try re-download on next CachedImage mount.
124 | this.deleteFile(tmpFile)
125 | delete activeDownloads[toFile]
126 | return Promise.reject("Download failed")
127 | })
128 | .then(() => {
129 | // cleanup
130 | this.deleteFile(tmpFile)
131 | delete activeDownloads[toFile]
132 | return toFile
133 | }),
134 | )
135 | }
136 | return activeDownloads[toFile]
137 | },
138 |
139 | /**
140 | * remove the file in filePath if it exists.
141 | * this method always resolves
142 | * @param filePath
143 | * @returns {Promise}
144 | */
145 | deleteFile(filePath) {
146 | return fs
147 | .stat(filePath)
148 | .then(res => res && res.type === "file")
149 | .then(exists => exists && fs.unlink(filePath))
150 | .catch(err => {
151 | // swallow error to always resolve
152 | })
153 | },
154 |
155 | /**
156 | * copy a file from fromFile to toFile
157 | * @param fromFile
158 | * @param toFile
159 | * @returns {Promise}
160 | */
161 | copyFile(fromFile, toFile) {
162 | return ensurePath(toFile).then(() => fs.cp(fromFile, toFile))
163 | },
164 |
165 | /**
166 | * remove the contents of dirPath
167 | * @param dirPath
168 | * @returns {Promise}
169 | */
170 | cleanDir(dirPath) {
171 | return fs
172 | .isDir(dirPath)
173 | .then(isDir => isDir && fs.unlink(dirPath))
174 | .catch(() => {})
175 | .then(() => ensurePath(dirPath))
176 | },
177 |
178 | /**
179 | * get info about files in a folder
180 | * @param dirPath
181 | * @returns {Promise.<{file:Array, size:Number}>}
182 | */
183 | getDirInfo(dirPath) {
184 | return fs
185 | .isDir(dirPath)
186 | .then(isDir => {
187 | if (isDir) {
188 | return collectFilesInfo(dirPath)
189 | } else {
190 | return Promise.reject("Dir does not exists")
191 | }
192 | })
193 | .then(filesInfo => {
194 | const files = _.flattenDeep(filesInfo)
195 | const size = _.sumBy(files, "size")
196 | return {
197 | files,
198 | size,
199 | }
200 | })
201 | },
202 |
203 | exists(path) {
204 | return fs.exists(path)
205 | },
206 | }
207 |
--------------------------------------------------------------------------------
/utils/pathUtils.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const _ = require('lodash');
4 | const URL = require('url-parse');
5 | const SHA1 = require("crypto-js/sha1");
6 |
7 | const defaultImageTypes = ['png', 'jpeg', 'jpg', 'gif', 'bmp', 'tiff', 'tif'];
8 |
9 | function serializeObjectKeys(obj) {
10 | return _(obj)
11 | .toPairs()
12 | .sortBy(a => a[0])
13 | .map(a => a[1])
14 | .value();
15 | }
16 |
17 | function getQueryForCacheKey(url, useQueryParamsInCacheKey) {
18 | if (_.isArray(useQueryParamsInCacheKey)) {
19 | return serializeObjectKeys(_.pick(url.query, useQueryParamsInCacheKey));
20 | }
21 | if (useQueryParamsInCacheKey) {
22 | return serializeObjectKeys(url.query);
23 | }
24 | return '';
25 | }
26 |
27 | function generateCacheKey(url, useQueryParamsInCacheKey = true) {
28 | const parsedUrl = new URL(url, null, true);
29 |
30 | const pathParts = parsedUrl.pathname.split('/');
31 |
32 | // last path part is the file name
33 | const fileName = pathParts.pop();
34 | const filePath = pathParts.join('/');
35 |
36 | const parts = fileName.split('.');
37 | const fileType = parts.length > 1 ? _.toLower(parts.pop()) : '';
38 | const type = defaultImageTypes.includes(fileType) ? fileType : 'jpg';
39 |
40 | const cacheable = filePath + fileName + type + getQueryForCacheKey(parsedUrl, useQueryParamsInCacheKey);
41 | return SHA1(cacheable) + '.' + type;
42 | }
43 |
44 | function getHostCachePathComponent(url) {
45 | const {
46 | host
47 | } = new URL(url);
48 |
49 | return host.replace(/\.:/gi, '_').replace(/[^a-z0-9_]/gi, '_').toLowerCase()
50 | + '_' + SHA1(host);
51 | }
52 |
53 | /**
54 | * handle the resolution of URLs to local file paths
55 | */
56 | module.exports = {
57 |
58 | /**
59 | * Given a URL and some options returns the file path in the file system corresponding to it's cached image location
60 | * @param url
61 | * @param cacheLocation
62 | * @returns {string}
63 | */
64 | getImageFilePath(url, cacheLocation) {
65 | const hostCachePath = getHostCachePathComponent(url);
66 | const cacheKey = generateCacheKey(url);
67 |
68 | return `${cacheLocation}/${hostCachePath}/${cacheKey}`;
69 | },
70 |
71 | /**
72 | * Given a URL returns the relative file path combined from host and url hash
73 | * @param url
74 | * @returns {string}
75 | */
76 |
77 | getImageRelativeFilePath(url) {
78 | const hostCachePath = getHostCachePathComponent(url);
79 | const cacheKey = generateCacheKey(url);
80 |
81 | return `${hostCachePath}/${cacheKey}`;
82 | },
83 |
84 |
85 | /**
86 | * returns the url after removing all unused query params
87 | * @param url
88 | * @param useQueryParamsInCacheKey
89 | * @returns {string}
90 | */
91 | getCacheableUrl(url, useQueryParamsInCacheKey) {
92 | const parsedUrl = new URL(url, null, true);
93 | if (_.isArray(useQueryParamsInCacheKey)) {
94 | parsedUrl.set('query', _.pick(parsedUrl.query, useQueryParamsInCacheKey));
95 | }
96 | if (!useQueryParamsInCacheKey) {
97 | parsedUrl.set('query', {});
98 | }
99 | return parsedUrl.toString();
100 | }
101 |
102 | };
103 |
--------------------------------------------------------------------------------