Skip to content

Commit

Permalink
Merge pull request #16 from kuasha420/upgrade/react-native-0.69.5
Browse files Browse the repository at this point in the history
v4.1.0 - update react-native and libraries.
  • Loading branch information
itsaladin authored Sep 3, 2022
2 parents 83ba0c6 + 0ebfde5 commit a377edc
Show file tree
Hide file tree
Showing 10 changed files with 603 additions and 453 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ See the below table to find out which version of the template to use.

| React Native | Template |
| ------------ | -------- |
| 0.69.5 | 4.1.\* |
| 0.69.2 | 4.0.\* |
| 0.68.2 | 3.1.\* |
| 0.68.1 | 3.0.\* |
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-template-ts-plus",
"version": "4.0.0",
"version": "4.1.0",
"description": "A React Native TypeScript Template with Superpowers",
"types": "index.d.ts",
"scripts": {
Expand All @@ -22,5 +22,8 @@
"bugs": {
"url": "https://github.com/kuasha420/react-native-template-ts-plus/issues"
},
"homepage": "https://github.com/kuasha420/react-native-template-ts-plus#readme"
"homepage": "https://github.com/kuasha420/react-native-template-ts-plus#readme",
"devDependencies": {
"shelljs": "^0.8.5"
}
}
7 changes: 2 additions & 5 deletions postversion.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execSync } from "child_process";
import fs from "fs";
import shelljs from "shelljs";
import pkgJson from "./package.json" assert { type: "json" };
import templatePkgJson from "./template/package.json" assert { type: "json" };

Expand All @@ -10,12 +10,9 @@ const { currentVersion } = await import("./version.mjs");
fs.rmSync("./version.mjs");

// Update template version in source code.
execSync(
`sed -i "s!${currentVersion}!${pkgJson.version}!g" ${versionFilePath}`
);
shelljs.sed("-i", currentVersion, pkgJson.version, versionFilePath);

// Add new version matrix entry in README.md if needed.

const readme = fs.readFileSync("./README.md", "utf8");

const versionRegex =
Expand Down
3 changes: 1 addition & 2 deletions template/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation "androidx.core:core-splashscreen:1.0.0-beta01"
implementation "androidx.core:core-splashscreen:1.0.0"

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
Expand Down
45 changes: 20 additions & 25 deletions template/android/app/src/main/java/com/helloworld/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// For React Native Immersive Bar DayNightDetection
import android.content.res.Configuration;

// For React Native BootSplash
// For React Native Screens
import android.os.Bundle;

import com.facebook.react.ReactActivity;
Expand Down Expand Up @@ -36,6 +36,25 @@ protected String getMainComponentName() {
protected ReactActivityDelegate createReactActivityDelegate() {
return new MainActivityDelegate(this, getMainComponentName());
}

@Override
protected void onCreate(Bundle savedInstanceState) {
// React Native Bootsplash
RNBootSplash.init(this);

// React Native Immersive Bars
boolean isDarkMode = false;
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (currentNightMode == Configuration.UI_MODE_NIGHT_YES) {
isDarkMode = true;
}
ImmersiveBars.changeBarColors(this, isDarkMode);

// Reaact Native Screens
// See: https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704633
super.onCreate(null);
}

public static class MainActivityDelegate extends ReactActivityDelegate {
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
super(activity, mainComponentName);
Expand All @@ -55,29 +74,5 @@ protected boolean isConcurrentRootEnabled() {
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}

// React Native Bootsplash
@Override
protected void loadApp(String appKey) {
RNBootSplash.init(getPlainActivity());
super.loadApp(appKey);
}
}

@Override
protected void onCreate(Bundle savedInstanceState) {
// React Native Immersive Bars
boolean isDarkMode = false;
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;

if (currentNightMode == Configuration.UI_MODE_NIGHT_YES) {
isDarkMode = true;
}

ImmersiveBars.changeBarColors(this, isDarkMode);

// Reaact Native Screens
// See: https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704633
super.onCreate(null);
}
}
Loading

0 comments on commit a377edc

Please sign in to comment.