Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

Commit fa22d42

Browse files
committed
修改区块链icon
1 parent aa11fa8 commit fa22d42

File tree

10 files changed

+159
-21
lines changed

10 files changed

+159
-21
lines changed

.babelrc

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
{
2-
"presets": ["react-native"]
2+
"presets": ["react-native"],
3+
"plugins": [
4+
["babel-plugin-inline-import", {
5+
"extensions": [
6+
".svg"
7+
]
8+
}]
9+
]
310
}

android/app/build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ android {
101101
applicationId "com.icyarrow.biu.readhub"
102102
minSdkVersion 16
103103
targetSdkVersion 22
104-
versionCode 8
105-
versionName "1.4.1"
104+
versionCode 10
105+
versionName "1.5.0"
106106
ndk {
107107
abiFilters "armeabi-v7a", "x86"
108108
}
@@ -148,6 +148,7 @@ android {
148148
}
149149

150150
dependencies {
151+
compile project(':react-native-svg')
151152
compile project(':react-native-vector-icons')
152153
compile fileTree(dir: "libs", include: ["*.jar"])
153154
compile "com.android.support:appcompat-v7:23.0.1"

android/app/src/main/java/com/icyarrow/biu/readhub/MainApplication.java

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.Application;
44

55
import com.facebook.react.ReactApplication;
6+
import com.horcrux.svg.SvgPackage;
67
import com.oblador.vectoricons.VectorIconsPackage;
78
import com.facebook.react.ReactNativeHost;
89
import com.facebook.react.ReactPackage;
@@ -24,6 +25,7 @@ public boolean getUseDeveloperSupport() {
2425
protected List<ReactPackage> getPackages() {
2526
return Arrays.<ReactPackage>asList(
2627
new MainReactPackage(),
28+
new SvgPackage(),
2729
new VectorIconsPackage()
2830
);
2931
}

android/settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
rootProject.name = 'Biu'
2+
include ':react-native-svg'
3+
project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android')
24
include ':react-native-vector-icons'
35
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
46

images/blockchain.svg

+20
Loading

images/blockchain_gray.svg

+20
Loading

ios/Biu.xcodeproj/project.pbxproj

+57
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
B3C835A434474B80B500751B /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CB7690804F604BE9AA35E860 /* MaterialIcons.ttf */; };
4949
BC4E6919B5054881A7E6FB45 /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CBC69AD61B984176A8A54F79 /* Octicons.ttf */; };
5050
BD06A4E6B83445BFB4CE51AB /* libRCTWKWebView.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 77F0EF773D75407BB9F6E14C /* libRCTWKWebView.a */; };
51+
C073F8CEEE994903BAF911A9 /* libRNSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A567A3A9C7048D786F99BB7 /* libRNSVG.a */; };
5152
C93F7AF3AC08443BAEC0481F /* Foundation.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B7C04742A4D8468B9FF16C78 /* Foundation.ttf */; };
5253
D3F053196FCC4CC3A4B8B314 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 36A0D206C9634E3B8AFF7CB8 /* Ionicons.ttf */; };
5354
/* End PBXBuildFile section */
@@ -221,6 +222,20 @@
221222
remoteGlobalIDString = 2D2A28201D9B03D100D4039D;
222223
remoteInfo = "RCTAnimation-tvOS";
223224
};
225+
642783C4203017C7003F9C19 /* PBXContainerItemProxy */ = {
226+
isa = PBXContainerItemProxy;
227+
containerPortal = FF4B7951E94D4B188D0BB435 /* RNSVG.xcodeproj */;
228+
proxyType = 2;
229+
remoteGlobalIDString = 0CF68AC11AF0540F00FF9E5C;
230+
remoteInfo = RNSVG;
231+
};
232+
642783C6203017C7003F9C19 /* PBXContainerItemProxy */ = {
233+
isa = PBXContainerItemProxy;
234+
containerPortal = FF4B7951E94D4B188D0BB435 /* RNSVG.xcodeproj */;
235+
proxyType = 2;
236+
remoteGlobalIDString = 94DDAC5C1F3D024300EED511;
237+
remoteInfo = "RNSVG-tvOS";
238+
};
224239
645B0DE71F9CB28B0048EE84 /* PBXContainerItemProxy */ = {
225240
isa = PBXContainerItemProxy;
226241
containerPortal = 645B0DE21F9CB28A0048EE84 /* ART.xcodeproj */;
@@ -355,7 +370,9 @@
355370
30F80890E96B4E1DB09A41A8 /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; };
356371
358ABFFB48D54556835706D1 /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; };
357372
36A0D206C9634E3B8AFF7CB8 /* Ionicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Ionicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf"; sourceTree = "<group>"; };
373+
4A567A3A9C7048D786F99BB7 /* libRNSVG.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNSVG.a; sourceTree = "<group>"; };
358374
56EC59658E4842D0A9268EEC /* Feather.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Feather.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Feather.ttf"; sourceTree = "<group>"; };
375+
5A61A9652B944FCD935E1E1D /* libRNSVG-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNSVG-tvOS.a"; sourceTree = "<group>"; };
359376
5DD93C90CEEF4DD6B1A4D5E8 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = "<group>"; };
360377
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
361378
645B0DE21F9CB28A0048EE84 /* ART.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ART.xcodeproj; path = "../node_modules/react-native/Libraries/ART/ART.xcodeproj"; sourceTree = "<group>"; };
@@ -371,6 +388,7 @@
371388
CBC69AD61B984176A8A54F79 /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; };
372389
D4AB809C56544084A2EE5B52 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = SimpleLineIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = "<group>"; };
373390
ED8892C01D4F4DED89B804E6 /* libSafariViewManager.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libSafariViewManager.a; sourceTree = "<group>"; };
391+
FF4B7951E94D4B188D0BB435 /* RNSVG.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNSVG.xcodeproj; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = "<group>"; };
374392
/* End PBXFileReference section */
375393

376394
/* Begin PBXFrameworksBuildPhase section */
@@ -395,6 +413,7 @@
395413
5F7C506D813E487C91E85AC9 /* libRNVectorIcons.a in Frameworks */,
396414
3E6292E7CC9F41BD946C5D87 /* libSafariViewManager.a in Frameworks */,
397415
BD06A4E6B83445BFB4CE51AB /* libRCTWKWebView.a in Frameworks */,
416+
C073F8CEEE994903BAF911A9 /* libRNSVG.a in Frameworks */,
398417
);
399418
runOnlyForDeploymentPostprocessing = 0;
400419
};
@@ -544,6 +563,15 @@
544563
name = Products;
545564
sourceTree = "<group>";
546565
};
566+
642783C0203017C7003F9C19 /* Products */ = {
567+
isa = PBXGroup;
568+
children = (
569+
642783C5203017C7003F9C19 /* libRNSVG.a */,
570+
642783C7203017C7003F9C19 /* libRNSVG-tvOS.a */,
571+
);
572+
name = Products;
573+
sourceTree = "<group>";
574+
};
547575
645B0DE31F9CB28A0048EE84 /* Products */ = {
548576
isa = PBXGroup;
549577
children = (
@@ -574,6 +602,8 @@
574602
0B184764BFFA4E87B6A9D13F /* libRNVectorIcons.a */,
575603
ED8892C01D4F4DED89B804E6 /* libSafariViewManager.a */,
576604
77F0EF773D75407BB9F6E14C /* libRCTWKWebView.a */,
605+
4A567A3A9C7048D786F99BB7 /* libRNSVG.a */,
606+
5A61A9652B944FCD935E1E1D /* libRNSVG-tvOS.a */,
577607
);
578608
name = "Recovered References";
579609
sourceTree = "<group>";
@@ -640,6 +670,7 @@
640670
5DD93C90CEEF4DD6B1A4D5E8 /* RNVectorIcons.xcodeproj */,
641671
991DF60053EC41039FDD6172 /* SafariViewManager.xcodeproj */,
642672
1660996C91354DF69FBAF19C /* RCTWKWebView.xcodeproj */,
673+
FF4B7951E94D4B188D0BB435 /* RNSVG.xcodeproj */,
643674
);
644675
name = Libraries;
645676
sourceTree = "<group>";
@@ -838,6 +869,10 @@
838869
ProductGroup = 146834001AC3E56700842450 /* Products */;
839870
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
840871
},
872+
{
873+
ProductGroup = 642783C0203017C7003F9C19 /* Products */;
874+
ProjectRef = FF4B7951E94D4B188D0BB435 /* RNSVG.xcodeproj */;
875+
},
841876
{
842877
ProductGroup = 64F527BC1F9A3E780098B65F /* Products */;
843878
ProjectRef = 5DD93C90CEEF4DD6B1A4D5E8 /* RNVectorIcons.xcodeproj */;
@@ -1018,6 +1053,20 @@
10181053
remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
10191054
sourceTree = BUILT_PRODUCTS_DIR;
10201055
};
1056+
642783C5203017C7003F9C19 /* libRNSVG.a */ = {
1057+
isa = PBXReferenceProxy;
1058+
fileType = archive.ar;
1059+
path = libRNSVG.a;
1060+
remoteRef = 642783C4203017C7003F9C19 /* PBXContainerItemProxy */;
1061+
sourceTree = BUILT_PRODUCTS_DIR;
1062+
};
1063+
642783C7203017C7003F9C19 /* libRNSVG-tvOS.a */ = {
1064+
isa = PBXReferenceProxy;
1065+
fileType = archive.ar;
1066+
path = "libRNSVG-tvOS.a";
1067+
remoteRef = 642783C6203017C7003F9C19 /* PBXContainerItemProxy */;
1068+
sourceTree = BUILT_PRODUCTS_DIR;
1069+
};
10211070
645B0DE81F9CB28B0048EE84 /* libART.a */ = {
10221071
isa = PBXReferenceProxy;
10231072
fileType = archive.ar;
@@ -1256,13 +1305,16 @@
12561305
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
12571306
"$(SRCROOT)/../node_modules/react-native-safari-view",
12581307
"$(SRCROOT)/../node_modules/react-native-wkwebview-reborn/ios/RCTWKWebView",
1308+
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
12591309
);
12601310
INFOPLIST_FILE = Biu/Info.plist;
12611311
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
12621312
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
12631313
LIBRARY_SEARCH_PATHS = (
12641314
"$(inherited)",
12651315
"\"$(SRCROOT)/Biu\"",
1316+
"\"$(SRCROOT)/Biu\"",
1317+
"\"$(SRCROOT)/Biu\"",
12661318
);
12671319
OTHER_LDFLAGS = (
12681320
"$(inherited)",
@@ -1287,13 +1339,16 @@
12871339
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
12881340
"$(SRCROOT)/../node_modules/react-native-safari-view",
12891341
"$(SRCROOT)/../node_modules/react-native-wkwebview-reborn/ios/RCTWKWebView",
1342+
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
12901343
);
12911344
INFOPLIST_FILE = Biu/Info.plist;
12921345
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
12931346
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
12941347
LIBRARY_SEARCH_PATHS = (
12951348
"$(inherited)",
12961349
"\"$(SRCROOT)/Biu\"",
1350+
"\"$(SRCROOT)/Biu\"",
1351+
"\"$(SRCROOT)/Biu\"",
12971352
);
12981353
OTHER_LDFLAGS = (
12991354
"$(inherited)",
@@ -1325,6 +1380,7 @@
13251380
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
13261381
"$(SRCROOT)/../node_modules/react-native-safari-view",
13271382
"$(SRCROOT)/../node_modules/react-native-wkwebview-reborn/ios/RCTWKWebView",
1383+
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
13281384
);
13291385
INFOPLIST_FILE = "Biu-tvOS/Info.plist";
13301386
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1363,6 +1419,7 @@
13631419
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
13641420
"$(SRCROOT)/../node_modules/react-native-safari-view",
13651421
"$(SRCROOT)/../node_modules/react-native-wkwebview-reborn/ios/RCTWKWebView",
1422+
"$(SRCROOT)/../node_modules/react-native-svg/ios/**",
13661423
);
13671424
INFOPLIST_FILE = "Biu-tvOS/Info.plist";
13681425
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

js/BlockChainScreen.js

+39-18
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,37 @@ import moment from 'moment'
3434
import { styles as themeStyles } from 'react-native-theme';
3535
import bus from './bus'
3636
import store from './store'
37-
37+
import SvgUri from 'react-native-svg-uri';
38+
import SvgData from './svg_data'
3839
var BLOCKCHAIN_ARTICLES = 'https://api.readhub.me/blockchain';
3940

4041
var loadErrorCount = 0;
4142
export default class DevArticlesScreen extends React.Component {
42-
static navigationOptions = ({navigation})=>( {
43+
static navigationOptions = ({ navigation }) => ({
4344
tabBarLabel: '区块链快讯',
44-
tabBarIcon: ({ tintColor }) => (
45-
<Icon name="bold" size={22} style={[styles.icon, { color: tintColor }]}></Icon>
46-
),
45+
tabBarIcon: ({ focused, tintColor }) => {
46+
return (
47+
<View style={{ width: 30, height: 30 }}>
48+
{focused?(
49+
<SvgUri
50+
width="30"
51+
height="30"
52+
svgXmlData={SvgData.blockchain}
53+
54+
/>):(
55+
<SvgUri
56+
width="30"
57+
height="30"
58+
svgXmlData={SvgData.blockchain_gray}
59+
60+
/>
61+
)}
62+
</View>
63+
64+
65+
)
66+
67+
},
4768
});
4869

4970
constructor(props) {
@@ -91,10 +112,10 @@ export default class DevArticlesScreen extends React.Component {
91112

92113

93114
}).catch((error) => {
94-
console.log(error);
95-
this.setState({ refreshing: false })
115+
console.log(error);
116+
this.setState({ refreshing: false })
96117

97-
});
118+
});
98119
}
99120

100121
handleLoadMore() {
@@ -123,12 +144,12 @@ export default class DevArticlesScreen extends React.Component {
123144
loadErrorCount = 0;
124145

125146
}).catch((error) => {
126-
console.log(error);
127-
loadErrorCount++;
147+
console.log(error);
148+
loadErrorCount++;
128149

129-
this.setState({ loading: false })
150+
this.setState({ loading: false })
130151

131-
});
152+
});
132153
}
133154

134155

@@ -143,19 +164,19 @@ export default class DevArticlesScreen extends React.Component {
143164
return (
144165

145166
<TouchableHighlight activeOpacity={.95}
146-
onPress={() => {
147-
console.log("You tapped the button!");
148-
this.onPressItem(item)
149-
}}
167+
onPress={() => {
168+
console.log("You tapped the button!");
169+
this.onPressItem(item)
170+
}}
150171

151172
>
152173
<View style={[styles.listRow, index % 2 == 0 && styles.listRowAlt, themeStyles.listRow, index % 2 == 0 && themeStyles.listRowAlt]}>
153174

154175
<View style={styles.rightContainer}>
155176

156-
<Text ellipsizeMode="tail" numberOfLines={2} style={[styles.title,themeStyles.title]}>{item.title}</Text>
177+
<Text ellipsizeMode="tail" numberOfLines={2} style={[styles.title, themeStyles.title]}>{item.title}</Text>
157178
<View style={{ height: 5 }}></View>
158-
<Text ellipsizeMode="middle" numberOfLines={1} style={[styles.summary, themeStyles.summary]}>{item.siteName}{item.siteName&&item.siteName.length>0&&item.authorName&&item.authorName.length>0?' / ':'' }{item.authorName}{(item.siteName&&item.siteName.length>0)||(item.authorName&&item.authorName.length>0)?' ':''}{moment(item.publishDate).fromNow()}</Text>
179+
<Text ellipsizeMode="middle" numberOfLines={1} style={[styles.summary, themeStyles.summary]}>{item.siteName}{item.siteName && item.siteName.length > 0 && item.authorName && item.authorName.length > 0 ? ' / ' : ''}{item.authorName}{(item.siteName && item.siteName.length > 0) || (item.authorName && item.authorName.length > 0) ? ' ' : ''}{moment(item.publishDate).fromNow()}</Text>
159180

160181
</View>
161182
</View>

js/svg_data.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import blockchain from '../images/blockchain.svg'
2+
import blockchain_gray from '../images/blockchain_gray.svg'
3+
export default {
4+
blockchain,
5+
blockchain_gray,
6+
}

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"react-native-progress": "^3.4.0",
1818
"react-native-safari-view": "^2.1.0",
1919
"react-native-share": "^1.0.23",
20+
"react-native-svg-uri": "^1.2.3",
2021
"react-native-swipeout": "^2.2.2",
2122
"react-native-theme": "^0.1.8",
2223
"react-native-vector-icons": "^4.4.2",
@@ -25,6 +26,7 @@
2526
},
2627
"devDependencies": {
2728
"babel-jest": "21.2.0",
29+
"babel-plugin-inline-import": "^2.0.6",
2830
"babel-preset-react-native": "4.0.0",
2931
"jest": "21.2.1",
3032
"react-test-renderer": "16.0.0-beta.5"

0 commit comments

Comments
 (0)