1. react-native-navigator 更新版本

2. 处理android兼容性
This commit is contained in:
xuwenyang 2019-05-13 23:51:23 +08:00
parent 5930b52474
commit eeeca9f3b5
18 changed files with 300 additions and 206 deletions

View file

@ -77,6 +77,7 @@ project.ext.react = [
] ]
apply from: "../../node_modules/react-native/react.gradle" 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: * Set this to true to create two separate APKs instead of one:
@ -105,6 +106,7 @@ android {
applicationId "com.timepill" applicationId "com.timepill"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57_5"
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
} }
@ -137,10 +139,14 @@ android {
} }
} }
dependencies { dependencies {
implementation project(':react-native-device-info') implementation project(':react-native-device-info')
implementation project(':react-native-vector-icons') implementation project(':react-native-vector-icons')
implementation project(':@react-native-community_async-storage') implementation project(':@react-native-community_async-storage')
implementation project(':react-native-navigation')
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules implementation "com.facebook.react:react-native:+" // From node_modules

View file

@ -2,6 +2,12 @@
package="com.timepill"> package="com.timepill">
<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-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 <application
android:name=".MainApplication" android:name=".MainApplication"

View file

@ -1,15 +1,8 @@
package com.timepill; package com.timepill;
import com.facebook.react.ReactActivity; 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";
}
} }

View file

@ -14,38 +14,44 @@ import com.facebook.soloader.SoLoader;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; 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;
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { public class MainApplication extends NavigationApplication {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override @Override
protected List<ReactPackage> getPackages() { protected ReactGateway createReactGateway() {
return Arrays.<ReactPackage>asList( ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
new MainReactPackage(), @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(
// eg. new VectorIconsPackage()
new RNDeviceInfo(), new RNDeviceInfo(),
new VectorIconsPackage(), new VectorIconsPackage(),
new AsyncStoragePackage() new AsyncStoragePackage()
); );
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
} }
@Override @Override
public void onCreate() { public List<ReactPackage> createAdditionalReactPackages() {
super.onCreate(); return getPackages();
SoLoader.init(this, /* native exopackage */ false);
} }
} }

View file

@ -3,13 +3,15 @@
buildscript { buildscript {
ext { ext {
buildToolsVersion = "28.0.3" buildToolsVersion = "28.0.3"
minSdkVersion = 16 minSdkVersion = 19
compileSdkVersion = 28 compileSdkVersion = 28
targetSdkVersion = 28 targetSdkVersion = 28
supportLibVersion = "28.0.0" supportLibVersion = "28.0.0"
} }
repositories { repositories {
google() google()
mavenLocal()
mavenCentral()
jcenter() jcenter()
} }
dependencies { dependencies {
@ -22,12 +24,14 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
mavenLocal()
google() google()
mavenCentral()
mavenLocal()
jcenter() jcenter()
maven { maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android" url "$rootDir/../node_modules/react-native/android"
} }
maven { url 'https://jitpack.io' }
} }
} }

View file

@ -1,9 +1,13 @@
rootProject.name = 'Timepill' 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' include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':@react-native-community_async-storage' 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') project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')
include ':app' 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')

View file

@ -2,6 +2,7 @@
* @entry * @entry
*/ */
import {Alert} from 'react-native'
import {Navigation} from 'react-native-navigation'; import {Navigation} from 'react-native-navigation';
import {Icon, loadIcon} from './src/style/icon'; import {Icon, loadIcon} from './src/style/icon';
@ -12,29 +13,38 @@ import PageList from './src/page/_list';
import BottomNav from './src/nav/bottomNav'; import BottomNav from './src/nav/bottomNav';
async function init() { Navigation.registerComponent('Timepill', () => App);
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);
// regist screens automatically // regist screens automatically
for (let pageName in PageList) { for (let pageName in PageList) {
Navigation.registerComponent(pageName, () => PageList[pageName]); 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());
}
});

View file

@ -38,7 +38,7 @@
2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; }; 2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; };
2DCD954D1E0B4F2C00145EB5 /* TimepillTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* TimepillTests.m */; }; 2DCD954D1E0B4F2C00145EB5 /* TimepillTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* TimepillTests.m */; };
2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; }; 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 */; }; 444B74B0B45F447FA6D25561 /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A333F2A12D224289B26028D1 /* libRNVectorIcons.a */; };
47AE5EA4A39F43CFA279144B /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B6943EF54DC4C0E8C860C48 /* libRNDeviceInfo.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 */; }; 6CA03C7B6F034CF5B2ECC3E5 /* libRNVectorIcons-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FC4807EA1FA42A4A55BDAE5 /* libRNVectorIcons-tvOS.a */; };
@ -270,13 +270,20 @@
remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4;
remoteInfo = "cxxreact-tvOS"; remoteInfo = "cxxreact-tvOS";
}; };
4117125D2280920E00018FD3 /* PBXContainerItemProxy */ = { 4166A0E322895B4C0086277D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 411712342280920E00018FD3 /* ReactNativeNavigation.xcodeproj */; containerPortal = 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */;
proxyType = 2; proxyType = 2;
remoteGlobalIDString = D8AFADBD1BEE6F3F00A4592D; remoteGlobalIDString = D8AFADBD1BEE6F3F00A4592D;
remoteInfo = ReactNativeNavigation; remoteInfo = ReactNativeNavigation;
}; };
4166A0E522895B4C0086277D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 7B49FEBB1E95090800DEB3EA;
remoteInfo = ReactNativeNavigationTests;
};
41EC7C5622809E1800779391 /* PBXContainerItemProxy */ = { 41EC7C5622809E1800779391 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 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; }; 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; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
4117125F2280921A00018FD3 /* libReactNativeNavigation.a in Frameworks */, 4166A0E722895B5C0086277D /* libReactNativeNavigation.a in Frameworks */,
ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */, ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */,
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */, ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */,
11D1A2F320CAFA9E000508D9 /* libRCTAnimation.a in Frameworks */, 11D1A2F320CAFA9E000508D9 /* libRCTAnimation.a in Frameworks */,
@ -609,10 +616,11 @@
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
411712352280920E00018FD3 /* Products */ = { 4166A0DF22895B4B0086277D /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4117125E2280920E00018FD3 /* libReactNativeNavigation.a */, 4166A0E422895B4C0086277D /* libReactNativeNavigation.a */,
4166A0E622895B4C0086277D /* ReactNativeNavigationTests.xctest */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -675,7 +683,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = { 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
411712342280920E00018FD3 /* ReactNativeNavigation.xcodeproj */, 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */,
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */,
146833FF1AC3E56700842450 /* React.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */,
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
@ -919,8 +927,8 @@
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
}, },
{ {
ProductGroup = 411712352280920E00018FD3 /* Products */; ProductGroup = 4166A0DF22895B4B0086277D /* Products */;
ProjectRef = 411712342280920E00018FD3 /* ReactNativeNavigation.xcodeproj */; ProjectRef = 4166A0DE22895B4B0086277D /* ReactNativeNavigation.xcodeproj */;
}, },
{ {
ProductGroup = 41EC7C5F22809E1800779391 /* Products */; ProductGroup = 41EC7C5F22809E1800779391 /* Products */;
@ -1142,11 +1150,18 @@
remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */; remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR; sourceTree = BUILT_PRODUCTS_DIR;
}; };
4117125E2280920E00018FD3 /* libReactNativeNavigation.a */ = { 4166A0E422895B4C0086277D /* libReactNativeNavigation.a */ = {
isa = PBXReferenceProxy; isa = PBXReferenceProxy;
fileType = archive.ar; fileType = archive.ar;
path = libReactNativeNavigation.a; 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; sourceTree = BUILT_PRODUCTS_DIR;
}; };
41EC7C5722809E1800779391 /* libjsi.a */ = { 41EC7C5722809E1800779391 /* libjsi.a */ = {

View file

@ -8,34 +8,17 @@
#import "AppDelegate.h" #import "AppDelegate.h"
#import <React/RCTBundleURLProvider.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 <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>
@implementation AppDelegate @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ {
NSURL *jsCodeLocation; NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
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];
return YES; return YES;
} }
@end @end

30
package-lock.json generated
View file

@ -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": { "hosted-git-info": {
"version": "2.7.1", "version": "2.7.1",
"resolved": "http://registry.npm.taobao.org/hosted-git-info/download/hosted-git-info-2.7.1.tgz", "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", "resolved": "https://registry.npm.taobao.org/react-is/download/react-is-16.8.6.tgz",
"integrity": "sha1-W7weLSkUHJ+9/tRWND/ivEMKahY=" "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": { "react-native": {
"version": "0.59.5", "version": "0.59.5",
"resolved": "http://registry.npm.taobao.org/react-native/download/react-native-0.59.5.tgz", "resolved": "http://registry.npm.taobao.org/react-native/download/react-native-0.59.5.tgz",
@ -10830,11 +10843,15 @@
"integrity": "sha1-fbylMJMPfBzoYzzI/RO6lBApkuE=" "integrity": "sha1-fbylMJMPfBzoYzzI/RO6lBApkuE="
}, },
"react-native-navigation": { "react-native-navigation": {
"version": "1.1.376", "version": "2.18.5",
"resolved": "https://registry.npm.taobao.org/react-native-navigation/download/react-native-navigation-1.1.376.tgz", "resolved": "https://registry.npm.taobao.org/react-native-navigation/download/react-native-navigation-2.18.5.tgz",
"integrity": "sha1-zJ6QE5Ch9iFmV4F63T4Slq8S73A=", "integrity": "sha1-5OifKqKwO5VpgD4aYaKKZoPDgAo=",
"requires": { "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": { "react-native-root-siblings": {
@ -12272,6 +12289,11 @@
"resolved": "http://registry.npm.taobao.org/trim-right/download/trim-right-1.0.1.tgz", "resolved": "http://registry.npm.taobao.org/trim-right/download/trim-right-1.0.1.tgz",
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" "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": { "tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "http://registry.npm.taobao.org/tunnel-agent/download/tunnel-agent-0.6.0.tgz", "resolved": "http://registry.npm.taobao.org/tunnel-agent/download/tunnel-agent-0.6.0.tgz",

View file

@ -16,7 +16,7 @@
"react-native-device-info": "^1.6.1", "react-native-device-info": "^1.6.1",
"react-native-elements": "^0.19.0", "react-native-elements": "^0.19.0",
"react-native-iphone-x-helper": "^1.0.2", "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-root-toast": "^3.0.0",
"react-native-vector-icons": "^4.5.0" "react-native-vector-icons": "^4.5.0"
}, },

View file

@ -13,7 +13,7 @@ export default class Comment extends Component {
render() { render() {
let comment = this.props.comment; let comment = this.props.comment;
let user = comment.user; let user = comment.user;
let editable = this.props.editable || true; let editable = this.props.editable;
return ( return (
<View> <View>

View file

@ -33,11 +33,7 @@ export default class CommentList extends Component {
} }
async loadMore() { async loadMore() {
console.log('commentList:', this.diaryId);
let comments = await Api.getDiaryComments(this.diaryId); let comments = await Api.getDiaryComments(this.diaryId);
console.log('comments:', comments);
if(comments && comments.length > 0) { if(comments && comments.length > 0) {
if (comments.length > 1) { if (comments.length > 1) {
comments = comments.reverse(); comments = comments.reverse();

View file

@ -38,7 +38,7 @@ export default class LoginForm extends Component {
_checkResult(result) { _checkResult(result) {
InteractionManager.runAfterInteractions(() => { InteractionManager.runAfterInteractions(() => {
if(result.isLoginSucc) { if(result.isLoginSucc) {
Navigation.startTabBasedApp(BottomNav.config()); Navigation.setRoot(BottomNav.config());
} else { } else {
Alert.alert( Alert.alert(

View file

@ -1,110 +1,159 @@
import Color from '../style/color' import Color from '../style/color'
import {Icon} from '../style/icon' import {Icon} from '../style/icon'
const insets = {
top: 6,
left: 0,
bottom: -6,
right: 0
};
function config() { function config() {
return { return {
tabs: [ root: {
{ bottomTabs: {
// label: '首页', options: {
screen: 'Home', bottomTabs: {
icon: Icon.homeIcon, titleDisplayMode: 'alwaysShow' // android
selectedIcon: Icon.homeSelectedIcon, // iOS only }
title: '首页', },
iconInsets: insets, children: [{
navigatorStyle: { stack: {
tabBarHidden: false, children: [{
} component: {
}, name: 'Home',
{ options: {
// label: '关注', topBar: {
screen: 'Follow', title: {
icon: Icon.followIcon, text: '首页'
selectedIcon: Icon.followSelectedIcon, // iOS only }
title: '关注', }
iconInsets: insets, }
navigatorStyle: { }
tabBarHidden: false, }],
} options: {
}, bottomTab: {
{ text: '首页',
// label: '写日记', icon: Icon.homeIcon,
screen: 'Write',
icon: Icon.writeIcon, // ios
selectedIcon: Icon.writeSelectedIcon, // iOS only selectedIcon: Icon.homeSelectedIcon,
title: '写日记',
iconInsets: insets, // android
overrideBackPress: true, iconColor: '#ccc',
navigatorStyle: { selectedIconColor: Color.primary
tabBarHidden: true, }
}, }
passProps: { }
tabOpen: true, },{
} stack: {
}, children: [{
{ component: {
// label: '提醒', name: 'Follow',
screen: 'Notification', options: {
icon: Icon.tipIcon, topBar: {
selectedIcon: Icon.tipSelectedIcon, // iOS only title: {
title: '提醒', text: '关注'
iconInsets: insets, }
navigatorStyle: { }
tabBarHidden: false, }
} }
}, }],
{ options: {
// label: '我的', bottomTab: {
screen: 'User', text: '关注',
icon: Icon.myIcon, icon: Icon.followIcon,
selectedIcon: Icon.mySelectIcon, // iOS only
title: '我的', // ios
iconInsets: insets, selectedIcon: Icon.followSelectedIcon,
navigatorStyle: {
tabBarHidden: false, // android
}, iconColor: '#ccc',
passProps: { selectedIconColor: Color.primary
isMyself: true, }
tabOpen: true, }
} }
},{
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'
} }
} }

View file

@ -41,7 +41,7 @@ const localStyle = StyleSheet.create({
wrap: { wrap: {
flex: 1, flex: 1,
backgroundColor: '#fff', backgroundColor: '#fff',
paddingTop: Api.IS_IPHONEX || Api.IS_ANDROID ? 44 : 20 paddingTop: 20
}, },
header: { header: {
paddingLeft: 20, paddingLeft: 20,

View file

@ -41,7 +41,7 @@ const localStyle = StyleSheet.create({
wrap: { wrap: {
flex: 1, flex: 1,
backgroundColor: '#fff', backgroundColor: '#fff',
paddingTop: Api.IS_IPHONEX || Api.IS_ANDROID ? 44 : 20 paddingTop: 20
}, },
header: { header: {
paddingLeft: 20, paddingLeft: 20,

View file

@ -54,6 +54,7 @@ async function loadIcon() {
Ionicons.getImageSource('ios-contact' + outline, 26), Ionicons.getImageSource('ios-contact' + outline, 26),
Ionicons.getImageSource('ios-contact', 26), Ionicons.getImageSource('ios-contact', 26),
Ionicons.getImageSource('md-checkmark', 28, iconColor), Ionicons.getImageSource('md-checkmark', 28, iconColor),
Ionicons.getImageSource('md-close', 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' ? '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' ? '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]; Icon[name] = localIcons[index];
index++; index++;
} }
} }
export { export {