Skip to content

Commit

Permalink
feat!: drop support for Flipper
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Dropped support for Flipper.

For more context, see
react-native-community/discussions-and-proposals#641.
  • Loading branch information
tido64 committed Oct 24, 2023
1 parent d307e16 commit a419291
Show file tree
Hide file tree
Showing 18 changed files with 14 additions and 393 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ jobs:
- name: Install Pods
if: ${{ steps.affected.outputs.ios != '' }}
run: |
USE_FLIPPER=0 pod install --project-directory=${{ steps.configure.outputs.project-directory }}
pod install --project-directory=${{ steps.configure.outputs.project-directory }}
working-directory: template-example
- name: Build
if: ${{ steps.affected.outputs.ios != '' }}
Expand Down
25 changes: 0 additions & 25 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ project.ext.react = [
bundleInRelease : false,
enableCamera : !getSingleAppMode(),
enableFabric : isFabricEnabled(project),
enableFlipper : getFlipperVersion(rootDir),
enableHermes : true,
enableNewArchitecture: enableNewArchitecture,
]
Expand Down Expand Up @@ -116,11 +115,6 @@ android {
buildConfigField "String", "ReactTestApp_appManifest", "\"${appManifest}\""
buildConfigField "String", "ReactTestApp_appManifestChecksum", "\"${checksum}\""

def recommendedFlipperVersion = getFlipperRecommendedVersion(rootDir)
buildConfigField "String",
"ReactTestApp_recommendedFlipperVersion",
recommendedFlipperVersion ? "\"${recommendedFlipperVersion}\"" : "\"0\""

def singleApp = getSingleAppMode()
buildConfigField "String", "ReactTestApp_singleApp", singleApp ? "\"${singleApp}\"" : "null"

Expand Down Expand Up @@ -319,10 +313,6 @@ android {
? "src/reactapplication-pre-0.73/java"
: "src/reactapplication-0.73/java",
]

if (project.ext.react.enableFlipper) {
debug.java.srcDirs += "src/flipper/java"
}
}

splits {
Expand Down Expand Up @@ -398,21 +388,6 @@ dependencies {
implementation libraries.androidCameraMlKitVision
implementation libraries.mlKitBarcodeScanning
}

if (project.ext.react.enableFlipper) {
logger.warn("\nFlipper is deprecated and is removed from react-native in 0.74")
logger.warn("\nFlipper will be removed from react-native-test-app in 3.0")
def flipperVersion = project.ext.react.enableFlipper
debugImplementation("com.facebook.flipper:flipper:${flipperVersion}") {
exclude(group: "com.facebook.fbjni")
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${flipperVersion}") {
exclude(group: "com.facebook.flipper")
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${flipperVersion}") {
exclude(group: "com.facebook.flipper")
}
}
}

if (!usePrefabs) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.app.Activity
import android.app.Application
import android.content.Context
import android.net.Uri
import android.util.Log
import com.facebook.hermes.reactexecutor.HermesExecutorFactory
import com.facebook.react.PackageList
import com.facebook.react.ReactInstanceManager
Expand All @@ -13,7 +12,6 @@ import com.facebook.react.bridge.JSIModulePackage
import com.facebook.react.bridge.JavaScriptExecutorFactory
import com.facebook.react.bridge.ReactContext
import com.facebook.react.devsupport.interfaces.DevSupportManager
import com.facebook.react.modules.systeminfo.ReactNativeVersion
import com.facebook.react.packagerconnection.PackagerConnectionSettings
import com.facebook.soloader.SoLoader
import com.microsoft.reacttestapp.BuildConfig
Expand Down Expand Up @@ -81,26 +79,6 @@ class TestAppReactNativeHost(

beforeReactNativeInit()
reactInstanceManager.createReactContextInBackground()

if (BuildConfig.DEBUG) {
try {
Class.forName("com.microsoft.reacttestapp.ReactNativeFlipper")
.getMethod("initialize", Context::class.java, ReactInstanceManager::class.java)
.invoke(null, application, reactInstanceManager)
} catch (e: ClassNotFoundException) {
val flipperVersion = BuildConfig.ReactTestApp_recommendedFlipperVersion
if (flipperVersion != "0") {
val major = ReactNativeVersion.VERSION["major"] as Int
val minor = ReactNativeVersion.VERSION["minor"] as Int
Log.i(
"ReactTestApp",
"To use Flipper, define `FLIPPER_VERSION` in your `gradle.properties`. " +
"Since you're using React Native $major.$minor, we recommend setting " +
"`FLIPPER_VERSION=$flipperVersion`."
)
}
}
}
}

fun addReactInstanceEventListener(listener: (ReactContext) -> Unit) {
Expand Down
27 changes: 0 additions & 27 deletions android/test-app-util.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -134,33 +134,6 @@ ext.getArchitectures = {
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

ext.getFlipperRecommendedVersion = { baseDir ->
def reactNativePath = findNodeModulesPath("react-native", baseDir)
def props = new Properties()
file("${reactNativePath}/template/android/gradle.properties").withInputStream {
props.load(it)
}

return props.getProperty("FLIPPER_VERSION")
}

ext.getFlipperVersion = { baseDir ->
def recommendedFlipperVersion = getFlipperRecommendedVersion(baseDir)
if (recommendedFlipperVersion == null) {
// Current React Native version doesn't support Flipper
return null
}

// Prefer user specified Flipper version
if (project.hasProperty("FLIPPER_VERSION")) {
def flipperVersion = project.getProperty("FLIPPER_VERSION")
return flipperVersion == "false" ? null : flipperVersion
}

// Use the recommended Flipper version
return recommendedFlipperVersion
}

ext.getManifest = {
if (manifest == null) {
def manifestFile = findFile("app.json")
Expand Down
4 changes: 0 additions & 4 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Version of Flipper to use with React Native. Default value is whatever React
# Native defaults to. To disable Flipper, set it to `false`.
#FLIPPER_VERSION=0.182.0

# Enable Fabric at runtime.
#USE_FABRIC=1

Expand Down
2 changes: 0 additions & 2 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ require_relative '../node_modules/react-native-test-app/test_app'

workspace 'Example.xcworkspace'

use_flipper! false unless ENV['ENABLE_FLIPPER']

options = {
:fabric_enabled => false,
:hermes_enabled => false,
Expand Down
13 changes: 0 additions & 13 deletions ios/ReactTestApp/ReactInstance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,6 @@ final class ReactInstance: NSObject, RNXHostConfig {
andEventID: AEEventID(kAEGetURL)
)
#endif

#if USE_FLIPPER
if let flipper = FlipperClient.shared() {
flipper.add(FlipperKitLayoutPlugin(
rootNode: UIApplication.shared,
with: SKDescriptorMapper(defaults: ())
))
flipper.add(FKUserDefaultsPlugin(suiteName: nil))
flipper.add(FlipperKitReactPlugin())
flipper.add(FlipperKitNetworkPlugin(networkAdapter: SKIOSNetworkAdapter()))
flipper.start()
}
#endif
}

init(forTestingPurposesOnly: Bool) {
Expand Down
9 changes: 0 additions & 9 deletions ios/ReactTestApp/ReactTestApp-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@

@import ReactTestApp_DevSupport;

#if USE_FLIPPER
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#endif // USE_FLIPPER

#import "React+Compatibility.h"
#import "UIViewController+ReactTestApp.h"

Expand Down
32 changes: 1 addition & 31 deletions ios/test_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@ def platform_config(key, project_root, target_platform)
config[key] if !config.nil? && !config.empty?
end

def flipper_enabled?
@flipper_versions != false
end

def flipper_versions
@flipper_versions != false && (@flipper_versions || {})
end

def nearest_node_modules(project_root)
path = find_file('node_modules', project_root)
assert(!path.nil?, "Could not find 'node_modules'")
Expand Down Expand Up @@ -194,10 +186,6 @@ def resources_pod(project_root, target_platform, platforms)
Pathname.new(app_dir).relative_path_from(project_root).to_s
end

def use_flipper!(versions = {})
@flipper_versions = versions
end

def use_react_native!(project_root, target_platform, options)
react_native = react_native_path(project_root, target_platform)
version = package_version(react_native.to_s).segments
Expand All @@ -208,9 +196,7 @@ def use_react_native!(project_root, target_platform, options)
include_react_native!(**options,
app_path: find_file('package.json', project_root).parent.to_s,
path: react_native.relative_path_from(project_root).to_s,
rta_flipper_versions: flipper_versions,
rta_project_root: project_root,
rta_target_platform: target_platform)
rta_project_root: project_root)
end

def make_project!(xcodeproj, project_root, target_platform, options)
Expand Down Expand Up @@ -315,7 +301,6 @@ def make_project!(xcodeproj, project_root, target_platform, options)
build_number = platform_config('buildNumber', project_root, target_platform)
build_settings['PRODUCT_BUILD_NUMBER'] = build_number || '1'

supports_flipper = target_platform == :ios && flipper_enabled?
use_fabric = fabric_enabled?(options, rn_version)
use_turbomodule = new_architecture_enabled?(options, rn_version)

Expand All @@ -332,19 +317,13 @@ def make_project!(xcodeproj, project_root, target_platform, options)
(rn_version >= v(0, 71, 0) && rn_version < v(0, 71, 4)) ||
(rn_version.positive? && rn_version < v(0, 70, 14))
target.build_configurations.each do |config|
use_flipper = config.name == 'Debug' && supports_flipper

config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << version_macro
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'USE_FABRIC=1' if use_fabric
if enable_cxx17_removed_unary_binary_function
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] <<
'_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION=1'
end
if use_flipper
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'FB_SONARKIT_ENABLED=1'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'USE_FLIPPER=1'
end
if use_turbomodule
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'FOLLY_NO_CONFIG=1'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_NEW_ARCH_ENABLED=1'
Expand All @@ -357,10 +336,6 @@ def make_project!(xcodeproj, project_root, target_platform, options)

config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['$(inherited)']
config.build_settings['OTHER_SWIFT_FLAGS'] << '-DUSE_FABRIC' if use_fabric
if use_flipper
config.build_settings['OTHER_SWIFT_FLAGS'] << '-DFB_SONARKIT_ENABLED'
config.build_settings['OTHER_SWIFT_FLAGS'] << '-DUSE_FLIPPER'
end
config.build_settings['OTHER_SWIFT_FLAGS'] << '-DUSE_TURBOMODULE' if use_turbomodule
if single_app.is_a? String
config.build_settings['OTHER_SWIFT_FLAGS'] << '-DENABLE_SINGLE_APP_MODE'
Expand Down Expand Up @@ -455,11 +430,6 @@ def use_test_app_internal!(target_platform, options)

installer.pods_project.targets.each do |target|
case target.name
when /\AFlipper/, 'libevent'
target.build_configurations.each do |config|
# Flipper and its dependencies log too many warnings
config.build_settings['WARNING_CFLAGS'] = ['-w']
end
when /\AReact/
target.build_configurations.each do |config|
# Xcode 10.2 requires suppression of nullability for React
Expand Down
14 changes: 1 addition & 13 deletions ios/use_react_native-0.64.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
# rubocop:disable Metrics/CyclomaticComplexity

require 'open3'

def include_react_native!(options)
react_native, flipper_versions, project_root, target_platform = options.values_at(
:path, :rta_flipper_versions, :rta_project_root, :rta_target_platform
)
react_native, project_root = options.values_at(:path, :rta_project_root)

require_relative(File.join(project_root, react_native, 'scripts', 'react_native_pods'))

if target_platform == :ios && flipper_versions
Pod::UI.warn('Flipper is deprecated and is removed from react-native in 0.74')
Pod::UI.warn('Flipper will be removed from react-native-test-app in 3.0')
end

use_flipper!(flipper_versions) if target_platform == :ios && flipper_versions
use_react_native!(options)

# If we're using react-native@main, we'll also need to prepare
Expand All @@ -37,5 +27,3 @@ def include_react_native!(options)
end
}
end

# rubocop:enable Metrics/CyclomaticComplexity
11 changes: 1 addition & 10 deletions ios/use_react_native-0.68.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,11 @@
require_relative('pod_helpers')

def include_react_native!(options)
react_native = options[:path]
flipper_versions = options[:rta_flipper_versions]
project_root = options[:rta_project_root]
target_platform = options[:rta_target_platform]
react_native, project_root = options.values_at(:path, :rta_project_root)

require_relative(File.join(project_root, react_native, 'scripts', 'react_native_pods'))

if target_platform == :ios && flipper_versions
Pod::UI.warn('Flipper is deprecated and is removed from react-native in 0.74')
Pod::UI.warn('Flipper will be removed from react-native-test-app in 3.0')
end

use_new_architecture!(options)
use_flipper!(flipper_versions) if target_platform == :ios && flipper_versions
use_react_native!(options)

# If we're using react-native@main, we'll also need to prepare
Expand Down
Loading

0 comments on commit a419291

Please sign in to comment.