Skip to content

Commit

Permalink
install react-native-fetch-blob on example project
Browse files Browse the repository at this point in the history
  • Loading branch information
kfiroo committed Apr 2, 2017
1 parent b191d9f commit 18ec630
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 77 deletions.
2 changes: 1 addition & 1 deletion CachedImageExample/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ android {
}

dependencies {
compile project(':react-native-fs')
compile project(':react-native-fetch-blob')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
Expand Down
44 changes: 23 additions & 21 deletions CachedImageExample/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cachedimageexample"
android:versionCode="1"
android:versionName="1.0">
package="com.cachedimageexample"
android:versionCode="1"
android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
android:minSdkVersion="16"
android:targetSdkVersion="22"/>

<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.cachedimageexample;

import android.app.Application;
import android.util.Log;
import android.app.Application;

import com.facebook.react.ReactApplication;
import com.rnfs.RNFSPackage;
import com.RNFetchBlob.RNFetchBlobPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
Expand All @@ -16,29 +16,29 @@

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNFetchBlobPackage()
);
}
};

@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNFSPackage()
);
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}

@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
4 changes: 2 additions & 2 deletions CachedImageExample/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rootProject.name = 'CachedImageExample'
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
include ':react-native-fetch-blob'
project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android')

include ':app'
52 changes: 28 additions & 24 deletions CachedImageExample/ios/CachedImageExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
5A301533C1D248A684417411 /* libRNFetchBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E55B5701ADA444EBBC8EA5A /* libRNFetchBlob.a */; };
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
B1270DC51DF3596000F5EFCB /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B1270DC41DF352E700F5EFCB /* libRNFS.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -168,13 +168,6 @@
remoteGlobalIDString = 2D2A28131D9B038B00D4039D;
remoteInfo = "React-tvOS";
};
B1270DC31DF352E700F5EFCB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BF9C5953EFE448558A3F8F8A /* RNFS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F12AFB9B1ADAF8F800E0535D;
remoteInfo = RNFS;
};
B13BE7821E3E2B0A00C046E0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
Expand Down Expand Up @@ -217,6 +210,13 @@
remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4;
remoteInfo = "jschelpers-tvOS";
};
B19920D01E91305700803196 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 7308BE64683240A988168F6A /* RNFetchBlob.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = A15C300E1CD25C330074CB35;
remoteInfo = RNFetchBlob;
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
Expand All @@ -229,6 +229,7 @@
00E356EE1AD99517003FC87E /* CachedImageExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CachedImageExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* CachedImageExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CachedImageExampleTests.m; sourceTree = "<group>"; };
0E55B5701ADA444EBBC8EA5A /* libRNFetchBlob.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFetchBlob.a; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* CachedImageExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CachedImageExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -240,9 +241,9 @@
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = CachedImageExample/main.m; sourceTree = "<group>"; };
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
7308BE64683240A988168F6A /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFetchBlob.xcodeproj; path = "../node_modules/react-native-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
BF9C5953EFE448558A3F8F8A /* RNFS.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNFS.xcodeproj; path = "../node_modules/react-native-fs/RNFS.xcodeproj"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -258,7 +259,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B1270DC51DF3596000F5EFCB /* libRNFS.a in Frameworks */,
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */,
146834051AC3E58100842450 /* libReact.a in Frameworks */,
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
Expand All @@ -270,6 +270,7 @@
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
5A301533C1D248A684417411 /* libRNFetchBlob.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -414,7 +415,7 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
BF9C5953EFE448558A3F8F8A /* RNFS.xcodeproj */,
7308BE64683240A988168F6A /* RNFetchBlob.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
Expand Down Expand Up @@ -449,10 +450,10 @@
name = Products;
sourceTree = "<group>";
};
B1270DAD1DF352E700F5EFCB /* Products */ = {
B19920B41E91305700803196 /* Products */ = {
isa = PBXGroup;
children = (
B1270DC41DF352E700F5EFCB /* libRNFS.a */,
B19920D11E91305700803196 /* libRNFetchBlob.a */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -502,7 +503,7 @@
83CBB9F71A601CBA00E9B192 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0820;
LastUpgradeCheck = 820;
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
00E356ED1AD99517003FC87E = {
Expand Down Expand Up @@ -568,8 +569,8 @@
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = B1270DAD1DF352E700F5EFCB /* Products */;
ProjectRef = BF9C5953EFE448558A3F8F8A /* RNFS.xcodeproj */;
ProductGroup = B19920B41E91305700803196 /* Products */;
ProjectRef = 7308BE64683240A988168F6A /* RNFetchBlob.xcodeproj */;
},
);
projectRoot = "";
Expand Down Expand Up @@ -714,13 +715,6 @@
remoteRef = B1270DA01DF34CB700F5EFCB /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B1270DC41DF352E700F5EFCB /* libRNFS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNFS.a;
remoteRef = B1270DC31DF352E700F5EFCB /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B13BE7831E3E2B0A00C046E0 /* libyoga.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
Expand Down Expand Up @@ -763,6 +757,13 @@
remoteRef = B13BE78C1E3E2B0A00C046E0 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B19920D11E91305700803196 /* libRNFetchBlob.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNFetchBlob.a;
remoteRef = B19920D01E91305700803196 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
Expand Down Expand Up @@ -856,6 +857,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -874,6 +876,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -962,7 +965,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native/ReactCommon/**",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-fetch-blob/ios/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
Expand Down Expand Up @@ -1007,6 +1010,7 @@
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native/ReactCommon/**",
"$(SRCROOT)/../node_modules/react-native-fs/**",
"$(SRCROOT)/../node_modules/react-native-fetch-blob/ios/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
Expand Down
6 changes: 3 additions & 3 deletions CachedImageExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"dev": "rm -rf ./node_modules/react-native-cached-image; sane 'rsync -av --include='*.js' --include='package.json' --exclude='*' ../ ./node_modules/react-native-cached-image' ../ --glob '*.js' --glob 'package.json'"
"dev": "yarn && rm -rf ./node_modules/react-native-cached-image; sane 'rsync -av --include='*.js' --include='package.json' --exclude='*' ../ ./node_modules/react-native-cached-image' ../ --glob '*.js' --glob 'package.json'"
},
"dependencies": {
"react": "15.4.2",
"react-native": "0.40.0",
"react-native-cached-image": "1.2.0"
"react-native-cached-image": "*"
},
"devDependencies": {
"babel-jest": "18.0.0",
Expand All @@ -22,4 +22,4 @@
"jest": {
"preset": "react-native"
}
}
}
23 changes: 19 additions & 4 deletions CachedImageExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ balanced-match@^0.4.1:
version "0.4.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"

base-64@^0.1.0:
base-64@0.1.0, base-64@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb"

Expand Down Expand Up @@ -1575,7 +1575,7 @@ glob@^5.0.15:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@^7.0.3, glob@^7.0.5:
glob@^7.0.3, glob@^7.0.5, glob@^7.0.6:
version "7.1.1"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
dependencies:
Expand Down Expand Up @@ -2471,15 +2471,15 @@ lodash.templatesettings@^3.0.0:
lodash._reinterpolate "^3.0.0"
lodash.escape "^3.0.0"

[email protected]:
[email protected], lodash@^4.14.0, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.6.1:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"

lodash@^3.5.0:
version "3.10.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"

lodash@^4.14.0, lodash@^4.16.6, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.6.1:
lodash@^4.16.6:
version "4.17.2"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42"

Expand Down Expand Up @@ -3014,6 +3014,21 @@ [email protected]:
react-native-fs "2.1.0-rc.1"
url-parse "1.1.7"

"react-native-cached-image@file:../":
version "1.2.6"
dependencies:
crypto-js "3.1.9-1"
lodash "4.17.4"
react-native-fetch-blob "0.10.4"
url-parse "1.1.7"

[email protected]:
version "0.10.4"
resolved "https://registry.yarnpkg.com/react-native-fetch-blob/-/react-native-fetch-blob-0.10.4.tgz#7e2d2096ea79dbc8da96e1915cf862f6afe2d0fd"
dependencies:
base-64 "0.1.0"
glob "^7.0.6"

[email protected]:
version v2.1.0-rc.1
resolved "https://registry.yarnpkg.com/react-native-fs/-/react-native-fs-2.1.0-rc.1.tgz#f6078891005478648738db396e822ec0aefc4b95"
Expand Down

0 comments on commit 18ec630

Please sign in to comment.