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

[RNMobile] Upgrade React Native 0.71.11 - iOS changes #51386

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
1 change: 0 additions & 1 deletion packages/react-native-editor/ios/.ruby-version

This file was deleted.

1 change: 1 addition & 0 deletions packages/react-native-editor/ios/.xcode.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export NODE_BINARY=$(command -v node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is being consistently added whenever I run pod install, though it does not appear in the RN upgrade helper. Interested to hear thoughts on including it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it should be committed, and individuals can create a .xcode.env.local to modify the configuration if necessary for their individual local environment. Its exclusion was likely an oversight from prior upgrade work.

We should add .xcode.env.local to this project's .gitignore configuration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the confidence check, David! I just found that .xcode.env.local is already in packages/react-native-editor/.gitignore, so it seems we're all set on that front:

https://github.com/WordPress/gutenberg/blob/trunk/packages/react-native-editor/.gitignore#L64

Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,16 @@
"${BUILT_PRODUCTS_DIR}/React-Core/React.framework",
"${BUILT_PRODUCTS_DIR}/React-CoreModules/CoreModules.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTAnimation/RCTAnimation.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTAppDelegate/React_RCTAppDelegate.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTBlob/RCTBlob.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTImage/RCTImage.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTLinking/RCTLinking.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTNetwork/RCTNetwork.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTSettings/RCTSettings.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTText/RCTText.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTVibration/RCTVibration.framework",
"${BUILT_PRODUCTS_DIR}/React-bridging/react_bridging.framework",
"${BUILT_PRODUCTS_DIR}/React-cxxreact/cxxreact.framework",
"${BUILT_PRODUCTS_DIR}/React-jsc/React_jsc.framework",
"${BUILT_PRODUCTS_DIR}/React-jsi/jsi.framework",
"${BUILT_PRODUCTS_DIR}/React-jsiexecutor/jsireact.framework",
"${BUILT_PRODUCTS_DIR}/React-jsinspector/jsinspector.framework",
Expand Down Expand Up @@ -394,15 +395,16 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CoreModules.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTAnimation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React_RCTAppDelegate.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTBlob.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTLinking.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTNetwork.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTSettings.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTText.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTVibration.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_bridging.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/cxxreact.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React_jsc.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsi.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsireact.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsinspector.framework",
Expand Down Expand Up @@ -474,15 +476,16 @@
"${BUILT_PRODUCTS_DIR}/React-Core/React.framework",
"${BUILT_PRODUCTS_DIR}/React-CoreModules/CoreModules.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTAnimation/RCTAnimation.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTAppDelegate/React_RCTAppDelegate.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTBlob/RCTBlob.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTImage/RCTImage.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTLinking/RCTLinking.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTNetwork/RCTNetwork.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTSettings/RCTSettings.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTText/RCTText.framework",
"${BUILT_PRODUCTS_DIR}/React-RCTVibration/RCTVibration.framework",
"${BUILT_PRODUCTS_DIR}/React-bridging/react_bridging.framework",
"${BUILT_PRODUCTS_DIR}/React-cxxreact/cxxreact.framework",
"${BUILT_PRODUCTS_DIR}/React-jsc/React_jsc.framework",
"${BUILT_PRODUCTS_DIR}/React-jsi/jsi.framework",
"${BUILT_PRODUCTS_DIR}/React-jsiexecutor/jsireact.framework",
"${BUILT_PRODUCTS_DIR}/React-jsinspector/jsinspector.framework",
Expand Down Expand Up @@ -522,15 +525,16 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CoreModules.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTAnimation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React_RCTAppDelegate.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTBlob.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTLinking.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTNetwork.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTSettings.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTText.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTVibration.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/react_bridging.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/cxxreact.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React_jsc.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsi.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsireact.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsinspector.framework",
Expand Down Expand Up @@ -635,6 +639,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
Expand Down Expand Up @@ -669,6 +674,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
Expand Down Expand Up @@ -710,7 +716,8 @@
INFOPLIST_FILE = GutenbergDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)";
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(PROJECT_DIR)";
MARKETING_VERSION = 1.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -744,7 +751,8 @@
INFOPLIST_FILE = GutenbergDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)";
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(PROJECT_DIR)";
MARKETING_VERSION = 1.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -764,7 +772,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -798,7 +806,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_VERSION = 5.0;
};
Expand All @@ -808,7 +816,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand All @@ -835,7 +843,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-editor/ios/GutenbergDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
38 changes: 34 additions & 4 deletions packages/react-native-editor/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,25 @@ require_relative '../../../node_modules/@react-native-community/cli-platform-ios
# Uncomment the next line to define a global platform for your project
app_ios_deployment_target = Gem::Version.new('13.0')
platform :ios, app_ios_deployment_target.version
install! 'cocoapods', :deterministic_uuids => false
install! 'cocoapods', min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
# dependencies: {
# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fluiddot, a question out of curiosity more than any strong opinion: I noticed that suggested changes related to flipper were left out from the 0.66.2 → 0.69.4 PR, which is why I didn't include flipper-related changes in my commits. What is your thought process for including it? I'm guessing that it's perhaps due to it not causing any issues and being nice to have setup, just in case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I noticed that they weren't included in the last RN upgrade. I understand it wasn't added because we don't use Flipper in the demo app, but not completely sure. cc @geriux @derekblank in case they have any insights.

From my side, I've included it in the spirit to make the Podfile look as close as the one from the upgrade helper. Seems it won't affect the build configuration, so we could leave it in case we want to enable Flipper in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sake of discussion, my approach generally aligns with @fluiddot.

As much as possible, I make our code resemble the upgrade helper or React Native template. I do this (1) to make future upgrades easier and (2) I lack confidence in managing these native files, so the less divergence from core the more confidence I have. I think it is generally a good practice to avoid "dead" code, but in this context I make exceptions for the reasons I outlined.

I also recognize that our code will need to diverge from the core template as our product is embedded in a host app, rather than being a standalone React Native app. So, we will ultimately always have custom native code to manage.

In regards to Flipper, my perception is that we are currently blocked from using it on iOS due to our (required) usage of use_frameworks!. Hopefully, we can one day enable deeper Flipper integration for the iOS Demo app, as well as setting it up for WordPress-Android and WordPress-iOS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand it wasn't added because we don't use Flipper in the demo app.

Yes, I recall this being the reason Flipper code was excluded from the 0.69.4 upgrade. However, I agree that it will be helpful for future upgrades to make all template updates from the upgrade helper. 👍


linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end

target 'GutenbergDemo' do
# Comment the next line if you don't want to use dynamic frameworks
Expand All @@ -16,9 +34,16 @@ target 'GutenbergDemo' do

use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
:hermes_enabled => false,
:fabric_enabled => false,
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# :flipper_configuration => flipper_config,
# An absolute path to the application root
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
Expand All @@ -29,8 +54,13 @@ target 'GutenbergDemo' do
end

post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
react_native_post_install(
installer,
config[:reactNativePath],
# Set `mac_catalyst_enabled` to `true` in order to apply patches
# necessary for Mac Catalyst builds
:mac_catalyst_enabled => false
)

# Let Pods targets inherit deployment target from the app
# This solution is suggested here: https://github.com/CocoaPods/CocoaPods/issues/4859
Expand Down
Loading