Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to React Native v0.74 #36

Merged
merged 10 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ class MainView extends React.Component {
console.log(`[APP] Mounted component (${new Date().getTime()})`);
let defaultnotif = await createChannel();
console.log(`[NOTIFEE] Created channel: ${defaultnotif}`);
console.log(app.version, app.settings.get('app.lastVersion'));
const lastVersion = app.settings.get('app.lastVersion');
if (!lastVersion || lastVersion === '') {
console.log(
`[APP] lastVersion is null (${lastVersion}), setting to app.version (${app.version})`,
);
app.settings.set('app.lastVersion', app.version);
} else {
app.version === lastVersion
? console.log(
`[APP] lastVersion (${lastVersion}) is equal to app.version (${app.version})`,
)
: console.log(
`[APP] lastVersion (${lastVersion}) is different from app.version (${app.version})`,
);
}
client.on('connecting', () => {
console.log(`[APP] Connecting to instance... (${new Date().getTime()})`);
});
Expand Down
1 change: 0 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ android {
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("com.facebook.react:flipper-integration")

implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.flipper.ReactNativeFlipper
import com.facebook.soloader.SoLoader

import com.reactnativecommunity.asyncstorage.AsyncStoragePackage
Expand All @@ -32,7 +31,7 @@ class MainApplication : Application(), ReactApplication {
}

override val reactHost: ReactHost
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
get() = getDefaultReactHost(applicationContext, reactNativeHost)

override fun onCreate() {
super.onCreate()
Expand All @@ -41,6 +40,5 @@ class MainApplication : Application(), ReactApplication {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
}
}
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.1.8937393"
kotlinVersion = "1.8.0"
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
}
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +201,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
30 changes: 17 additions & 13 deletions webpack.config.js → config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const appDirectory = path.resolve(__dirname);
const {webPlugins} = require(`${appDirectory}/config/babel-shared`);
const {presets} = require(`${appDirectory}/babel.config.js`);
const dir = path.resolve(__dirname);
const appDirectory = `${dir}/../`
const {webPlugins} = require(`${dir}/babel-shared`);
const {presets} = require(`${dir}/../babel.config.js`);

const compileNodeModules = [
// react-native packages that need compiling
Expand All @@ -27,10 +28,10 @@ const babelLoaderConfiguration = {
test: /\.js$|tsx?$/,
// Add every directory that needs to be compiled by Babel during the build.
include: [
path.resolve(__dirname, 'index.web.js'),
path.resolve(__dirname, 'App.tsx'),
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'i18n'),
path.resolve(__dirname, '../index.web.js'),
path.resolve(__dirname, '../App.tsx'),
path.resolve(__dirname, '../src'),
path.resolve(__dirname, '../i18n'),
...compileNodeModules,
],
// FIXME: why doesn't this work quite right
Expand Down Expand Up @@ -65,15 +66,18 @@ const vectorLoaderConfiguration = {
],
};

const vectorIconLoaderConfiguration = {
const fontLoaderConfiguration = {
test: /\.ttf$/,
loader: 'url-loader',
include: path.resolve(__dirname, 'node_modules/react-native-vector-icons'),
include: [
path.resolve(__dirname, '../assets/fonts'),
path.resolve(__dirname, '../node_modules/react-native-vector-icons'),
]
};

module.exports = {
entry: {
app: path.join(__dirname, 'index.web.js'),
app: path.join(__dirname, '../index.web.js'),
},
output: {
filename: 'bundle.web.js',
Expand All @@ -90,15 +94,15 @@ module.exports = {
module: {
rules: [
babelLoaderConfiguration,
fontLoaderConfiguration,
imageLoaderConfiguration,
vectorLoaderConfiguration,
vectorIconLoaderConfiguration,
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, 'web/index.html'),
favicon: path.join(__dirname, 'public/favicon.ico'),
template: path.join(__dirname, '../web/index.html'),
favicon: path.join(__dirname, '../public/favicon.ico'),
}),
new webpack.DefinePlugin({
// See: https://github.com/necolas/react-native-web/issues/349
Expand Down
48 changes: 45 additions & 3 deletions index.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,52 @@ import './i18n/i18n';

import {name as appName} from './app.json';

import Inter from './assets/fonts/Inter/Inter.ttf';
import InterBold from './assets/fonts/Inter/Inter_Bold.ttf';
import JetBrainsMono from './assets/fonts/JetBrains Mono/JetBrains Mono.ttf';
import JetBrainsMonoBold from './assets/fonts/JetBrains Mono/JetBrains Mono_Bold.ttf';
import OpenSans from './assets/fonts/Open Sans/Open Sans.ttf';
import OpenSansBold from './assets/fonts/Open Sans/Open Sans_bold.ttf';

import MaterialIconFont from 'react-native-vector-icons/Fonts/MaterialIcons.ttf';
import MaterialCommunityIconFont from 'react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf';

const iconFontStyles = `@font-face {
const fontStyles = `
@font-face {
src: url(${Inter});
font-family: 'Inter';
}

@font-face {
src: url(${InterBold});
font-family: 'Inter';
font-weight: bold;
}

@font-face {
src: url(${JetBrainsMono});
font-family: 'JetBrains Mono';
}

@font-face {
src: url(${JetBrainsMonoBold});
font-family: 'JetBrains Mono';
font-weight: bold;
}

@font-face {
src: url(${OpenSans});
font-family: 'Open Sans';
font-weight: normal;
}

@font-face {
src: url(${OpenSansBold});
font-family: 'Open Sans';
font-weight: bold;
}

@font-face {
src: url(${MaterialCommunityIconFont});
font-family: MaterialCommunityIcons;
}
Expand All @@ -28,9 +70,9 @@ style.type = 'text/css';

// Append the iconFontStyles to the stylesheet
if (style.styleSheet) {
style.styleSheet.cssText = iconFontStyles;
style.styleSheet.cssText = fontStyles;
} else {
style.appendChild(document.createTextNode(iconFontStyles));
style.appendChild(document.createTextNode(fontStyles));
}

// Inject the stylesheet into the document head
Expand Down
62 changes: 31 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,82 +11,82 @@
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"web": "webpack-dev-server --config webpack.config.js --hot --mode=development",
"web-release": "webpack --config webpack.config.js --mode=production",
"web": "webpack-dev-server --config config/webpack.config.js --hot --mode=development",
"web-release": "webpack --config config/webpack.config.js --mode=production",
"postinstall": "patch-package"
},
"dependencies": {
"@gorhom/bottom-sheet": "^4.6.1",
"@notifee/react-native": "^7.8.2",
"@react-native-async-storage/async-storage": "^1.22.3",
"@react-native-clipboard/clipboard": "^1.13.2",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-clipboard/clipboard": "^1.14.0",
"@react-native-community/hooks": "^3.0.0",
"@rexovolt/react-native-side-menu": "^2.0.0",
"@traptitech/markdown-it-spoiler": "^1.1.6",
"babel-plugin-module-resolver": "^5.0.0",
"date-fns": "^3.5.0",
"i18next": "^23.10.1",
"babel-plugin-module-resolver": "^5.0.2",
"date-fns": "^3.6.0",
"i18next": "^23.11.2",
"intl-pluralrules": "^2.0.1",
"markdown-it-regexp": "^0.4.0",
"mobx": "^6.12.0",
"mobx-react-lite": "^4.0.6",
"mobx": "^6.12.3",
"mobx-react-lite": "^4.0.7",
"postinstall-postinstall": "^2.1.0",
"process": "^0.11.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.13",
"react-i18next": "^14.1.0",
"react-native": "^0.73.6",
"react-native-device-info": "^10.13.1",
"react-native-document-picker": "^9.1.1",
"react-native": "^0.74.0",
"react-native-device-info": "^10.13.2",
"react-native-document-picker": "^9.1.2",
"react-native-fast-image": "^8.6.3",
"react-native-gesture-handler": "^2.15.0",
"react-native-gesture-handler": "^2.16.0",
"react-native-get-random-values": "^1.11.0",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-markdown-display": "^7.0.2",
"react-native-reanimated": "^3.8.1",
"react-native-reanimated": "^3.9.0-rc.1",
"react-native-svg": "^15.1.0",
"react-native-vector-icons": "^10.0.3",
"react-native-web": "^0.19.10",
"react-native-web": "^0.19.11",
"reanimated-color-picker": "^3.0.3",
"revkit": "^1.1.14",
"revolt.js": "npm:@rexovolt/revolt.js@^6.2.0"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/plugin-transform-export-namespace-from": "^7.23.4",
"@babel/preset-env": "^7.24.0",
"@babel/runtime": "^7.24.0",
"@react-native/babel-preset": "^0.74.0",
"@react-native/eslint-config": "^0.74.0",
"@react-native/metro-config": "^0.74.0",
"@react-native/typescript-config": "^0.74.0",
"@babel/core": "^7.24.4",
"@babel/plugin-transform-export-namespace-from": "^7.24.1",
"@babel/preset-env": "^7.24.4",
"@babel/runtime": "^7.24.4",
"@react-native/babel-preset": "^0.74.81",
"@react-native/eslint-config": "^0.74.81",
"@react-native/metro-config": "^0.74.81",
"@react-native/typescript-config": "^0.74.81",
"@svgr/webpack": "^8.1.0",
"@types/assert": "^1.5.7",
"@types/babel__core": "^7.20.2",
"@types/eslint": "^8.56.5",
"@types/eslint": "^8.56.10",
"@types/events": "^3.0.1",
"@types/metro-config": "^0.76.3",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@types/react-native-vector-icons": "^6.4.15",
"@types/react-test-renderer": "^18.0.7",
"@types/readable-stream": "^4.0.10",
"@types/readable-stream": "^4.0.11",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.3",
"babel-plugin-react-native-web": "^0.19.10",
"babel-plugin-react-native-web": "^0.19.11",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^8.56.0",
"html-webpack-plugin": "^5.6.0",
"jest": "^29.7.0",
"patch-package": "^8.0.0",
"prettier": "^2.8.8",
"react-devtools": "^5.0.2",
"react-devtools": "^5.1.0",
"react-native-svg-transformer": "^1.3.0",
"react-test-renderer": "^18.2.0",
"typescript": "^5.4.2",
"typescript": "^5.4.5",
"url-loader": "^4.1.1",
"webpack": "^5.90.3",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/react-native-reanimated/lib/module/reanimated2/PlatformChecker.js b/node_modules/react-native-reanimated/lib/module/reanimated2/PlatformChecker.js
index 21ffca5..75f7f1d 100644
index 13ac999..87f2822 100644
--- a/node_modules/react-native-reanimated/lib/module/reanimated2/PlatformChecker.js
+++ b/node_modules/react-native-reanimated/lib/module/reanimated2/PlatformChecker.js
@@ -5,7 +5,12 @@ import { Platform } from 'react-native';
Expand Down
Loading
Loading