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

[WIP] React Native 0.70.0 Upgrade #30

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ef9ea57
add editable button profile picture
joaoferreiro Nov 30, 2022
28ebf3d
add editable button cover picture
joaoferreiro Nov 30, 2022
9920457
Merge branch 'main' into upload-profile-images
joaoferreiro Dec 5, 2022
34be0ad
upload profile photos (save them locally)
joaoferreiro Dec 5, 2022
4bc0f77
rollback pbxproj changes
joaoferreiro Dec 5, 2022
a9da790
rollback podfile checksum (for git only)
joaoferreiro Dec 5, 2022
979a264
move edit photos onto edit profile modal
joaoferreiro Dec 5, 2022
49ad374
adjust edit icon and image cropping size
joaoferreiro Dec 5, 2022
7895e08
added temporary (react state) image
joaoferreiro Dec 5, 2022
54f5f31
Merge branch 'main' into upload-profile-images
joaoferreiro Dec 5, 2022
65bd863
Merge branch 'upload-image' into upload-profile-images
joaoferreiro Dec 5, 2022
cd37aa2
added IMAGES_ENABLED flag
joaoferreiro Dec 5, 2022
032ab34
minor lint fix
joaoferreiro Dec 5, 2022
2cec34a
Merge branch 'main' into upload-profile-image
joaoferreiro Dec 5, 2022
a067312
save local photos on edit profile upload (wip)
joaoferreiro Dec 6, 2022
8d98c99
save profile photos on profile view state (wip)
joaoferreiro Dec 6, 2022
174bcfc
remove unecessary computed
joaoferreiro Dec 6, 2022
90d851c
save photo in state before pushing it to viewmodel
joaoferreiro Dec 6, 2022
ed6bcfd
refactor profile pictures's state
joaoferreiro Dec 6, 2022
80b8c7b
remove unnecessary isMe prop
joaoferreiro Dec 6, 2022
7ef25a6
removing old comments
joaoferreiro Dec 6, 2022
8381b7e
Merge branch 'main' into upload-profile-image
joaoferreiro Dec 6, 2022
41be5d3
Merge branch 'upload-profile-image' into 4-update-to-react-native-070
joaoferreiro Dec 6, 2022
9f38719
update RN to 0.70 (untested)
joaoferreiro Dec 6, 2022
8836977
Merge branch 'main' into 4-update-to-react-native-070
joaoferreiro Dec 6, 2022
eb30aa6
Merge branch 'main' into 4-update-to-react-native-070
joaoferreiro Dec 6, 2022
afce012
fixing ios build
joaoferreiro Dec 7, 2022
2006527
fix app name
joaoferreiro Dec 7, 2022
eeaa20e
Merge branch 'main' into 4-update-to-react-native-070
joaoferreiro Dec 7, 2022
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
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local

# Android/IntelliJ
#
Expand All @@ -29,6 +30,7 @@ build/
local.properties
*.iml
*.hprof
.cxx/

# node.js
#
Expand All @@ -49,9 +51,10 @@ buck-out/
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle
Expand Down
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.4
2.7.5
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.4'
ruby '2.7.5'

gem 'cocoapods', '~> 1.11', '>= 1.11.2'
55 changes: 24 additions & 31 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
*/

project.ext.react = [
enableHermes: false, // clean and rebuild if changing
enableHermes: true, // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
Expand Down Expand Up @@ -143,26 +143,14 @@ android {
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
// We configure the NDK build only if you decide to opt-in for the New Architecture.
// We configure the CMake build only if you decide to opt-in for the New Architecture.
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-21",
"APP_STL=c++_shared",
"NDK_TOOLCHAIN_VERSION=clang",
"GENERATED_SRC_DIR=$buildDir/generated/source",
"PROJECT_BUILD_DIR=$buildDir",
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
cppFlags "-std=c++17"
// Make sure this target name is the same you specify inside the
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
targets "app_appmodules"

// Fix for windows limit on number of character in file paths and in command lines
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
arguments "NDK_APP_SHORT_COMMANDS=true"
}
cmake {
arguments "-DPROJECT_BUILD_DIR=$buildDir",
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
"-DANDROID_STL=c++_shared"
}
}
if (!enableSeparateBuildPerCPUArchitecture) {
Expand All @@ -176,8 +164,8 @@ android {
if (isNewArchitectureEnabled()) {
// We configure the NDK build only if you decide to opt-in for the New Architecture.
externalNativeBuild {
ndkBuild {
path "$projectDir/src/main/jni/Android.mk"
cmake {
path "$projectDir/src/main/jni/CMakeLists.txt"
}
}
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
Expand All @@ -199,15 +187,15 @@ android {
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)

// Due to a bug inside AGP, we have to explicitly set a dependency
// between configureNdkBuild* tasks and the preBuild tasks.
// between configureCMakeDebug* tasks and the preBuild tasks.
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
configureNdkBuildRelease.dependsOn(preReleaseBuild)
configureNdkBuildDebug.dependsOn(preDebugBuild)
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
configureCMakeDebug.dependsOn(preDebugBuild)
reactNativeArchitectures().each { architecture ->
tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
dependsOn("preDebugBuild")
}
tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
dependsOn("preReleaseBuild")
}
}
Expand Down Expand Up @@ -282,9 +270,10 @@ dependencies {
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
//noinspection GradleDynamicVersion
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
exclude group:'com.facebook.fbjni'
}
} else {
implementation jscFlavor
}
Expand All @@ -297,7 +286,11 @@ if (isNewArchitectureEnabled()) {
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("com.facebook.react:react-native"))
.using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
.using(project(":ReactAndroid"))
.because("On New Architecture we're building React Native from source")
substitute(module("com.facebook.react:hermes-engine"))
.using(project(":ReactAndroid:hermes-engine"))
.because("On New Architecture we're building Hermes from source")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ protected String getMainComponentName() {

/**
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
* you can specify the rendered you wish to use (Fabric or the older renderer).
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
* (Paper).
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
Expand All @@ -38,6 +39,13 @@ protected ReactRootView createRootView() {
return reactRootView;
}

@Override
protected boolean isConcurrentRootEnabled() {
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public JSIModuleProvider<UIManager> getJSIModuleProvider() {
return new FabricJSIModuleProvider(
reactApplicationContext,
componentFactory,
new EmptyReactNativeConfig(),
ReactNativeConfig.DEFAULT_CONFIG,
viewManagerRegistry);
}
});
Expand Down
49 changes: 0 additions & 49 deletions android/app/src/main/jni/Android.mk

This file was deleted.

5 changes: 5 additions & 0 deletions android/app/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.13)
# Define the library name here.
project(rndiffapp_appmodules)
# This file includes all the necessary to let you build your application with the New Architecture.
include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake)
9 changes: 8 additions & 1 deletion android/app/src/main/jni/MainApplicationModuleProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace facebook {
namespace react {

std::shared_ptr<TurboModule> MainApplicationModuleProvider(
const std::string moduleName,
const std::string &moduleName,
const JavaTurboModule::InitParams &params) {
// Here you can provide your own module provider for TurboModules coming from
// either your application or from external libraries. The approach to follow
Expand All @@ -17,6 +17,13 @@ std::shared_ptr<TurboModule> MainApplicationModuleProvider(
// return module;
// }
// return rncore_ModuleProvider(moduleName, params);

// Module providers autolinked by RN CLI
auto rncli_module = rncli_ModuleProvider(moduleName, params);
if (rncli_module != nullptr) {
return rncli_module;
}

return rncore_ModuleProvider(moduleName, params);
}

Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/jni/MainApplicationModuleProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace facebook {
namespace react {

std::shared_ptr<TurboModule> MainApplicationModuleProvider(
const std::string moduleName,
const std::string &moduleName,
const JavaTurboModule::InitParams &params);

} // namespace react
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ void MainApplicationTurboModuleManagerDelegate::registerNatives() {

std::shared_ptr<TurboModule>
MainApplicationTurboModuleManagerDelegate::getTurboModule(
const std::string name,
const std::shared_ptr<CallInvoker> jsInvoker) {
const std::string &name,
const std::shared_ptr<CallInvoker> &jsInvoker) {
// Not implemented yet: provide pure-C++ NativeModules here.
return nullptr;
}

std::shared_ptr<TurboModule>
MainApplicationTurboModuleManagerDelegate::getTurboModule(
const std::string name,
const std::string &name,
const JavaTurboModule::InitParams &params) {
return MainApplicationModuleProvider(name, params);
}

bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule(
std::string name) {
const std::string &name) {
return getTurboModule(name, nullptr) != nullptr ||
getTurboModule(name, {.moduleName = name}) != nullptr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ class MainApplicationTurboModuleManagerDelegate
static void registerNatives();

std::shared_ptr<TurboModule> getTurboModule(
const std::string name,
const std::shared_ptr<CallInvoker> jsInvoker) override;
const std::string &name,
const std::shared_ptr<CallInvoker> &jsInvoker) override;
std::shared_ptr<TurboModule> getTurboModule(
const std::string name,
const std::string &name,
const JavaTurboModule::InitParams &params) override;

/**
* Test-only method. Allows user to verify whether a TurboModule can be
* created by instances of this class.
*/
bool canCreateTurboModule(std::string name);
bool canCreateTurboModule(const std::string &name,);
};

} // namespace react
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/jni/MainComponentsRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <fbjni/fbjni.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
#include <react/renderer/components/rncore/ComponentDescriptors.h>
#include <rncli.h>

namespace facebook {
namespace react {
Expand All @@ -14,6 +15,9 @@ std::shared_ptr<ComponentDescriptorProviderRegistry const>
MainComponentsRegistry::sharedProviderRegistry() {
auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();

// Autolinked providers registered by RN CLI
rncli_registerProviders(providerRegistry);

// Custom Fabric Components go here. You can register custom
// components coming from your App or from 3rd party libraries here.
//
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {
dependencies {
classpath('com.android.tools.build:gradle:7.2.1')
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:4.1.2")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
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,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ includeBuild('../node_modules/react-native-gradle-plugin')
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
include(":ReactAndroid")
project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
include(":ReactAndroid:hermes-engine")
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
}
11 changes: 11 additions & 0 deletions ios/.xcode.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

# This `.xcode.env` file is versioned and is used to source the environment
# used when running script phases inside Xcode.
# To customize your local environment, you can create an `.xcode.env.local`
# file that is not versioned.
# NODE_BINARY variable contains the PATH to the node executable.
#
# Customize the NODE_BINARY variable here.
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)
Loading