mirror of
https://github.com/timepill/timepill-app.git
synced 2025-04-30 09:59:31 +08:00
1. react-native-navigator 更新版本
2. 处理android兼容性
This commit is contained in:
parent
5930b52474
commit
eeeca9f3b5
18 changed files with 300 additions and 206 deletions
|
@ -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
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
package="com.timepill">
|
||||
|
||||
<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-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH"/> <!-- for Device Name -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/> <!-- for Phone Number -->
|
||||
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
package com.timepill;
|
||||
|
||||
import com.facebook.react.ReactActivity;
|
||||
import com.reactnativenavigation.NavigationActivity;
|
||||
|
||||
public class MainActivity extends ReactActivity {
|
||||
public class MainActivity extends NavigationActivity {
|
||||
|
||||
/**
|
||||
* Returns the name of the main component registered from JavaScript.
|
||||
* This is used to schedule rendering of the component.
|
||||
*/
|
||||
@Override
|
||||
protected String getMainComponentName() {
|
||||
return "Timepill";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,18 +14,33 @@ import com.facebook.soloader.SoLoader;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MainApplication extends Application implements ReactApplication {
|
||||
import com.reactnativenavigation.NavigationApplication;
|
||||
import com.reactnativenavigation.react.NavigationReactNativeHost;
|
||||
import com.reactnativenavigation.react.ReactGateway;
|
||||
|
||||
public class MainApplication extends NavigationApplication {
|
||||
|
||||
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
||||
@Override
|
||||
public boolean getUseDeveloperSupport() {
|
||||
return BuildConfig.DEBUG;
|
||||
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<ReactPackage> getPackages() {
|
||||
// Add additional packages you require here
|
||||
// No need to add RnnPackage and MainReactPackage
|
||||
return Arrays.<ReactPackage>asList(
|
||||
new MainReactPackage(),
|
||||
// eg. new VectorIconsPackage()
|
||||
new RNDeviceInfo(),
|
||||
new VectorIconsPackage(),
|
||||
new AsyncStoragePackage()
|
||||
|
@ -33,19 +48,10 @@ public class MainApplication extends Application implements ReactApplication {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getJSMainModuleName() {
|
||||
return "index";
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public ReactNativeHost getReactNativeHost() {
|
||||
return mReactNativeHost;
|
||||
public List<ReactPackage> createAdditionalReactPackages() {
|
||||
return getPackages();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
SoLoader.init(this, /* native exopackage */ false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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' }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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')
|
||||
|
|
50
index.js
50
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());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -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 = "<group>"; };
|
||||
411712342280920E00018FD3 /* ReactNativeNavigation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeNavigation.xcodeproj; path = "../node_modules/react-native-navigation/ios/ReactNativeNavigation.xcodeproj"; sourceTree = "<group>"; };
|
||||
4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeNavigation.xcodeproj; path = "../node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj"; sourceTree = "<group>"; };
|
||||
4B6943EF54DC4C0E8C860C48 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = "<group>"; };
|
||||
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 = "<group>"; };
|
||||
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
|
||||
|
@ -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 = "<group>";
|
||||
};
|
||||
411712352280920E00018FD3 /* Products */ = {
|
||||
4166A0DF22895B4B0086277D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4117125E2280920E00018FD3 /* libReactNativeNavigation.a */,
|
||||
4166A0E422895B4C0086277D /* libReactNativeNavigation.a */,
|
||||
4166A0E622895B4C0086277D /* ReactNativeNavigationTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -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 */ = {
|
||||
|
|
|
@ -8,34 +8,17 @@
|
|||
#import "AppDelegate.h"
|
||||
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
// **********************************************
|
||||
// *** 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 <React/RCTRootView.h>
|
||||
#import <ReactNativeNavigation/ReactNativeNavigation.h>
|
||||
|
||||
@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
|
||||
|
||||
|
|
30
package-lock.json
generated
30
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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 (
|
||||
<View>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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',
|
||||
root: {
|
||||
bottomTabs: {
|
||||
options: {
|
||||
bottomTabs: {
|
||||
titleDisplayMode: 'alwaysShow' // android
|
||||
}
|
||||
},
|
||||
children: [{
|
||||
stack: {
|
||||
children: [{
|
||||
component: {
|
||||
name: 'Home',
|
||||
options: {
|
||||
topBar: {
|
||||
title: {
|
||||
text: '首页'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
options: {
|
||||
bottomTab: {
|
||||
text: '首页',
|
||||
icon: Icon.homeIcon,
|
||||
selectedIcon: Icon.homeSelectedIcon, // iOS only
|
||||
title: '首页',
|
||||
iconInsets: insets,
|
||||
navigatorStyle: {
|
||||
tabBarHidden: false,
|
||||
|
||||
// ios
|
||||
selectedIcon: Icon.homeSelectedIcon,
|
||||
|
||||
// android
|
||||
iconColor: '#ccc',
|
||||
selectedIconColor: Color.primary
|
||||
}
|
||||
},
|
||||
{
|
||||
// label: '关注',
|
||||
screen: 'Follow',
|
||||
}
|
||||
}
|
||||
},{
|
||||
stack: {
|
||||
children: [{
|
||||
component: {
|
||||
name: 'Follow',
|
||||
options: {
|
||||
topBar: {
|
||||
title: {
|
||||
text: '关注'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
options: {
|
||||
bottomTab: {
|
||||
text: '关注',
|
||||
icon: Icon.followIcon,
|
||||
selectedIcon: Icon.followSelectedIcon, // iOS only
|
||||
title: '关注',
|
||||
iconInsets: insets,
|
||||
navigatorStyle: {
|
||||
tabBarHidden: false,
|
||||
|
||||
// ios
|
||||
selectedIcon: Icon.followSelectedIcon,
|
||||
|
||||
// android
|
||||
iconColor: '#ccc',
|
||||
selectedIconColor: Color.primary
|
||||
}
|
||||
},
|
||||
{
|
||||
// label: '写日记',
|
||||
screen: 'Write',
|
||||
}
|
||||
}
|
||||
},{
|
||||
stack: {
|
||||
children: [{
|
||||
component: {
|
||||
name: 'Write',
|
||||
options: {
|
||||
topBar: {
|
||||
title: {
|
||||
text: '写日记',
|
||||
alignment: 'center' // android
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
options: {
|
||||
bottomTab: {
|
||||
text: '写日记',
|
||||
icon: Icon.writeIcon,
|
||||
selectedIcon: Icon.writeSelectedIcon, // iOS only
|
||||
title: '写日记',
|
||||
iconInsets: insets,
|
||||
overrideBackPress: true,
|
||||
navigatorStyle: {
|
||||
tabBarHidden: true,
|
||||
},
|
||||
passProps: {
|
||||
tabOpen: true,
|
||||
|
||||
// ios
|
||||
selectedIcon: Icon.writeSelectedIcon,
|
||||
|
||||
// android
|
||||
iconColor: '#ccc',
|
||||
selectedIconColor: Color.primary
|
||||
}
|
||||
},
|
||||
{
|
||||
// label: '提醒',
|
||||
screen: 'Notification',
|
||||
}
|
||||
}
|
||||
},{
|
||||
stack: {
|
||||
children: [{
|
||||
component: {
|
||||
name: 'Notification',
|
||||
options: {
|
||||
topBar: {
|
||||
title: {
|
||||
text: '提醒'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
options: {
|
||||
bottomTab: {
|
||||
text: '提醒',
|
||||
icon: Icon.tipIcon,
|
||||
selectedIcon: Icon.tipSelectedIcon, // iOS only
|
||||
title: '提醒',
|
||||
iconInsets: insets,
|
||||
navigatorStyle: {
|
||||
tabBarHidden: false,
|
||||
|
||||
// ios
|
||||
selectedIcon: Icon.tipSelectedIcon,
|
||||
|
||||
// android
|
||||
iconColor: '#ccc',
|
||||
selectedIconColor: Color.primary
|
||||
}
|
||||
},
|
||||
{
|
||||
// label: '我的',
|
||||
screen: 'User',
|
||||
}
|
||||
}
|
||||
},{
|
||||
stack: {
|
||||
children: [{
|
||||
component: {
|
||||
name: 'User',
|
||||
options: {
|
||||
topBar: {
|
||||
title: {
|
||||
text: '我'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}],
|
||||
options: {
|
||||
bottomTab: {
|
||||
text: '我',
|
||||
icon: Icon.myIcon,
|
||||
selectedIcon: Icon.mySelectIcon, // iOS only
|
||||
title: '我的',
|
||||
iconInsets: insets,
|
||||
navigatorStyle: {
|
||||
tabBarHidden: false,
|
||||
},
|
||||
passProps: {
|
||||
isMyself: true,
|
||||
tabOpen: true,
|
||||
|
||||
// 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'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue