Skip to content

Commit

Permalink
chore: upgrade templates to latest react-native
Browse files Browse the repository at this point in the history
  • Loading branch information
artyorsh authored Dec 4, 2019
1 parent ea44bee commit 3759572
Show file tree
Hide file tree
Showing 105 changed files with 302 additions and 161 deletions.
3 changes: 0 additions & 3 deletions src/template-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"type": "git",
"url": "git+https://github.com/akveo/react-native-ui-kitten.git"
},
"bugs": {
"url": "https://github.com/akveo/react-native-ui-kitten/issues"
},
"keywords": [
"react-native",
"ui-kitten",
Expand Down
4 changes: 2 additions & 2 deletions src/template-js/template/App.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const HeartIcon = (style) => (
);

const App = () => (
<React.Fragment>
<>
<IconRegistry icons={EvaIconsPack}/>
<ApplicationProvider mapping={mapping} theme={theme}>
<Layout style={styles.container}>
Expand All @@ -53,7 +53,7 @@ const App = () => (
</Button>
</Layout>
</ApplicationProvider>
</React.Fragment>
</>
);

const styles = StyleSheet.create({
Expand Down
14 changes: 14 additions & 0 deletions src/template-js/template/__tests__/App-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @format
*/

import 'react-native';
import React from 'react';
import App from '../App';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
renderer.create(<App />);
});
Empty file modified src/template-js/template/_buckconfig
100755 → 100644
Empty file.
Empty file modified src/template-js/template/_eslintrc.js
100755 → 100644
Empty file.
Empty file modified src/template-js/template/_gitattributes
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions src/template-js/template/_gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ yarn-error.log
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
Expand Down
Empty file modified src/template-js/template/_prettierrc.js
100755 → 100644
Empty file.
Empty file modified src/template-js/template/_watchmanconfig
100755 → 100644
Empty file.
17 changes: 4 additions & 13 deletions src/template-js/template/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -176,27 +176,18 @@ android {

}
}

packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules

if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
implementation jscFlavor
}
}

Expand Down
Empty file modified src/template-js/template/android/app/build_defs.bzl
100755 → 100644
Empty file.
Empty file modified src/template-js/template/android/app/debug.keystore
100755 → 100644
Empty file.
Empty file modified src/template-js/template/android/app/proguard-rules.pro
100755 → 100644
Empty file.
Empty file.
16 changes: 8 additions & 8 deletions src/template-js/template/android/app/src/main/java/com/helloworld/MainActivity.java
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

public class MainActivity extends ReactActivity {

/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "HelloWorld";
}
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "HelloWorld";
}
}
71 changes: 48 additions & 23 deletions src/template-js/template/android/app/src/main/java/com/helloworld/MainApplication.java
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
package com.helloworld;

import android.app.Application;
import android.util.Log;

import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}

@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
protected String getJSMainModuleName() {
return "index";
}
};

@Override
public ReactNativeHost getReactNativeHost() {
Expand All @@ -45,5 +43,32 @@ public ReactNativeHost getReactNativeHost() {
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this); // Remove this line if you don't want Flipper enabled
}

/**
* Loads Flipper in React Native templates.
*
* @param context
*/
private static void initializeFlipper(Context context) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
4 changes: 2 additions & 2 deletions src/template-js/template/android/build.gradle
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ buildscript {
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.1")
classpath("com.android.tools.build:gradle:3.4.2")

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -34,5 +33,6 @@ allprojects {

google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
Empty file modified src/template-js/template/android/gradle.properties
100755 → 100644
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion src/template-js/template/android/gradle/wrapper/gradle-wrapper.properties
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Empty file modified src/template-js/template/android/gradlew.bat
100755 → 100644
Empty file.
Empty file modified src/template-js/template/app.json
100755 → 100644
Empty file.
Empty file modified src/template-js/template/babel.config.js
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions src/template-js/template/index.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @format
*/

import { AppRegistry } from 'react-native';
import {AppRegistry} from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
Empty file modified src/template-js/template/ios/HelloWorld-tvOS/Info.plist
100755 → 100644
Empty file.
Empty file modified src/template-js/template/ios/HelloWorld-tvOSTests/Info.plist
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified src/template-js/template/ios/HelloWorld/AppDelegate.h
100755 → 100644
Empty file.
Empty file modified src/template-js/template/ios/HelloWorld/AppDelegate.m
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified src/template-js/template/ios/HelloWorld/Info.plist
100755 → 100644
Empty file.
Empty file modified src/template-js/template/ios/HelloWorld/main.m
100755 → 100644
Empty file.
8 changes: 6 additions & 2 deletions src/template-js/template/ios/HelloWorldTests/HelloWorldTests.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#import <React/RCTRootView.h>

#define TIMEOUT_SECONDS 600
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
#define TEXT_TO_LOOK_FOR @"Welcome to React"

@interface HelloWorldTests : XCTestCase

Expand Down Expand Up @@ -40,11 +40,13 @@ - (void)testRendersWelcomeScreen
BOOL foundElement = NO;

__block NSString *redboxError = nil;
#ifdef DEBUG
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
if (level >= RCTLogLevelError) {
redboxError = message;
}
});
#endif

while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
Expand All @@ -57,8 +59,10 @@ - (void)testRendersWelcomeScreen
return NO;
}];
}


#ifdef DEBUG
RCTSetLogFunction(RCTDefaultLogFunction);
#endif

XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
Expand Down
Empty file modified src/template-js/template/ios/HelloWorldTests/Info.plist
100755 → 100644
Empty file.
15 changes: 11 additions & 4 deletions src/template-js/template/ios/Podfile
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ

target 'HelloWorld' do
# Pods for HelloWorld
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
Expand All @@ -15,13 +20,15 @@ target 'HelloWorld' do
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
Expand Down
Empty file modified src/template-js/template/metro.config.js
100755 → 100644
Empty file.
28 changes: 18 additions & 10 deletions src/template-js/template/package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
{
"name": "ui-kitten-js-app",
"name": "HelloWorld",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"start:ios": "react-native run-ios",
"start:android": "react-native run-android",
"test": "jest",
"postinstall": "react-native link"
},
"dependencies": {
"@eva-design/eva": "^1.3.0-beta.1",
"@ui-kitten/components": "^4.3.0-beta.1",
"@ui-kitten/eva-icons": "^4.3.0-beta.1",
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-svg": "^9.9.4"
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-svg": "^9.13.3"
},
"devDependencies": {
"@babel/core": "^7.5.0",
"@babel/runtime": "^7.5.0",
"@react-native-community/eslint-config": "^0.0.3",
"metro-react-native-babel-preset": "0.54.1"
"@babel/core": "^7.6.2",
"@babel/runtime": "^7.6.2",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native",
"transformIgnorePatterns": []
}
}
3 changes: 0 additions & 3 deletions src/template-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"type": "git",
"url": "git+https://github.com/akveo/react-native-ui-kitten.git"
},
"bugs": {
"url": "https://github.com/akveo/react-native-ui-kitten/issues"
},
"keywords": [
"react-native",
"ui-kitten",
Expand Down
4 changes: 2 additions & 2 deletions src/template-ts/template/App.tsx
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const HeartIcon = (style: ImageStyle): React.ReactElement<ImageProps> => (
);

const App = (): React.ReactFragment => (
<React.Fragment>
<>
<IconRegistry icons={EvaIconsPack}/>
<ApplicationProvider mapping={mapping} theme={theme}>
<Layout style={styles.container}>
Expand All @@ -57,7 +57,7 @@ const App = (): React.ReactFragment => (
</Button>
</Layout>
</ApplicationProvider>
</React.Fragment>
</>
);

const styles = StyleSheet.create({
Expand Down
14 changes: 14 additions & 0 deletions src/template-ts/template/__tests__/App-test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @format
*/

import 'react-native';
import React from 'react';
import App from '../App';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
renderer.create(<App />);
});
Empty file modified src/template-ts/template/_buckconfig
100755 → 100644
Empty file.
Empty file modified src/template-ts/template/_eslintrc.js
100755 → 100644
Empty file.
Empty file modified src/template-ts/template/_gitattributes
100755 → 100644
Empty file.
Loading

0 comments on commit 3759572

Please sign in to comment.