diff --git a/android/app/build.gradle b/android/app/build.gradle index c234ba9..c116a1b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -77,6 +77,7 @@ project.ext.react = [ ] apply from: "../../node_modules/react-native/react.gradle" +apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" /** * Set this to true to create two separate APKs instead of one: @@ -105,6 +106,7 @@ android { applicationId "com.timepill" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion + missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57_5" versionCode 1 versionName "1.0" } @@ -137,10 +139,14 @@ android { } } + dependencies { + implementation project(':react-native-device-info') implementation project(':react-native-vector-icons') implementation project(':@react-native-community_async-storage') + implementation project(':react-native-navigation') + implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.facebook.react:react-native:+" // From node_modules diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 058b2d9..3e0612b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -2,6 +2,12 @@ package="com.timepill"> + + + + + + getPackages() { - return Arrays.asList( - new MainReactPackage(), + @Override + protected ReactGateway createReactGateway() { + ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) { + @Override + protected String getJSMainModuleName() { + return "index"; + } + }; + return new ReactGateway(this, isDebug(), host); + } + + @Override + public boolean isDebug() { + return BuildConfig.DEBUG; + } + + protected List getPackages() { + // Add additional packages you require here + // No need to add RnnPackage and MainReactPackage + return Arrays.asList( + // eg. new VectorIconsPackage() new RNDeviceInfo(), new VectorIconsPackage(), new AsyncStoragePackage() - ); - } - - @Override - protected String getJSMainModuleName() { - return "index"; - } - }; - - @Override - public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; + ); } @Override - public void onCreate() { - super.onCreate(); - SoLoader.init(this, /* native exopackage */ false); + public List createAdditionalReactPackages() { + return getPackages(); } + + + } diff --git a/android/build.gradle b/android/build.gradle index c6e7c7c..568ac1d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -3,13 +3,15 @@ buildscript { ext { buildToolsVersion = "28.0.3" - minSdkVersion = 16 + minSdkVersion = 19 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = "28.0.0" } repositories { google() + mavenLocal() + mavenCentral() jcenter() } dependencies { @@ -22,12 +24,14 @@ buildscript { allprojects { repositories { - mavenLocal() google() + mavenCentral() + mavenLocal() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } + maven { url 'https://jitpack.io' } } } diff --git a/android/settings.gradle b/android/settings.gradle index 5fa9d81..6656bfc 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,9 +1,13 @@ rootProject.name = 'Timepill' -include ':react-native-device-info' -project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':@react-native-community_async-storage' project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android') include ':app' + +include ':react-native-navigation' +project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/') + +include ':react-native-device-info' +project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android') diff --git a/index.js b/index.js index ed157a5..1b42474 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ * @entry */ +import {Alert} from 'react-native' import {Navigation} from 'react-native-navigation'; import {Icon, loadIcon} from './src/style/icon'; @@ -12,29 +13,38 @@ import PageList from './src/page/_list'; import BottomNav from './src/nav/bottomNav'; -async function init() { - await loadIcon(); - - let token = await Token.getUserToken(); - // let token; - if (!token) { - Navigation.startSingleScreenApp({ - screen: { - screen: 'App' - } - }); - - } else { - Navigation.startTabBasedApp(BottomNav.config()); - } -} - - -Navigation.registerComponent('App', () => App); +Navigation.registerComponent('Timepill', () => App); // regist screens automatically for (let pageName in PageList) { Navigation.registerComponent(pageName, () => PageList[pageName]); } -init(); +Navigation.events().registerAppLaunchedListener(async () => { + + try { + await loadIcon(); + } catch (err) { + Alert.alert("loadIcon err: " + err.toString()); + } + + let token = await Token.getUserToken(); + // let token; + if (!token) { + Navigation.setRoot({ + root: { + stack: { + children: [{ + component: { + name: 'Timepill' + } + }] + } + } + }); + + } else { + Navigation.setRoot(BottomNav.config()); + } + +}); diff --git a/ios/Timepill.xcodeproj/project.pbxproj b/ios/Timepill.xcodeproj/project.pbxproj index 34cb53f..ec476f8 100644 --- a/ios/Timepill.xcodeproj/project.pbxproj +++ b/ios/Timepill.xcodeproj/project.pbxproj @@ -38,7 +38,7 @@ 2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; }; 2DCD954D1E0B4F2C00145EB5 /* TimepillTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* TimepillTests.m */; }; 2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; }; - 4117125F2280921A00018FD3 /* libReactNativeNavigation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4117125E2280920E00018FD3 /* libReactNativeNavigation.a */; }; + 4166A0E722895B5C0086277D /* libReactNativeNavigation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4166A0E422895B4C0086277D /* libReactNativeNavigation.a */; }; 444B74B0B45F447FA6D25561 /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A333F2A12D224289B26028D1 /* libRNVectorIcons.a */; }; 47AE5EA4A39F43CFA279144B /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B6943EF54DC4C0E8C860C48 /* libRNDeviceInfo.a */; }; 6CA03C7B6F034CF5B2ECC3E5 /* libRNVectorIcons-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FC4807EA1FA42A4A55BDAE5 /* libRNVectorIcons-tvOS.a */; }; @@ -270,13 +270,20 @@ remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; remoteInfo = "cxxreact-tvOS"; }; - 4117125D2280920E00018FD3 /* PBXContainerItemProxy */ = { + 4166A0E322895B4C0086277D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 411712342280920E00018FD3 /* ReactNativeNavigation.xcodeproj */; + containerPortal = 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */; proxyType = 2; remoteGlobalIDString = D8AFADBD1BEE6F3F00A4592D; remoteInfo = ReactNativeNavigation; }; + 4166A0E522895B4C0086277D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 7B49FEBB1E95090800DEB3EA; + remoteInfo = ReactNativeNavigationTests; + }; 41EC7C5622809E1800779391 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; @@ -399,7 +406,7 @@ 2D02E4901E0B4A5D006451C7 /* Timepill-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Timepill-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; 39A6CC5AA01844FCA6BAD7CE /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = ""; }; - 411712342280920E00018FD3 /* ReactNativeNavigation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeNavigation.xcodeproj; path = "../node_modules/react-native-navigation/ios/ReactNativeNavigation.xcodeproj"; sourceTree = ""; }; + 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeNavigation.xcodeproj; path = "../node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj"; sourceTree = ""; }; 4B6943EF54DC4C0E8C860C48 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = ""; }; 4DC49BDD3EFD4FA997BEEF58 /* 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 = ""; }; 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; @@ -434,7 +441,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4117125F2280921A00018FD3 /* libReactNativeNavigation.a in Frameworks */, + 4166A0E722895B5C0086277D /* libReactNativeNavigation.a in Frameworks */, ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */, ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */, 11D1A2F320CAFA9E000508D9 /* libRCTAnimation.a in Frameworks */, @@ -609,10 +616,11 @@ name = Frameworks; sourceTree = ""; }; - 411712352280920E00018FD3 /* Products */ = { + 4166A0DF22895B4B0086277D /* Products */ = { isa = PBXGroup; children = ( - 4117125E2280920E00018FD3 /* libReactNativeNavigation.a */, + 4166A0E422895B4C0086277D /* libReactNativeNavigation.a */, + 4166A0E622895B4C0086277D /* ReactNativeNavigationTests.xctest */, ); name = Products; sourceTree = ""; @@ -675,7 +683,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( - 411712342280920E00018FD3 /* ReactNativeNavigation.xcodeproj */, + 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */, 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, @@ -919,8 +927,8 @@ ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; }, { - ProductGroup = 411712352280920E00018FD3 /* Products */; - ProjectRef = 411712342280920E00018FD3 /* ReactNativeNavigation.xcodeproj */; + ProductGroup = 4166A0DF22895B4B0086277D /* Products */; + ProjectRef = 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */; }, { ProductGroup = 41EC7C5F22809E1800779391 /* Products */; @@ -1142,11 +1150,18 @@ remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 4117125E2280920E00018FD3 /* libReactNativeNavigation.a */ = { + 4166A0E422895B4C0086277D /* libReactNativeNavigation.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libReactNativeNavigation.a; - remoteRef = 4117125D2280920E00018FD3 /* PBXContainerItemProxy */; + remoteRef = 4166A0E322895B4C0086277D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4166A0E622895B4C0086277D /* ReactNativeNavigationTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ReactNativeNavigationTests.xctest; + remoteRef = 4166A0E522895B4C0086277D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; 41EC7C5722809E1800779391 /* libjsi.a */ = { diff --git a/ios/Timepill/AppDelegate.m b/ios/Timepill/AppDelegate.m index 0b0d9c3..3c58aad 100644 --- a/ios/Timepill/AppDelegate.m +++ b/ios/Timepill/AppDelegate.m @@ -8,34 +8,17 @@ #import "AppDelegate.h" #import -// ********************************************** -// *** DON'T MISS: THE NEXT LINE IS IMPORTANT *** -// ********************************************** -#import "RCCManager.h" - -// IMPORTANT: if you're getting an Xcode error that RCCManager.h isn't found, you've probably ran "npm install" -// with npm ver 2. You'll need to "npm install" with npm 3 (see https://github.com/wix/react-native-navigation/issues/1) - #import +#import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - NSURL *jsCodeLocation; - - jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; - - // ********************************************** - // *** DON'T MISS: THIS IS HOW WE BOOTSTRAP ***** - // ********************************************** - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - self.window.backgroundColor = [UIColor whiteColor]; - [[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation launchOptions:launchOptions]; - + NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; + [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions]; return YES; } @end - diff --git a/package-lock.json b/package-lock.json index 6d80611..4df971a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5688,6 +5688,14 @@ } } }, + "hoist-non-react-statics": { + "version": "3.3.0", + "resolved": "http://registry.npm.taobao.org/hoist-non-react-statics/download/hoist-non-react-statics-3.3.0.tgz", + "integrity": "sha1-sJF48BIhhPuVrPUl2q7LTY9FlYs=", + "requires": { + "react-is": "^16.7.0" + } + }, "hosted-git-info": { "version": "2.7.1", "resolved": "http://registry.npm.taobao.org/hosted-git-info/download/hosted-git-info-2.7.1.tgz", @@ -10746,6 +10754,11 @@ "resolved": "https://registry.npm.taobao.org/react-is/download/react-is-16.8.6.tgz", "integrity": "sha1-W7weLSkUHJ+9/tRWND/ivEMKahY=" }, + "react-lifecycles-compat": { + "version": "2.0.0", + "resolved": "http://registry.npm.taobao.org/react-lifecycles-compat/download/react-lifecycles-compat-2.0.0.tgz", + "integrity": "sha1-cdnEzeRxFMQQJFT3baBVwrxIyUg=" + }, "react-native": { "version": "0.59.5", "resolved": "http://registry.npm.taobao.org/react-native/download/react-native-0.59.5.tgz", @@ -10830,11 +10843,15 @@ "integrity": "sha1-fbylMJMPfBzoYzzI/RO6lBApkuE=" }, "react-native-navigation": { - "version": "1.1.376", - "resolved": "https://registry.npm.taobao.org/react-native-navigation/download/react-native-navigation-1.1.376.tgz", - "integrity": "sha1-zJ6QE5Ch9iFmV4F63T4Slq8S73A=", + "version": "2.18.5", + "resolved": "https://registry.npm.taobao.org/react-native-navigation/download/react-native-navigation-2.18.5.tgz", + "integrity": "sha1-5OifKqKwO5VpgD4aYaKKZoPDgAo=", "requires": { - "lodash": "4.x.x" + "hoist-non-react-statics": "3.x.x", + "lodash": "4.17.x", + "prop-types": "15.x.x", + "react-lifecycles-compat": "2.0.0", + "tslib": "1.9.3" } }, "react-native-root-siblings": { @@ -12272,6 +12289,11 @@ "resolved": "http://registry.npm.taobao.org/trim-right/download/trim-right-1.0.1.tgz", "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" }, + "tslib": { + "version": "1.9.3", + "resolved": "http://registry.npm.taobao.org/tslib/download/tslib-1.9.3.tgz", + "integrity": "sha1-1+TdeSRdhUKMTX5IIqeZF5VMooY=" + }, "tunnel-agent": { "version": "0.6.0", "resolved": "http://registry.npm.taobao.org/tunnel-agent/download/tunnel-agent-0.6.0.tgz", diff --git a/package.json b/package.json index 0926f2a..72a4406 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "react-native-device-info": "^1.6.1", "react-native-elements": "^0.19.0", "react-native-iphone-x-helper": "^1.0.2", - "react-native-navigation": "^1.1.376", + "react-native-navigation": "^2.18.5", "react-native-root-toast": "^3.0.0", "react-native-vector-icons": "^4.5.0" }, diff --git a/src/component/comment/comment.js b/src/component/comment/comment.js index 0bd56c6..2312f7a 100644 --- a/src/component/comment/comment.js +++ b/src/component/comment/comment.js @@ -13,7 +13,7 @@ export default class Comment extends Component { render() { let comment = this.props.comment; let user = comment.user; - let editable = this.props.editable || true; + let editable = this.props.editable; return ( diff --git a/src/component/comment/commentList.js b/src/component/comment/commentList.js index d2fa810..7891b7f 100644 --- a/src/component/comment/commentList.js +++ b/src/component/comment/commentList.js @@ -33,11 +33,7 @@ export default class CommentList extends Component { } async loadMore() { - console.log('commentList:', this.diaryId); - let comments = await Api.getDiaryComments(this.diaryId); - console.log('comments:', comments); - if(comments && comments.length > 0) { if (comments.length > 1) { comments = comments.reverse(); diff --git a/src/component/loginForm.js b/src/component/loginForm.js index e2399dd..ada9012 100644 --- a/src/component/loginForm.js +++ b/src/component/loginForm.js @@ -38,7 +38,7 @@ export default class LoginForm extends Component { _checkResult(result) { InteractionManager.runAfterInteractions(() => { if(result.isLoginSucc) { - Navigation.startTabBasedApp(BottomNav.config()); + Navigation.setRoot(BottomNav.config()); } else { Alert.alert( diff --git a/src/nav/bottomNav.js b/src/nav/bottomNav.js index b5d75bc..debeaa6 100644 --- a/src/nav/bottomNav.js +++ b/src/nav/bottomNav.js @@ -1,110 +1,159 @@ import Color from '../style/color' import {Icon} from '../style/icon' -const insets = { - top: 6, - left: 0, - bottom: -6, - right: 0 -}; - function config() { return { - tabs: [ - { - // label: '首页', - screen: 'Home', - icon: Icon.homeIcon, - selectedIcon: Icon.homeSelectedIcon, // iOS only - title: '首页', - iconInsets: insets, - navigatorStyle: { - tabBarHidden: false, - } - }, - { - // label: '关注', - screen: 'Follow', - icon: Icon.followIcon, - selectedIcon: Icon.followSelectedIcon, // iOS only - title: '关注', - iconInsets: insets, - navigatorStyle: { - tabBarHidden: false, - } - }, - { - // label: '写日记', - screen: 'Write', - icon: Icon.writeIcon, - selectedIcon: Icon.writeSelectedIcon, // iOS only - title: '写日记', - iconInsets: insets, - overrideBackPress: true, - navigatorStyle: { - tabBarHidden: true, - }, - passProps: { - tabOpen: true, - } - }, - { - // label: '提醒', - screen: 'Notification', - icon: Icon.tipIcon, - selectedIcon: Icon.tipSelectedIcon, // iOS only - title: '提醒', - iconInsets: insets, - navigatorStyle: { - tabBarHidden: false, - } - }, - { - // label: '我的', - screen: 'User', - icon: Icon.myIcon, - selectedIcon: Icon.mySelectIcon, // iOS only - title: '我的', - iconInsets: insets, - navigatorStyle: { - tabBarHidden: false, - }, - passProps: { - isMyself: true, - tabOpen: true, - } + root: { + bottomTabs: { + options: { + bottomTabs: { + titleDisplayMode: 'alwaysShow' // android + } + }, + children: [{ + stack: { + children: [{ + component: { + name: 'Home', + options: { + topBar: { + title: { + text: '首页' + } + } + } + } + }], + options: { + bottomTab: { + text: '首页', + icon: Icon.homeIcon, + + // ios + selectedIcon: Icon.homeSelectedIcon, + + // android + iconColor: '#ccc', + selectedIconColor: Color.primary + } + } + } + },{ + stack: { + children: [{ + component: { + name: 'Follow', + options: { + topBar: { + title: { + text: '关注' + } + } + } + } + }], + options: { + bottomTab: { + text: '关注', + icon: Icon.followIcon, + + // ios + selectedIcon: Icon.followSelectedIcon, + + // android + iconColor: '#ccc', + selectedIconColor: Color.primary + } + } + } + },{ + stack: { + children: [{ + component: { + name: 'Write', + options: { + topBar: { + title: { + text: '写日记', + alignment: 'center' // android + } + } + } + } + }], + options: { + bottomTab: { + text: '写日记', + icon: Icon.writeIcon, + + // ios + selectedIcon: Icon.writeSelectedIcon, + + // android + iconColor: '#ccc', + selectedIconColor: Color.primary + } + } + } + },{ + stack: { + children: [{ + component: { + name: 'Notification', + options: { + topBar: { + title: { + text: '提醒' + } + } + } + } + }], + options: { + bottomTab: { + text: '提醒', + icon: Icon.tipIcon, + + // ios + selectedIcon: Icon.tipSelectedIcon, + + // android + iconColor: '#ccc', + selectedIconColor: Color.primary + } + } + } + },{ + stack: { + children: [{ + component: { + name: 'User', + options: { + topBar: { + title: { + text: '我' + } + } + } + } + }], + options: { + bottomTab: { + text: '我', + icon: Icon.myIcon, + + // ios + selectedIcon: Icon.mySelectIcon, + + // android + iconColor: '#ccc', + selectedIconColor: Color.primary + } + } + } + }] } - ], - tabsStyle: { - tabBarHidden: true, - tabBarSelectedButtonColor: Color.primary, - - navBarTranslucent: false, - statusBarTextColorScheme: 'dark', - drawUnderNavBar: true, - - initialTabIndex: 0, - }, - appStyle: { - tabBarHidden: true, - tabBarBackgroundColor: Color.navBackground, - tabBarButtonColor: '#999', - tabBarSelectedButtonColor: Color.primary, - - navBarTranslucent: false, - navBarBackgroundColor: Color.navBackground, - navigationBarColor: Color.navBackground, - - statusBarTextColorScheme: 'dark', - statusBarColor: Color.navBackground, - - keepStyleAcrossPush: false, - topBarBorderColor: '#ddd', - drawUnderStatusBar: false, - orientation: 'portrait', - initialTabIndex: 0, - }, - animationType: 'fade' + } } } diff --git a/src/page/FollowPage.js b/src/page/FollowPage.js index 57b8618..d935480 100644 --- a/src/page/FollowPage.js +++ b/src/page/FollowPage.js @@ -41,7 +41,7 @@ const localStyle = StyleSheet.create({ wrap: { flex: 1, backgroundColor: '#fff', - paddingTop: Api.IS_IPHONEX || Api.IS_ANDROID ? 44 : 20 + paddingTop: 20 }, header: { paddingLeft: 20, diff --git a/src/page/HomePage.js b/src/page/HomePage.js index b49215e..cfa93e1 100644 --- a/src/page/HomePage.js +++ b/src/page/HomePage.js @@ -41,7 +41,7 @@ const localStyle = StyleSheet.create({ wrap: { flex: 1, backgroundColor: '#fff', - paddingTop: Api.IS_IPHONEX || Api.IS_ANDROID ? 44 : 20 + paddingTop: 20 }, header: { paddingLeft: 20, diff --git a/src/style/icon.js b/src/style/icon.js index bcce809..26d95f0 100644 --- a/src/style/icon.js +++ b/src/style/icon.js @@ -54,6 +54,7 @@ async function loadIcon() { Ionicons.getImageSource('ios-contact' + outline, 26), Ionicons.getImageSource('ios-contact', 26), + Ionicons.getImageSource('md-checkmark', 28, iconColor), Ionicons.getImageSource('md-close', 28, iconColor), @@ -67,7 +68,7 @@ async function loadIcon() { Ionicons.getImageSource(Platform.OS === 'ios' ? 'md-arrow-back' : 'md-arrow-back', 26, iconColor), Ionicons.getImageSource(Platform.OS === 'ios' ? 'ios-open-outline' : 'md-open', 26, iconColor), - Ionicons.getImageSource(Platform.OS === 'ios' ? 'md-time' : 'md-time', 26, iconColor), + Ionicons.getImageSource(Platform.OS === 'ios' ? 'md-time' : 'md-time', 26, iconColor) ]); @@ -76,7 +77,6 @@ async function loadIcon() { Icon[name] = localIcons[index]; index++; } - } export {