Fix Android + Use react-native-splash-screen

This commit is contained in:
Bruno Lemos
2018-01-27 19:27:20 -02:00
parent cb3a5becfe
commit a96d0826b7
16 changed files with 331 additions and 98 deletions

View File

@@ -94,13 +94,13 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.devhub"
minSdkVersion 16
targetSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
ndk {
@@ -116,6 +116,8 @@ android {
}
}
buildTypes {
debug {
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
@@ -137,12 +139,14 @@ android {
}
dependencies {
compile project(':react-native-linear-gradient')
compile project(':react-native-splash-screen')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.android.support:appcompat-v7:27.0.2"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-gesture-handler')
compile project(':react-native-navigation')
compile project(':react-native-gesture-handler')
compile project(':react-native-linear-gradient')
compile project(':react-native-vector-icons')
}

View File

@@ -1,29 +1,25 @@
package com.devhub;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.reactnativenavigation.NavigationActivity;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import android.os.Bundle;
public class MainActivity extends NavigationActivity {
import com.reactnativenavigation.controllers.SplashActivity;
//import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import org.devio.rn.splashscreen.SplashScreen;
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
public class MainActivity extends SplashActivity {
@Override
protected String getMainComponentName() {
return "devhub";
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, true);
super.onCreate(savedInstanceState);
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
// @Override
// protected ReactActivityDelegate createReactActivityDelegate() {
// return new ReactActivityDelegate(this, getMainComponentName()) {
// @Override
// protected ReactRootView createRootView() {
// return new RNGestureHandlerEnabledRootView(MainActivity.this);
// }
// };
// }
}

View File

@@ -1,29 +1,38 @@
package com.devhub;
import android.app.Application;
import com.facebook.react.ReactNativeHost;
import com.BV.LinearGradient.LinearGradientPackage;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import com.oblador.vectoricons.VectorIconsPackage;
import com.reactnativenavigation.NavigationApplication;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements NavigationApplication {
@Override
public boolean isDebug() {
return BuildConfig.DEBUG;
}
public class MainApplication extends NavigationApplication {
@Override
public boolean isDebug() {
// Make sure you are using BuildConfig from your own application
return BuildConfig.DEBUG;
}
@Nullable
@Override
protected List<ReactPackage> createAdditionalReactPackages() {
return Arrays.<ReactPackage>asList(
new RNGestureHandlerPackage(),
new VectorIconsPackage()
);
}
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new LinearGradientPackage(),
new RNGestureHandlerPackage(),
new SplashScreenReactPackage(),
new VectorIconsPackage()
);
}
@Override
public List<ReactPackage> createAdditionalReactPackages() {
return getPackages();
}
@Override
public String getJSMainModuleName() {
return "index";
}
}

View File

@@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -20,5 +21,18 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
}
}
}
}

View File

@@ -1,5 +1,6 @@
#Sat Jan 27 15:31:12 BRST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

View File

@@ -1,10 +1,12 @@
rootProject.name = 'devhub'
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-navigation'
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')

View File

@@ -5,6 +5,7 @@
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@@ -37,6 +38,7 @@
2EAFF5FE1FE1AEEE000A9A11 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 486C758B88E34A52BFB2C474 /* MaterialIcons.ttf */; };
2EC8FACB1FE34E5600FE7FB4 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5FDB82E9A6994D928FA8EF88 /* Ionicons.ttf */; };
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
7854DB4E959F4014B5719A6F /* libSplashScreen.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0441F9718DDD44B287FA1B68 /* libSplashScreen.a */; };
7FC9F95B44E64398A3976B78 /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8888F60F6C304A58BF18E9E8 /* libRNVectorIcons.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
@@ -131,6 +133,27 @@
remoteGlobalIDString = 64AA15081EF7F30100718508;
remoteInfo = "BVLinearGradient-tvOS";
};
2E6F68D0201CEB41005C02A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EBF21BDC1FC498900052F4D5;
remoteInfo = jsinspector;
};
2E6F68D2201CEB41005C02A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5;
remoteInfo = "jsinspector-tvOS";
};
2E6F6938201D16D9005C02A8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 40B4448D993A4CA2ABDDA557 /* SplashScreen.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D7682761D8E76B80014119E;
remoteInfo = SplashScreen;
};
2E9757CD1FE54A870087D2A7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = D1C1CBC9A5564D089F2E18B2 /* ReactNativeNavigation.xcodeproj */;
@@ -360,6 +383,7 @@
00E356EE1AD99517003FC87E /* devhubTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = devhubTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* devhubTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = devhubTests.m; sourceTree = "<group>"; };
0441F9718DDD44B287FA1B68 /* libSplashScreen.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libSplashScreen.a; sourceTree = "<group>"; };
12697B233D884F2EB9A7D7F0 /* BVLinearGradient.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = BVLinearGradient.xcodeproj; path = "../node_modules/react-native-linear-gradient/BVLinearGradient.xcodeproj"; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
@@ -375,6 +399,7 @@
1FD65CD116F747ACA2D47E1F /* RNGestureHandler.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNGestureHandler.xcodeproj; path = "../node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj"; sourceTree = "<group>"; };
2D02E47B1E0B4A5D006451C7 /* devhub-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "devhub-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* devhub-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "devhub-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
40B4448D993A4CA2ABDDA557 /* SplashScreen.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = SplashScreen.xcodeproj; path = "../node_modules/react-native-splash-screen/ios/SplashScreen.xcodeproj"; sourceTree = "<group>"; };
486C758B88E34A52BFB2C474 /* 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>"; };
55B8B3E654F0420CA0ED33D3 /* libSafariViewManager.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libSafariViewManager.a; 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>"; };
@@ -430,6 +455,7 @@
B71E99D6DCBF4278835E3D03 /* libReactNativeNavigation.a in Frameworks */,
DC69E7EC47C64276A45E93CF /* libSafariViewManager.a in Frameworks */,
072BCFEF97034DD8A762C885 /* libBVLinearGradient.a in Frameworks */,
7854DB4E959F4014B5719A6F /* libSplashScreen.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -562,6 +588,8 @@
3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
2E6F68D1201CEB41005C02A8 /* libjsinspector.a */,
2E6F68D3201CEB41005C02A8 /* libjsinspector-tvOS.a */,
2EAFF54C1FE0AC4F000A9A11 /* libthird-party.a */,
2EAFF54E1FE0AC4F000A9A11 /* libthird-party.a */,
2EAFF5501FE0AC4F000A9A11 /* libdouble-conversion.a */,
@@ -581,6 +609,14 @@
name = Products;
sourceTree = "<group>";
};
2E6F6935201D16D9005C02A8 /* Products */ = {
isa = PBXGroup;
children = (
2E6F6939201D16D9005C02A8 /* libSplashScreen.a */,
);
name = Products;
sourceTree = "<group>";
};
2E9757CA1FE54A870087D2A7 /* Products */ = {
isa = PBXGroup;
children = (
@@ -605,6 +641,7 @@
D8C408A943574FCE997797CD /* libReactNativeNavigation.a */,
55B8B3E654F0420CA0ED33D3 /* libSafariViewManager.a */,
D59EE38FE98B402B99250666 /* libBVLinearGradient.a */,
0441F9718DDD44B287FA1B68 /* libSplashScreen.a */,
);
name = "Recovered References";
sourceTree = "<group>";
@@ -663,6 +700,7 @@
D1C1CBC9A5564D089F2E18B2 /* ReactNativeNavigation.xcodeproj */,
C1F790D96FC04CEBA08381F0 /* SafariViewManager.xcodeproj */,
12697B233D884F2EB9A7D7F0 /* BVLinearGradient.xcodeproj */,
40B4448D993A4CA2ABDDA557 /* SplashScreen.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
@@ -911,6 +949,10 @@
ProductGroup = 2E9758451FE6D1E40087D2A7 /* Products */;
ProjectRef = C1F790D96FC04CEBA08381F0 /* SafariViewManager.xcodeproj */;
},
{
ProductGroup = 2E6F6935201D16D9005C02A8 /* Products */;
ProjectRef = 40B4448D993A4CA2ABDDA557 /* SplashScreen.xcodeproj */;
},
);
projectRoot = "";
targets = (
@@ -993,6 +1035,27 @@
remoteRef = 2E60B5092001851A0076D5AF /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2E6F68D1201CEB41005C02A8 /* libjsinspector.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libjsinspector.a;
remoteRef = 2E6F68D0201CEB41005C02A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2E6F68D3201CEB41005C02A8 /* libjsinspector-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libjsinspector-tvOS.a";
remoteRef = 2E6F68D2201CEB41005C02A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2E6F6939201D16D9005C02A8 /* libSplashScreen.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libSplashScreen.a;
remoteRef = 2E6F6938201D16D9005C02A8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2E9757CE1FE54A870087D2A7 /* libReactNativeNavigation.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@@ -1358,6 +1421,7 @@
"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
"$(SRCROOT)/../node_modules/react-native-safari-view",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
);
INFOPLIST_FILE = devhubTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@@ -1365,8 +1429,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@@ -1389,6 +1451,7 @@
"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
"$(SRCROOT)/../node_modules/react-native-safari-view",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
);
INFOPLIST_FILE = devhubTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@@ -1396,8 +1459,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@@ -1422,6 +1483,7 @@
"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
"$(SRCROOT)/../node_modules/react-native-safari-view",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
);
INFOPLIST_FILE = devhub/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1431,6 +1493,7 @@
"-lc++",
);
PRODUCT_NAME = devhub;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
@@ -1448,6 +1511,7 @@
"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
"$(SRCROOT)/../node_modules/react-native-safari-view",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
);
INFOPLIST_FILE = devhub/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1457,6 +1521,7 @@
"-lc++",
);
PRODUCT_NAME = devhub;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
@@ -1480,14 +1545,13 @@
"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
"$(SRCROOT)/../node_modules/react-native-safari-view",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
);
INFOPLIST_FILE = "devhub-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@@ -1520,14 +1584,13 @@
"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
"$(SRCROOT)/../node_modules/react-native-safari-view",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
);
INFOPLIST_FILE = "devhub-tvOS/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@@ -1557,8 +1620,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.devhub-tvOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1584,8 +1645,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.devhub-tvOSTests";
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -14,6 +14,8 @@
#import "RCCManager.h"
#import "SplashScreen.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -25,6 +27,8 @@
self.window.backgroundColor = [UIColor whiteColor];
[[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation launchOptions:launchOptions];
[SplashScreen show];
return YES;
}

View File

@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>devhub</string>
<string>DevHub</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@@ -36,7 +36,7 @@
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<string></string>
<key>UIAppFonts</key>
<array>
<string>Ionicons.ttf</string>

View File

@@ -19,8 +19,9 @@
"react-native": "0.52.0",
"react-native-gesture-handler": "^1.0.0-alpha.40",
"react-native-linear-gradient": "^2.4.0",
"react-native-navigation": "^1.1.349",
"react-native-navigation": "^1.1.354",
"react-native-safari-view": "^2.1.0",
"react-native-splash-screen": "^3.0.6",
"react-native-vector-icons": "^4.4.3",
"warna": "^0.2.4"
},

View File

@@ -0,0 +1,120 @@
patch-package
--- a/node_modules/react-native-navigation/android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java
+++ b/node_modules/react-native-navigation/android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java
@@ -39,6 +39,7 @@ import com.reactnativenavigation.react.ReactGateway;
import com.reactnativenavigation.screens.NavigationType;
import com.reactnativenavigation.screens.Screen;
import com.reactnativenavigation.utils.OrientationHelper;
+import com.reactnativenavigation.utils.ReflectionUtils;
import com.reactnativenavigation.views.SideMenu.Side;
import java.util.List;
@@ -455,6 +456,11 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
public void run() {
layout.destroy();
modalController.destroy();
+
+ Object devSupportManager = ReflectionUtils.getDeclaredField(getReactGateway().getReactInstanceManager(), "mDevSupportManager");
+ if (ReflectionUtils.getDeclaredField(devSupportManager, "mRedBoxDialog") != null) {
+ ReflectionUtils.setField(devSupportManager, "mRedBoxDialog", null);
+ }
}
});
}
--- a/node_modules/react-native-navigation/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadListenerReplacer.java
+++ b/node_modules/react-native-navigation/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadListenerReplacer.java
@@ -1,10 +1,12 @@
package com.reactnativenavigation.react;
import com.facebook.react.ReactInstanceManager;
-import com.facebook.react.bridge.JavaJSExecutor;
-import com.facebook.react.devsupport.ReactInstanceDevCommandsHandler;
import com.reactnativenavigation.utils.ReflectionUtils;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
class JsDevReloadListenerReplacer {
private final ReactInstanceManager reactInstanceManager;
private final Listener listener;
@@ -19,49 +21,50 @@ class JsDevReloadListenerReplacer {
}
void replace() {
- ReactInstanceDevCommandsHandler originalHandler = getOriginalHandler();
- DevCommandsHandlerProxy proxy = new DevCommandsHandlerProxy(originalHandler, listener);
- replaceInReactInstanceManager(proxy);
- replaceInDevSupportManager(proxy);
- }
+ Object originalHandler = getOriginalHandler();
- private void replaceInDevSupportManager(DevCommandsHandlerProxy proxy) {
Object devSupportManager = ReflectionUtils.getDeclaredField(reactInstanceManager, "mDevSupportManager");
- ReflectionUtils.setField(devSupportManager, "mReactInstanceCommandsHandler", proxy);
- }
- private ReactInstanceDevCommandsHandler getOriginalHandler() {
- return (ReactInstanceDevCommandsHandler) ReflectionUtils.getDeclaredField(reactInstanceManager, "mDevInterface");
+ Object proxy = Proxy.newProxyInstance(
+ originalHandler.getClass().getClassLoader(),
+ originalHandler.getClass().getInterfaces(),
+ new DevCommandsHandlerProxy(originalHandler, listener));
+
+ if (ReflectionUtils.getDeclaredField(reactInstanceManager, "mDevInterface") == null) {
+ ReflectionUtils.setField(devSupportManager, "mReactInstanceManagerHelper", proxy);
+ } else {
+ ReflectionUtils.setField(reactInstanceManager, "mDevInterface", proxy);
+ ReflectionUtils.setField(devSupportManager, "mReactInstanceCommandsHandler", proxy);
+ }
}
- private void replaceInReactInstanceManager(DevCommandsHandlerProxy proxy) {
- ReflectionUtils.setField(reactInstanceManager, "mDevInterface", proxy);
+
+ private Object getOriginalHandler() {
+ Object devInterface = ReflectionUtils.getDeclaredField(reactInstanceManager, "mDevInterface");
+ if (devInterface == null) {
+ Object devSupportManager = ReflectionUtils.getDeclaredField(reactInstanceManager, "mDevSupportManager");
+ devInterface = ReflectionUtils.getDeclaredField(devSupportManager, "mReactInstanceManagerHelper");
+ }
+ return devInterface;
}
- private static class DevCommandsHandlerProxy implements ReactInstanceDevCommandsHandler {
- private ReactInstanceDevCommandsHandler originalReactHandler;
+
+ private static class DevCommandsHandlerProxy implements InvocationHandler {
+ private Object originalReactHandler;
private final Listener listener;
- DevCommandsHandlerProxy(ReactInstanceDevCommandsHandler originalReactHandler, Listener listener) {
+ DevCommandsHandlerProxy(Object originalReactHandler, Listener listener) {
this.originalReactHandler = originalReactHandler;
this.listener = listener;
}
@Override
- public void onReloadWithJSDebugger(JavaJSExecutor.Factory proxyExecutorFactory) {
- listener.onJsDevReload();
- originalReactHandler.onReloadWithJSDebugger(proxyExecutorFactory);
- }
-
- @Override
- public void onJSBundleLoadedFromServer() {
- listener.onJsDevReload();
- originalReactHandler.onJSBundleLoadedFromServer();
- }
-
- @Override
- public void toggleElementInspector() {
- originalReactHandler.toggleElementInspector();
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ if (method.getName().equals("onJSBundleLoadedFromServer") || method.getName().equals("onReloadWithJSDebugger")) {
+ listener.onJsDevReload();
+ }
+ return method.invoke(originalReactHandler, args);
}
}
}

View File

@@ -1,9 +1,10 @@
import React, { ReactNode, SFC } from 'react'
import React, { PureComponent, ReactNode } from 'react'
import { SafeAreaView, StyleSheet, View, ViewStyle } from 'react-native'
import SplashScreen from 'react-native-splash-screen'
import theme from '../../styles/themes/dark'
export const size = 48
let isSplashScreenVisible = true
export interface IProps {
children: ReactNode
@@ -18,15 +19,24 @@ const styles = StyleSheet.create({
} as ViewStyle,
})
const Screen: SFC<IProps> = ({ useSafeArea, ...props }) =>
useSafeArea ? (
<SafeAreaView {...props} style={[styles.container, props.style]} />
) : (
<View {...props} style={[styles.container, props.style]} />
)
export default class Screen extends PureComponent<IProps> {
static defaultProps = {
useSafeArea: true,
}
Screen.defaultProps = {
useSafeArea: true,
componentDidMount() {
if (isSplashScreenVisible) {
SplashScreen.hide()
isSplashScreenVisible = false
}
}
render() {
const { useSafeArea, ...props } = this.props
if (useSafeArea)
return <SafeAreaView {...props} style={[styles.container, props.style]} />
return <View {...props} style={[styles.container, props.style]} />
}
}
export default Screen

View File

@@ -16,7 +16,7 @@ export default class EventCardsContainer extends PureComponent<IProps, IState> {
async componentDidMount() {
try {
const response = await fetch(
'https://api.github.com/repos/facebook/react-native/events?access_token=fae0e8d5d55b71afb4c59d6abb89fce457c48160',
'https://api.github.com/users/brunolemos/received_events?access_token=fae0e8d5d55b71afb4c59d6abb89fce457c48160',
)
const events = await response.json()
if (Array.isArray(events)) this.setState({ events })

View File

@@ -1,3 +1,5 @@
import { PureComponent } from 'react'
import { gestureHandlerRootHOC } from 'react-native-gesture-handler'
import { Navigation } from 'react-native-navigation'
import AvatarNavBarButton from './components/common/AvatarNavBarButton'
@@ -7,25 +9,32 @@ import NotificationsScreen from './screens/NotificationsScreen'
import PreferencesScreen from './screens/PreferencesScreen'
import theme from './styles/themes/dark'
export function registerComponents() {
Navigation.registerComponent(FeedScreen.componentId, () => FeedScreen)
Navigation.registerComponent(
NotificationsScreen.componentId,
() => NotificationsScreen,
)
Navigation.registerComponent(
PreferencesScreen.componentId,
() => PreferencesScreen,
)
Navigation.registerComponent(
AvatarNavBarButton.componentId,
() => AvatarNavBarButton,
)
export interface IScreenComponent extends PureComponent {
componentId: string
}
function register(screenComponents: { [key: string]: IScreenComponent }) {
Object.values(screenComponents).forEach(ScreenComponent => {
Navigation.registerComponent(ScreenComponent.componentId, () =>
gestureHandlerRootHOC(ScreenComponent),
)
})
}
export const screens: { [key: string]: IScreenComponent } = {
FeedScreen,
NotificationsScreen,
PreferencesScreen,
}
const components: { [key: string]: IScreenComponent } = {
AvatarNavBarButton,
}
export async function init() {
registerComponents()
await initIcons()
register(screens)
register(components)
}
const appStyle = {

View File

@@ -22,7 +22,7 @@ export default class FeedScreen extends PureComponent<IProps> {
static navigatorStyle = {}
componentWillMount() {
this.props.navigator.setTitle({ title: 'react-native' }) // , subtitle: 'dashboard'
this.props.navigator.setTitle({ title: 'brunolemos' }) // , subtitle: 'dashboard'
this.props.navigator.setButtons({
leftButtons: [
@@ -54,7 +54,7 @@ export default class FeedScreen extends PureComponent<IProps> {
passProps: {
onPress: this.handlePress,
size: 24,
username: 'facebook',
username: 'brunolemos',
} as IAvatarNavBarButtonIconProps,
},
],

View File

@@ -4373,9 +4373,9 @@ react-native-linear-gradient@^2.4.0:
dependencies:
prop-types "^15.5.10"
react-native-navigation@^1.1.349:
version "1.1.349"
resolved "https://registry.yarnpkg.com/react-native-navigation/-/react-native-navigation-1.1.349.tgz#eb1a54c09460d62c1d700ab0a1fab13b8bc6a579"
react-native-navigation@^1.1.354:
version "1.1.354"
resolved "https://registry.yarnpkg.com/react-native-navigation/-/react-native-navigation-1.1.354.tgz#27a8bb3fbd2cff5cfc27c6376c81dc45f7b567c2"
dependencies:
lodash "4.x.x"
@@ -4383,6 +4383,10 @@ react-native-safari-view@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/react-native-safari-view/-/react-native-safari-view-2.1.0.tgz#1e0cd12c62bce79bc1759c7e281646b08b61c959"
react-native-splash-screen@^3.0.6:
version "3.0.6"
resolved "https://registry.yarnpkg.com/react-native-splash-screen/-/react-native-splash-screen-3.0.6.tgz#c0bbf2c8ae40a313c4c7044f55e569414ff68332"
react-native-typescript-transformer@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/react-native-typescript-transformer/-/react-native-typescript-transformer-1.2.2.tgz#94d5345925054429d13264b082cee89e39670698"