diff --git a/build.gradle.kts b/build.gradle.kts index 866560d6388..2c78ff1dc92 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,12 +26,10 @@ fun getListReactAndroidProperty(name: String) = reactAndroidProperties.getProper apiValidation { ignoredPackages.addAll( - getListReactAndroidProperty("binaryCompatibilityValidator.ignoredPackages") - ) + getListReactAndroidProperty("binaryCompatibilityValidator.ignoredPackages")) ignoredClasses.addAll(getListReactAndroidProperty("binaryCompatibilityValidator.ignoredClasses")) nonPublicMarkers.addAll( - getListReactAndroidProperty("binaryCompatibilityValidator.nonPublicMarkers") - ) + getListReactAndroidProperty("binaryCompatibilityValidator.nonPublicMarkers")) validationDisabled = reactAndroidProperties .getProperty("binaryCompatibilityValidator.validationDisabled") @@ -39,9 +37,8 @@ apiValidation { } version = - if ( - project.hasProperty("isSnapshot") && (project.property("isSnapshot") as? String).toBoolean() - ) { + if (project.hasProperty("isSnapshot") && + (project.property("isSnapshot") as? String).toBoolean()) { "${reactAndroidProperties.getProperty("VERSION_NAME")}-SNAPSHOT" } else { reactAndroidProperties.getProperty("VERSION_NAME") @@ -69,10 +66,8 @@ tasks.register("clean", Delete::class.java) { description = "Remove all the build files and intermediate build outputs" dependsOn(gradle.includedBuild("gradle-plugin").task(":clean")) subprojects.forEach { - if ( - it.project.plugins.hasPlugin("com.android.library") || - it.project.plugins.hasPlugin("com.android.application") - ) { + if (it.project.plugins.hasPlugin("com.android.library") || + it.project.plugins.hasPlugin("com.android.application")) { dependsOn(it.tasks.named("clean")) } } @@ -82,13 +77,10 @@ tasks.register("clean", Delete::class.java) { delete(rootProject.file("./packages/react-native/sdks/download/")) delete(rootProject.file("./packages/react-native/sdks/hermes/")) delete( - rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/arm64-v8a/") - ) + rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/arm64-v8a/")) delete( rootProject.file( - "./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/" - ) - ) + "./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/")) delete(rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/x86/")) delete(rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/x86_64/")) delete(rootProject.file("./packages/react-native-codegen/lib")) @@ -106,8 +98,7 @@ tasks.register("publishAllToMavenTempLocal") { dependsOn(":packages:react-native:ReactAndroid:publishAllPublicationsToMavenTempLocalRepository") // We don't publish the external-artifacts to Maven Local as ci is using it via workspace. dependsOn( - ":packages:react-native:ReactAndroid:hermes-engine:publishAllPublicationsToMavenTempLocalRepository" - ) + ":packages:react-native:ReactAndroid:hermes-engine:publishAllPublicationsToMavenTempLocalRepository") } tasks.register("publishAndroidToSonatype") { @@ -129,8 +120,7 @@ if (project.findProperty("react.internal.useHermesNightly")?.toString()?.toBoole That's fine for local development, but you should not commit this change. ******************************************************************************** """ - .trimIndent() - ) + .trimIndent()) allprojects { configurations.all { resolutionStrategy.dependencySubstitution { @@ -162,12 +152,10 @@ allprojects { "**/build/**", "**/hermes-engine/**", "**/internal/featureflags/**", - "**/systeminfo/ReactNativeVersion.kt", - ) + "**/systeminfo/ReactNativeVersion.kt") listOf( com.ncorti.ktfmt.gradle.tasks.KtfmtCheckTask::class, - com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask::class, - ) + com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask::class) .forEach { tasks.withType(it) { exclude(excludePatterns) } } // Disable the problematic ktfmt script tasks due to symbolic link issues in subprojects diff --git a/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts b/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts index 85dadeba0c4..b29578732a9 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts +++ b/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts @@ -68,8 +68,7 @@ tasks.withType().configureEach { // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( - project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false - ) + project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt index 961649623d5..2e89b8c281d 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt @@ -208,8 +208,7 @@ abstract class ReactExtension @Inject constructor(val project: Project) { } else { buildTypes.forEach { buildType -> result.add( - (dependencyConfiguration ?: "${buildType}Implementation") to ":$nameCleansed" - ) + (dependencyConfiguration ?: "${buildType}Implementation") to ":$nameCleansed") } } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt index 9f0b5a97348..e749135deb1 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt @@ -112,8 +112,7 @@ class ReactPlugin : Plugin { ******************************************************************************** """ - .trimIndent() - ) + .trimIndent()) exitProcess(1) } } @@ -187,8 +186,7 @@ class ReactPlugin : Plugin { // We want to exclude the build directory, to don't pick them up for execution // avoidance. tree.exclude("**/build/**/*") - } - ) + }) val needsCodegenFromPackageJson = project.needsCodegenFromPackageJson(rootExtension.root) it.onlyIf { (isLibrary || needsCodegenFromPackageJson) && !includesGeneratedCode } @@ -305,8 +303,7 @@ class ReactPlugin : Plugin { project.extensions.getByType(ApplicationAndroidComponentsExtension::class.java).apply { onVariants(selector().all()) { variant -> variant.sources.java?.addStaticSourceDirectory( - generatedAutolinkingJavaDir.get().asFile.absolutePath - ) + generatedAutolinkingJavaDir.get().asFile.absolutePath) } } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.kt index e818a1ed339..698c1fef076 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.kt @@ -59,12 +59,10 @@ class ReactRootProjectPlugin : Plugin { } private fun checkLegacyArchProperty(project: Project) { - if ( - (project.hasProperty(PropertyUtils.NEW_ARCH_ENABLED) && - !project.property(PropertyUtils.NEW_ARCH_ENABLED).toString().toBoolean()) || - (project.hasProperty(PropertyUtils.SCOPED_NEW_ARCH_ENABLED) && - !project.property(PropertyUtils.SCOPED_NEW_ARCH_ENABLED).toString().toBoolean()) - ) { + if ((project.hasProperty(PropertyUtils.NEW_ARCH_ENABLED) && + !project.property(PropertyUtils.NEW_ARCH_ENABLED).toString().toBoolean()) || + (project.hasProperty(PropertyUtils.SCOPED_NEW_ARCH_ENABLED) && + !project.property(PropertyUtils.SCOPED_NEW_ARCH_ENABLED).toString().toBoolean())) { project.logger.error( """ ******************************************************************************** @@ -79,8 +77,7 @@ class ReactRootProjectPlugin : Plugin { ******************************************************************************** """ - .trimIndent() - ) + .trimIndent()) } } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt index db6d3f3b0ff..bf9f51cf4a9 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt @@ -54,11 +54,9 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio configureNewArchPackagingOptions(project, config, variant) configureJsEnginePackagingOptions(config, variant, isHermesEnabledInThisVariant, useThirdPartyJSC) - if ( - !isHermesEnabledInThisVariant && - !useThirdPartyJSC && - rootProject.name != "react-native-github" - ) { + if (!isHermesEnabledInThisVariant && + !useThirdPartyJSC && + rootProject.name != "react-native-github") { showJSCRemovalMessage(project) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt index 0c993f59c60..31795b3e5e6 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt @@ -39,15 +39,12 @@ abstract class PrivateReactExtension @Inject constructor(project: Project) { // - We're inside a user project, so inside the ./android folder. Default should be // ../ // User can always override this default by setting a `root =` inside the template. - if ( - project.rootProject.name == "react-native-github" || - project.rootProject.name == "react-native-build-from-source" - ) { + if (project.rootProject.name == "react-native-github" || + project.rootProject.name == "react-native-build-from-source") { project.rootProject.layout.projectDirectory.dir("../../") } else { project.rootProject.layout.projectDirectory.dir("../") - } - ) + }) val reactNativeDir: DirectoryProperty = objects.directoryProperty().convention(root.dir("node_modules/react-native")) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt index 2d618b0b779..38a31b86ac5 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt @@ -165,88 +165,88 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() { // language=cmake val CMAKE_TEMPLATE = """ - # This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin) - cmake_minimum_required(VERSION 3.13) - set(CMAKE_VERBOSE_MAKEFILE on) - - # We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so - # or link against a old prefab target (this is needed for React Native 0.76 on). - set(REACTNATIVE_MERGED_SO true) - - {{ libraryIncludes }} - - set(AUTOLINKED_LIBRARIES - {{ libraryModules }} - ) - """ + # This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin) + cmake_minimum_required(VERSION 3.13) + set(CMAKE_VERBOSE_MAKEFILE on) + + # We set REACTNATIVE_MERGED_SO so libraries/apps can selectively decide to depend on either libreactnative.so + # or link against a old prefab target (this is needed for React Native 0.76 on). + set(REACTNATIVE_MERGED_SO true) + + {{ libraryIncludes }} + + set(AUTOLINKED_LIBRARIES + {{ libraryModules }} + ) + """ .trimIndent() // language=cpp val CPP_TEMPLATE = """ - /** - * This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - */ - - #include "autolinking.h" - {{ autolinkingCppIncludes }} - - namespace facebook { - namespace react { - - std::shared_ptr autolinking_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { - {{ autolinkingCppTurboModuleJavaProviders }} - return nullptr; - } - - std::shared_ptr autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr& jsInvoker) { - {{ autolinkingCppTurboModuleCxxProviders }} - return nullptr; - } - - void autolinking_registerProviders(std::shared_ptr providerRegistry) { - {{ autolinkingCppComponentDescriptors }} - return; - } - - } // namespace react - } // namespace facebook - """ + /** + * This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + */ + + #include "autolinking.h" + {{ autolinkingCppIncludes }} + + namespace facebook { + namespace react { + + std::shared_ptr autolinking_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { + {{ autolinkingCppTurboModuleJavaProviders }} + return nullptr; + } + + std::shared_ptr autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr& jsInvoker) { + {{ autolinkingCppTurboModuleCxxProviders }} + return nullptr; + } + + void autolinking_registerProviders(std::shared_ptr providerRegistry) { + {{ autolinkingCppComponentDescriptors }} + return; + } + + } // namespace react + } // namespace facebook + """ .trimIndent() // language=cpp val hTemplate = """ - /** - * This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - */ - - #pragma once - - #include - #include - #include - #include - #include - - namespace facebook { - namespace react { - - std::shared_ptr autolinking_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); - std::shared_ptr autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr& jsInvoker); - void autolinking_registerProviders(std::shared_ptr providerRegistry); - - } // namespace react - } // namespace facebook - """ + /** + * This code was generated by [React Native](https://www.npmjs.com/package/@react-native/gradle-plugin). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + */ + + #pragma once + + #include + #include + #include + #include + #include + + namespace facebook { + namespace react { + + std::shared_ptr autolinking_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); + std::shared_ptr autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr& jsInvoker); + void autolinking_registerProviders(std::shared_ptr providerRegistry); + + } // namespace react + } // namespace facebook + """ .trimIndent() } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt index df38179ca08..f6f2e99e5a8 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt @@ -82,7 +82,6 @@ abstract class GenerateCodegenArtifactsTask : Exec() { libraryName, "--javaPackageName", codegenJavaPackageName, - ) - ) + )) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt index 6127d48008d..dbfc3e1291f 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt @@ -69,7 +69,6 @@ abstract class GenerateCodegenSchemaTask : Exec() { "NativeSampleTurboModule", generatedSchemaFile.get().asFile.cliPath(workingDir), jsRootDir.asFile.get().cliPath(workingDir), - ) - ) + )) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateEntryPointTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateEntryPointTask.kt index 12733547226..f069eef477d 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateEntryPointTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateEntryPointTask.kt @@ -32,19 +32,17 @@ abstract class GenerateEntryPointTask : DefaultTask() { JsonUtils.fromAutolinkingConfigJson(autolinkInputFile.get().asFile) ?: error( """ - RNGP - Autolinking: Could not parse autolinking config file: - ${autolinkInputFile.get().asFile.absolutePath} - - The file is either missing or not containing valid JSON so the build won't succeed. - """ - .trimIndent() - ) + RNGP - Autolinking: Could not parse autolinking config file: + ${autolinkInputFile.get().asFile.absolutePath} + + The file is either missing or not containing valid JSON so the build won't succeed. + """ + .trimIndent()) val packageName = model.project?.android?.packageName ?: error( - "RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field." - ) + "RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field.") val generatedFileContents = composeFileContent(packageName) val outputDir = generatedOutputDirectory.get().asFile @@ -64,45 +62,45 @@ abstract class GenerateEntryPointTask : DefaultTask() { // language=java val generatedFileContentsTemplate = """ - package com.facebook.react; - - import android.app.Application; - import android.content.Context; - import android.content.res.Resources; - - import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; - import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger; - import com.facebook.react.views.view.WindowUtilKt; - import com.facebook.react.soloader.OpenSourceMergedSoMapping; - import com.facebook.soloader.SoLoader; - - import java.io.IOException; - - /** - * This class is the entry point for loading React Native using the configuration - * that the users specifies in their .gradle files. - * - * The `loadReactNative(this)` method invocation should be called inside the - * application onCreate otherwise the app won't load correctly. - */ - public class ReactNativeApplicationEntryPoint { - public static void loadReactNative(Context context) { - try { - SoLoader.init(context, OpenSourceMergedSoMapping.INSTANCE); - } catch (IOException error) { - throw new RuntimeException(error); - } - - if ({{packageName}}.BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { - DefaultNewArchitectureEntryPoint.load(); - } - - if ({{packageName}}.BuildConfig.IS_EDGE_TO_EDGE_ENABLED) { - WindowUtilKt.setEdgeToEdgeFeatureFlagOn(); - } + package com.facebook.react; + + import android.app.Application; + import android.content.Context; + import android.content.res.Resources; + + import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; + import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger; + import com.facebook.react.views.view.WindowUtilKt; + import com.facebook.react.soloader.OpenSourceMergedSoMapping; + import com.facebook.soloader.SoLoader; + + import java.io.IOException; + + /** + * This class is the entry point for loading React Native using the configuration + * that the users specifies in their .gradle files. + * + * The `loadReactNative(this)` method invocation should be called inside the + * application onCreate otherwise the app won't load correctly. + */ + public class ReactNativeApplicationEntryPoint { + public static void loadReactNative(Context context) { + try { + SoLoader.init(context, OpenSourceMergedSoMapping.INSTANCE); + } catch (IOException error) { + throw new RuntimeException(error); + } + + if ({{packageName}}.BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + DefaultNewArchitectureEntryPoint.load(); + } + + if ({{packageName}}.BuildConfig.IS_EDGE_TO_EDGE_ENABLED) { + WindowUtilKt.setEdgeToEdgeFeatureFlagOn(); } } - """ + } + """ .trimIndent() } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt index 5dfcb441a79..e9716424b0e 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt @@ -34,19 +34,17 @@ abstract class GeneratePackageListTask : DefaultTask() { JsonUtils.fromAutolinkingConfigJson(autolinkInputFile.get().asFile) ?: error( """ - RNGP - Autolinking: Could not parse autolinking config file: - ${autolinkInputFile.get().asFile.absolutePath} - - The file is either missing or not containing valid JSON so the build won't succeed. - """ - .trimIndent() - ) + RNGP - Autolinking: Could not parse autolinking config file: + ${autolinkInputFile.get().asFile.absolutePath} + + The file is either missing or not containing valid JSON so the build won't succeed. + """ + .trimIndent()) val packageName = model.project?.android?.packageName ?: error( - "RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field." - ) + "RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field.") val androidPackages = filterAndroidPackages(model) val packageImports = composePackageImports(packageName, androidPackages) @@ -136,69 +134,69 @@ abstract class GeneratePackageListTask : DefaultTask() { // language=java val generatedFileContentsTemplate = """ - package com.facebook.react; - - import android.app.Application; - import android.content.Context; - import android.content.res.Resources; - - import com.facebook.react.ReactPackage; - import com.facebook.react.shell.MainPackageConfig; - import com.facebook.react.shell.MainReactPackage; - import java.util.Arrays; - import java.util.ArrayList; - - {{ packageImports }} - - @SuppressWarnings("deprecation") - public class PackageList { - private Application application; - private ReactNativeHost reactNativeHost; - private MainPackageConfig mConfig; - - public PackageList(ReactNativeHost reactNativeHost) { - this(reactNativeHost, null); - } - - public PackageList(Application application) { - this(application, null); - } - - public PackageList(ReactNativeHost reactNativeHost, MainPackageConfig config) { - this.reactNativeHost = reactNativeHost; - mConfig = config; - } - - public PackageList(Application application, MainPackageConfig config) { - this.reactNativeHost = null; - this.application = application; - mConfig = config; - } - - private ReactNativeHost getReactNativeHost() { - return this.reactNativeHost; - } - - private Resources getResources() { - return this.getApplication().getResources(); - } - - private Application getApplication() { - if (this.reactNativeHost == null) return this.application; - return this.reactNativeHost.getApplication(); - } - - private Context getApplicationContext() { - return this.getApplication().getApplicationContext(); - } - - public ArrayList getPackages() { - return new ArrayList<>(Arrays.asList( - new MainReactPackage(mConfig){{ packageClassInstances }} - )); - } - } - """ + package com.facebook.react; + + import android.app.Application; + import android.content.Context; + import android.content.res.Resources; + + import com.facebook.react.ReactPackage; + import com.facebook.react.shell.MainPackageConfig; + import com.facebook.react.shell.MainReactPackage; + import java.util.Arrays; + import java.util.ArrayList; + + {{ packageImports }} + + @SuppressWarnings("deprecation") + public class PackageList { + private Application application; + private ReactNativeHost reactNativeHost; + private MainPackageConfig mConfig; + + public PackageList(ReactNativeHost reactNativeHost) { + this(reactNativeHost, null); + } + + public PackageList(Application application) { + this(application, null); + } + + public PackageList(ReactNativeHost reactNativeHost, MainPackageConfig config) { + this.reactNativeHost = reactNativeHost; + mConfig = config; + } + + public PackageList(Application application, MainPackageConfig config) { + this.reactNativeHost = null; + this.application = application; + mConfig = config; + } + + private ReactNativeHost getReactNativeHost() { + return this.reactNativeHost; + } + + private Resources getResources() { + return this.getApplication().getResources(); + } + + private Application getApplication() { + if (this.reactNativeHost == null) return this.application; + return this.reactNativeHost.getApplication(); + } + + private Context getApplicationContext() { + return this.getApplication().getApplicationContext(); + } + + public ArrayList getPackages() { + return new ArrayList<>(Arrays.asList( + new MainReactPackage(mConfig){{ packageClassInstances }} + )); + } + } + """ .trimIndent() } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/BuildCodegenCLITask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/BuildCodegenCLITask.kt index 5bed6d86166..74eba652707 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/BuildCodegenCLITask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/BuildCodegenCLITask.kt @@ -54,8 +54,7 @@ abstract class BuildCodegenCLITask : Exec() { windowsAwareBashCommandLine( codegenDir.asFile.get().canonicalPath.unixifyPath().plus(BUILD_SCRIPT_PATH), bashWindowsHome = bashWindowsHome.orNull, - ) - ) + )) super.exec() } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/CustomExecTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/CustomExecTask.kt index 86ab8ba6ce0..ae6d5c108a3 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/CustomExecTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/CustomExecTask.kt @@ -29,10 +29,8 @@ abstract class CustomExecTask : Exec() { @get:Input @get:Optional abstract val onlyIfProvidedPathDoesNotExists: Property override fun exec() { - if ( - onlyIfProvidedPathDoesNotExists.isPresent && - File(onlyIfProvidedPathDoesNotExists.get()).exists() - ) { + if (onlyIfProvidedPathDoesNotExists.isPresent && + File(onlyIfProvidedPathDoesNotExists.get()).exists()) { return } if (standardOutputFile.isPresent) { diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTask.kt index 1139380abb4..1b1bcc0817f 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTask.kt @@ -64,8 +64,7 @@ abstract class PrepareGflagsTask : DefaultTask() { .replace(Regex("@GFLAGS_NAMESPACE@"), "gflags") .replace( Regex( - "@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@" - ), + "@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@"), "1", ) .replace(Regex("@([A-Z0-9_]+)@"), "1") diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt index 4a785deffcb..0c4611a70e4 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt @@ -61,8 +61,7 @@ abstract class PrepareGlogTask : DefaultTask() { "ac_cv___attribute___noreturn" to "__attribute__ ((noreturn))", "ac_cv___attribute___printf_4_5" to "__attribute__((__format__ (__printf__, 4, 5)))", - ) - ), + )), ReplaceTokens::class.java, ) matchedFile.path = (matchedFile.name.removeSuffix(".in")) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt index cd4bdadec34..979d553b2d0 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt @@ -39,8 +39,7 @@ internal object BackwardCompatUtils { ******************************************************************************** """ - .trimIndent() - ) + .trimIndent()) } } @@ -56,14 +55,14 @@ internal object BackwardCompatUtils { val message = """ - =============== JavaScriptCore is being moved =============== - JavaScriptCore has been extracted from react-native core - and will be removed in a future release. It can now be - installed from `@react-native-community/javascriptcore` - See: https://github.com/react-native-community/javascriptcore - ============================================================= +=============== JavaScriptCore is being moved =============== +JavaScriptCore has been extracted from react-native core +and will be removed in a future release. It can now be +installed from `@react-native-community/javascriptcore` +See: https://github.com/react-native-community/javascriptcore +============================================================= - """ +""" .trimIndent() project.logger.warn(message) hasShownJSCRemovalMessage = true diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt index a5cfb351157..0f0574265c3 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt @@ -33,8 +33,7 @@ internal object DependencyUtils { val exclusiveEnterpriseRepository = project.rootProject.exclusiveEnterpriseRepository() if (exclusiveEnterpriseRepository != null) { project.logger.lifecycle( - "Replacing ALL Maven Repositories with: $exclusiveEnterpriseRepository" - ) + "Replacing ALL Maven Repositories with: $exclusiveEnterpriseRepository") } project.rootProject.allprojects { eachProject -> @@ -136,30 +135,26 @@ internal object DependencyUtils { "com.facebook.react:react-native", "${groupString}:react-android:${versionString}", "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.", - ) - ) + )) dependencySubstitution.add( Triple( "com.facebook.react:hermes-engine", "${groupString}:hermes-android:${versionString}", "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.", - ) - ) + )) if (groupString != DEFAULT_INTERNAL_PUBLISHING_GROUP) { dependencySubstitution.add( Triple( "com.facebook.react:react-android", "${groupString}:react-android:${versionString}", "The react-android dependency was modified to use the correct Maven group.", - ) - ) + )) dependencySubstitution.add( Triple( "com.facebook.react:hermes-android", "${groupString}:hermes-android:${versionString}", "The hermes-android dependency was modified to use the correct Maven group.", - ) - ) + )) } return dependencySubstitution } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt index 5f293763d5c..7209ba71b34 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt @@ -45,8 +45,7 @@ internal object NdkConfiguratorUtils { } if (cmakeArgs.none { it.startsWith("-DREACT_ANDROID_DIR") }) { cmakeArgs.add( - "-DREACT_ANDROID_DIR=${extension.reactNativeDir.file("ReactAndroid").get().asFile}" - ) + "-DREACT_ANDROID_DIR=${extension.reactNativeDir.file("ReactAndroid").get().asFile}") } if (cmakeArgs.none { it.startsWith("-DANDROID_STL") }) { cmakeArgs.add("-DANDROID_STL=c++_shared") @@ -87,8 +86,7 @@ internal object NdkConfiguratorUtils { "**/libjsi.so", // AGP will give priority of libc++_shared coming from App modules. "**/libc++_shared.so", - ) - ) + )) } /** diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt index 45dc97b6907..f15111c17d4 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt @@ -105,14 +105,13 @@ private fun detectCliFile(reactNativeRoot: File, preconfiguredCliFile: File?): F error( """ - Couldn't determine CLI location! + Couldn't determine CLI location! - Please set `react { cliFile = file(...) }` inside your - build.gradle to the path of the react-native cli.js file. - This file typically resides in `node_modules/react-native/cli.js` - """ - .trimIndent() - ) + Please set `react { cliFile = file(...) }` inside your + build.gradle to the path of the react-native cli.js file. + This file typically resides in `node_modules/react-native/cli.js` + """ + .trimIndent()) } /** @@ -161,8 +160,7 @@ internal fun detectOSAwareHermesCommand(projectRoot: File, hermesCommand: String error( "Couldn't determine Hermesc location. " + "Please set `react.hermesCommand` to the path of the hermesc binary file. " + - "node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc" - ) + "node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc") } /** @@ -188,8 +186,7 @@ internal fun getHermesOSBin(): String { if (Os.isLinuxAmd64()) return "linux64-bin" error( "OS not recognized. Please set project.react.hermesCommand " + - "to the path of a working Hermes compiler." - ) + "to the path of a working Hermes compiler.") } internal fun projectPathToLibraryName(projectPath: String): String = diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactExtensionTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactExtensionTest.kt index 8994ac5a8ae..a3eda2ecf47 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactExtensionTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactExtensionTest.kt @@ -23,12 +23,11 @@ class ReactExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0" - } - """ - .trimIndent() - ) + { + "reactNativeVersion": "1000.0.0" + } + """ + .trimIndent()) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).isEmpty() @@ -39,24 +38,23 @@ class ReactExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react" - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react" } } - """ - .trimIndent() - ) + } + } + } + """ + .trimIndent()) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).containsExactly("implementation" to ":react-native_oss-library-example") @@ -67,25 +65,24 @@ class ReactExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react", - "dependencyConfiguration": "compileOnly" - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react", + "dependencyConfiguration": "compileOnly" } } - """ - .trimIndent() - ) + } + } + } + """ + .trimIndent()) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).containsExactly("compileOnly" to ":react-native_oss-library-example") @@ -96,25 +93,24 @@ class ReactExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react", - "buildTypes": ["debug", "release"] - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react", + "buildTypes": ["debug", "release"] } } - """ - .trimIndent() - ) + } + } + } + """ + .trimIndent()) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps) @@ -129,34 +125,33 @@ class ReactExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react" - } - } - }, - "@react-native/another-library-for-testing": { - "root": "./node_modules/@react-native/another-library-for-testing", - "name": "@react-native/another-library-for-testing", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react" - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react" } } - """ - .trimIndent() - ) + }, + "@react-native/another-library-for-testing": { + "root": "./node_modules/@react-native/another-library-for-testing", + "name": "@react-native/another-library-for-testing", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react" + } + } + } + } + } + """ + .trimIndent()) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps) @@ -171,27 +166,26 @@ class ReactExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/oss-library-example.podspec", - "version": "0.0.0", - "configurations": [], - "scriptPhases": [] - }, - "android": null - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/oss-library-example.podspec", + "version": "0.0.0", + "configurations": [], + "scriptPhases": [] + }, + "android": null } - """ - .trimIndent() - ) + } + } + } + """ + .trimIndent()) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).isEmpty() @@ -202,35 +196,34 @@ class ReactExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/android-example", - "name": "@react-native/android-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react" - } - } - }, - "@react-native/another-library-for-testing": { - "root": "./node_modules/@react-native/cxx-testing", - "name": "@react-native/cxx-testing", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react", - "isPureCxxDependency": true - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/android-example", + "name": "@react-native/android-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react" } } - """ - .trimIndent() - ) + }, + "@react-native/another-library-for-testing": { + "root": "./node_modules/@react-native/cxx-testing", + "name": "@react-native/cxx-testing", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react", + "isPureCxxDependency": true + } + } + } + } + } + """ + .trimIndent()) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).containsExactly("implementation" to ":react-native_android-example") diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesJsonTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesJsonTest.kt index 53b32aaa6b8..3cd7213e59b 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesJsonTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesJsonTest.kt @@ -41,8 +41,7 @@ class ModelAutolinkingDependenciesJsonTest { "@this*is~a(more)complicated/example!of~weird)packages", null, ) - .nameCleansed - ) + .nameCleansed) .isEqualTo("this_is_a_more_complicated_example_of_weird_packages") } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt index 9b86b0af306..621fe697ab4 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt @@ -72,11 +72,9 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { name = "a-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = null), - ) - ), + )), project = null, - ) - ) + )) assertThat(result).isEmpty() } @@ -103,11 +101,9 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { name = "a-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = android), - ) - ), + )), project = null, - ) - ) + )) assertThat(result).containsExactly(android) } @@ -134,8 +130,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { ) """ - .trimIndent() - ) + .trimIndent()) } @Test @@ -165,8 +160,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { another_cxxModule ) """ - .trimIndent() - ) + .trimIndent()) } @Test @@ -210,8 +204,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { } // namespace react } // namespace facebook """ - .trimIndent() - ) + .trimIndent()) } @Test @@ -267,8 +260,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { } // namespace react } // namespace facebook """ - .trimIndent() - ) + .trimIndent()) } @Test diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt index 3b8a1bf0886..c3da68e2a4e 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt @@ -148,8 +148,7 @@ class GenerateCodegenArtifactsTaskTest { } } """ - .trimIndent() - ) + .trimIndent()) } val task = @@ -178,8 +177,7 @@ class GenerateCodegenArtifactsTaskTest { } } """ - .trimIndent() - ) + .trimIndent()) } val task = diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateEntryPointTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateEntryPointTaskTest.kt index 91d57a3844a..ea55e19e7eb 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateEntryPointTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateEntryPointTaskTest.kt @@ -86,7 +86,6 @@ class GenerateEntryPointTaskTest { } } """ - .trimIndent() - ) + .trimIndent()) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt index c9f44534700..831179b2308 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt @@ -64,8 +64,7 @@ class GeneratePackageListTaskTest { // @react-native/another-package import com.facebook.react.anotherPackage; """ - .trimIndent() - ) + .trimIndent()) } @Test @@ -89,8 +88,7 @@ class GeneratePackageListTaskTest { new APackage(), new AnotherPackage() """ - .trimIndent() - ) + .trimIndent()) } @Test @@ -149,11 +147,9 @@ class GeneratePackageListTaskTest { name = "a-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = null), - ) - ), + )), project = null, - ) - ) + )) assertThat(result) .isEqualTo(emptyMap()) } @@ -181,11 +177,9 @@ class GeneratePackageListTaskTest { name = "a-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = android), - ) - ), + )), project = null, - ) - ) + )) assertThat(result.entries.size).isEqualTo(1) assertThat(result["a-dependency"]).isEqualTo(android) } @@ -214,11 +208,9 @@ class GeneratePackageListTaskTest { name = "a-pure-cxx-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = android), - ) - ), + )), project = null, - ) - ) + )) assertThat(result) .isEqualTo(emptyMap()) } @@ -297,8 +289,7 @@ class GeneratePackageListTaskTest { } } """ - .trimIndent() - ) + .trimIndent()) } @Test @@ -380,8 +371,7 @@ class GeneratePackageListTaskTest { } } """ - .trimIndent() - ) + .trimIndent()) } private val testDependencies = diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt index 6b009826c50..c72ad865b4d 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt @@ -26,8 +26,7 @@ class PrepareBoostTaskTest { assertThatThrownBy { task.taskAction() } .isInstanceOf(IllegalStateException::class.java) .hasMessage( - "Cannot query the value of task ':PrepareBoostTask' property 'boostVersion' because it has no value available." - ) + "Cannot query the value of task ':PrepareBoostTask' property 'boostVersion' because it has no value available.") } @Test diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTaskTest.kt index 0464133f401..3ff5c84668a 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTaskTest.kt @@ -125,8 +125,7 @@ typedef unsigned __int64 uint64; #endif } // namespace GFLAGS_NAMESPACE -""" - ) +""") } File(gflagspath, "gflags-1.0.0/src/config.h.in").apply { parentFile.mkdirs() diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTaskTest.kt index 66feaf85ffe..e34e497ae02 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTaskTest.kt @@ -55,8 +55,7 @@ class PreparePrefabHeadersTaskTest { createTestTask(project = project) { it.outputDir.set(outputDir) it.input.set( - listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix)) - ) + listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix))) } task.taskAction() @@ -77,8 +76,7 @@ class PreparePrefabHeadersTaskTest { createTestTask(project = project) { it.outputDir.set(outputDir) it.input.set( - listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix)) - ) + listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix))) } task.taskAction() @@ -104,8 +102,7 @@ class PreparePrefabHeadersTaskTest { "sample_library", listOf("input/component1/" to "", "input/component2/" to ""), ), - ) - ) + )) } task.taskAction() @@ -128,8 +125,7 @@ class PreparePrefabHeadersTaskTest { listOf( PrefabPreprocessingEntry("libraryone", "input/lib1/" to ""), PrefabPreprocessingEntry("librarytwo", "input/lib2/" to ""), - ) - ) + )) } task.taskAction() @@ -159,8 +155,7 @@ class PreparePrefabHeadersTaskTest { "librarytwo", listOf("input/lib2/" to "", "input/shared/" to "shared/"), ), - ) - ) + )) } task.taskAction() diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/AgpConfiguratorUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/AgpConfiguratorUtilsTest.kt index a05a2f71815..c468a54c893 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/AgpConfiguratorUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/AgpConfiguratorUtilsTest.kt @@ -37,8 +37,7 @@ class AgpConfiguratorUtilsTest { """ - .trimIndent() - ) + .trimIndent()) } val actual = getPackageNameFromManifest(manifest) @@ -56,8 +55,7 @@ class AgpConfiguratorUtilsTest { """ - .trimIndent() - ) + .trimIndent()) } val actual = getPackageNameFromManifest(manifest) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt index 42155fb5c32..c634bc0943c 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt @@ -40,8 +40,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == localMavenURI - } - ) + }) .isNotNull() } @@ -55,8 +54,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNotNull() } @@ -70,8 +68,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNotNull() } @@ -85,8 +82,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNotNull() } @@ -100,8 +96,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNotNull() } @@ -121,8 +116,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNotNull() } @@ -137,8 +131,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNull() // We test both with scoped and unscoped property @@ -150,8 +143,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNull() } @@ -166,8 +158,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNotNull() // We test both with scoped and unscoped property @@ -179,8 +170,7 @@ class DependencyUtilsTest { assertThat( project.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNotNull() } @@ -236,14 +226,12 @@ class DependencyUtilsTest { assertThat( appProject.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNotNull() assertThat( libProject.repositories.firstOrNull { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isNotNull() } @@ -266,8 +254,7 @@ class DependencyUtilsTest { assertThat( libProject.repositories.count { it is MavenArtifactRepository && it.url == repositoryURI - } - ) + }) .isEqualTo(2) } @@ -345,15 +332,13 @@ class DependencyUtilsTest { assertThat("com.facebook.react:react-android:0.42.0") .isEqualTo(dependencySubstitutions[0].second) assertThat( - "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210." - ) + "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.") .isEqualTo(dependencySubstitutions[0].third) assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first) assertThat("com.facebook.react:hermes-android:0.42.0") .isEqualTo(dependencySubstitutions[1].second) assertThat( - "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210." - ) + "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.") .isEqualTo(dependencySubstitutions[1].third) } @@ -364,14 +349,12 @@ class DependencyUtilsTest { assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first) assertThat("io.github.test:react-android:0.42.0").isEqualTo(dependencySubstitutions[0].second) assertThat( - "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210." - ) + "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.") .isEqualTo(dependencySubstitutions[0].third) assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first) assertThat("io.github.test:hermes-android:0.42.0").isEqualTo(dependencySubstitutions[1].second) assertThat( - "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210." - ) + "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.") .isEqualTo(dependencySubstitutions[1].third) assertThat("com.facebook.react:react-android").isEqualTo(dependencySubstitutions[2].first) assertThat("io.github.test:react-android:0.42.0").isEqualTo(dependencySubstitutions[2].second) @@ -392,8 +375,7 @@ class DependencyUtilsTest { VERSION_NAME=1000.0.0 ANOTHER_PROPERTY=true """ - .trimIndent() - ) + .trimIndent()) } val versionString = readVersionAndGroupStrings(propertiesFile).first @@ -410,8 +392,7 @@ class DependencyUtilsTest { VERSION_NAME=0.0.0-20221101-2019-cfe811ab1 ANOTHER_PROPERTY=true """ - .trimIndent() - ) + .trimIndent()) } val versionString = readVersionAndGroupStrings(propertiesFile).first @@ -427,8 +408,7 @@ class DependencyUtilsTest { """ ANOTHER_PROPERTY=true """ - .trimIndent() - ) + .trimIndent()) } val versionString = readVersionAndGroupStrings(propertiesFile).first @@ -444,8 +424,7 @@ class DependencyUtilsTest { VERSION_NAME= ANOTHER_PROPERTY=true """ - .trimIndent() - ) + .trimIndent()) } val versionString = readVersionAndGroupStrings(propertiesFile).first @@ -461,8 +440,7 @@ class DependencyUtilsTest { react.internal.publishingGroup=io.github.test ANOTHER_PROPERTY=true """ - .trimIndent() - ) + .trimIndent()) } val groupString = readVersionAndGroupStrings(propertiesFile).second @@ -478,8 +456,7 @@ class DependencyUtilsTest { """ ANOTHER_PROPERTY=true """ - .trimIndent() - ) + .trimIndent()) } val groupString = readVersionAndGroupStrings(propertiesFile).second diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt index 5cf0705be9e..ac20331d262 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt @@ -147,8 +147,7 @@ class PathUtilsTest { tempFolder.newFolder("node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/") val expected = tempFolder.newFile( - "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc" - ) + "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc") assertThat(detectOSAwareHermesCommand(tempFolder.root, "")).isEqualTo(expected.toString()) } @@ -190,8 +189,7 @@ class PathUtilsTest { tempFolder.newFolder("node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/") val expected = tempFolder.newFile( - "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc" - ) + "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc") tempFolder.newFolder("node_modules/react-native/sdks/hermesc/osx-bin/") tempFolder.newFile("node_modules/react-native/sdks/hermesc/osx-bin/hermesc") @@ -205,8 +203,7 @@ class PathUtilsTest { File( tempFolder.root, "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc", - ) - ) + )) } @Test @@ -217,8 +214,7 @@ class PathUtilsTest { File( tempFolder.root, "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc.exe", - ) - ) + )) } @Test @@ -315,8 +311,7 @@ class PathUtilsTest { "codegenConfig": {} } """ - .trimIndent() - ) + .trimIndent()) } val project = ProjectBuilder.builder().withProjectDir(moduleFolder).build() project.plugins.apply("com.android.library") diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt index 81ec6744f00..6c56ca1edea 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt @@ -128,8 +128,7 @@ class ProjectUtilsTest { "codegenConfig": {} } """ - .trimIndent() - ) + .trimIndent()) } extension.root.set(tempFolder.root) assertThat(project.needsCodegenFromPackageJson(extension.root)).isTrue() @@ -147,8 +146,7 @@ class ProjectUtilsTest { "name": "a-library" } """ - .trimIndent() - ) + .trimIndent()) } extension.root.set(tempFolder.root) assertThat(project.needsCodegenFromPackageJson(extension.root)).isFalse() diff --git a/packages/gradle-plugin/settings-plugin/build.gradle.kts b/packages/gradle-plugin/settings-plugin/build.gradle.kts index 2fbeafd502c..eb1971c5cb2 100644 --- a/packages/gradle-plugin/settings-plugin/build.gradle.kts +++ b/packages/gradle-plugin/settings-plugin/build.gradle.kts @@ -58,8 +58,7 @@ tasks.withType().configureEach { // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( - project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false - ) + project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false) } } diff --git a/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt b/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt index bc712bd58b7..b668cae0624 100644 --- a/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt +++ b/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt @@ -158,8 +158,9 @@ abstract class ReactSettingsExtension @Inject constructor(val settings: Settings logger.error(message) if (cacheJsonConfig.length() != 0L) { logger.error( - cacheJsonConfig.readText().substring(0, min(1024, cacheJsonConfig.length().toInt())) - ) + cacheJsonConfig + .readText() + .substring(0, min(1024, cacheJsonConfig.length().toInt()))) } cacheJsonConfig.delete() throw GradleException(message) diff --git a/packages/gradle-plugin/settings-plugin/src/test/kotlin/com/facebook/react/ReactSettingsExtensionTest.kt b/packages/gradle-plugin/settings-plugin/src/test/kotlin/com/facebook/react/ReactSettingsExtensionTest.kt index ee0e9eae45e..dcf1e350469 100644 --- a/packages/gradle-plugin/settings-plugin/src/test/kotlin/com/facebook/react/ReactSettingsExtensionTest.kt +++ b/packages/gradle-plugin/settings-plugin/src/test/kotlin/com/facebook/react/ReactSettingsExtensionTest.kt @@ -29,12 +29,11 @@ class ReactSettingsExtensionTest { val validFile = createJsonFile( """ - { - "value": "¯\\_(ツ)_/¯" - } - """ - .trimIndent() - ) + { + "value": "¯\\_(ツ)_/¯" + } + """ + .trimIndent()) assertThat(computeSha256(validFile)) .isEqualTo("838aa9a72a16fdd55b0d49b510a82e264a30f59333b5fdd97c7798a29146f6a8") } @@ -44,12 +43,11 @@ class ReactSettingsExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0" - } - """ - .trimIndent() - ) + { + "reactNativeVersion": "1000.0.0" + } + """ + .trimIndent()) val map = getLibrariesToAutolink(validJsonFile) assertThat(map.keys).isEmpty() @@ -60,42 +58,41 @@ class ReactSettingsExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", - "version": "0.0.1", - "configurations": [], - "scriptPhases": [] - }, - "android": { - "sourceDir": "./node_modules/@react-native/oss-library-example/android", - "packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;", - "packageInstance": "new OSSLibraryExamplePackage()", - "buildTypes": ["staging", "debug", "release"], - "libraryName": "OSSLibraryExampleSpec", - "componentDescriptors": [ - "SampleNativeComponentComponentDescriptor" - ], - "cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt", - "cxxModuleCMakeListsModuleName": null, - "cxxModuleCMakeListsPath": null, - "cxxModuleHeaderName": null, - "dependencyConfiguration": "implementation", - "isPureCxxDependency": false - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", + "version": "0.0.1", + "configurations": [], + "scriptPhases": [] + }, + "android": { + "sourceDir": "./node_modules/@react-native/oss-library-example/android", + "packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;", + "packageInstance": "new OSSLibraryExamplePackage()", + "buildTypes": ["staging", "debug", "release"], + "libraryName": "OSSLibraryExampleSpec", + "componentDescriptors": [ + "SampleNativeComponentComponentDescriptor" + ], + "cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt", + "cxxModuleCMakeListsModuleName": null, + "cxxModuleCMakeListsPath": null, + "cxxModuleHeaderName": null, + "dependencyConfiguration": "implementation", + "isPureCxxDependency": false } } - """ - .trimIndent() - ) + } + } + } + """ + .trimIndent()) val map = getLibrariesToAutolink(validJsonFile) assertThat(map.keys).containsExactly(":react-native_oss-library-example") @@ -108,26 +105,25 @@ class ReactSettingsExtensionTest { val validJsonFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", - "version": "0.0.1", - "configurations": [], - "scriptPhases": [] - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", + "version": "0.0.1", + "configurations": [], + "scriptPhases": [] } } - """ - .trimIndent() - ) + } + } + } + """ + .trimIndent()) val map = getLibrariesToAutolink(validJsonFile) assertThat(map.keys).isEmpty() @@ -262,8 +258,7 @@ class ReactSettingsExtensionTest { } } """ - .trimIndent() - ) + .trimIndent()) } tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") } val lockfileCollection = project.files("yarn.lock") @@ -316,8 +311,7 @@ class ReactSettingsExtensionTest { } } """ - .trimIndent() - ) + .trimIndent()) } tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") } val lockfileCollection = project.files("yarn.lock") @@ -362,10 +356,9 @@ class ReactSettingsExtensionTest { val invalidConfigFile = createJsonFile( """ - {} - """ - .trimIndent() - ) + {} + """ + .trimIndent()) assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles)) .isTrue() @@ -384,12 +377,11 @@ class ReactSettingsExtensionTest { val invalidConfigFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0" - } - """ - .trimIndent() - ) + { + "reactNativeVersion": "1000.0.0" + } + """ + .trimIndent()) assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles)) .isTrue() @@ -408,13 +400,12 @@ class ReactSettingsExtensionTest { val invalidConfigFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": {} - } - """ - .trimIndent() - ) + { + "reactNativeVersion": "1000.0.0", + "dependencies": {} + } + """ + .trimIndent()) assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles)) .isTrue() @@ -433,26 +424,25 @@ class ReactSettingsExtensionTest { val invalidConfigFile = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", - "version": "0.0.1", - "configurations": [], - "scriptPhases": [] - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", + "version": "0.0.1", + "configurations": [], + "scriptPhases": [] } } - """ - .trimIndent() - ) + } + } + } + """ + .trimIndent()) assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles)) .isTrue() diff --git a/packages/gradle-plugin/shared-testutil/build.gradle.kts b/packages/gradle-plugin/shared-testutil/build.gradle.kts index 26173fb5557..2bc0a1c1ec9 100644 --- a/packages/gradle-plugin/shared-testutil/build.gradle.kts +++ b/packages/gradle-plugin/shared-testutil/build.gradle.kts @@ -31,8 +31,7 @@ tasks.withType().configureEach { // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( - project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false - ) + project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false) } } diff --git a/packages/gradle-plugin/shared/build.gradle.kts b/packages/gradle-plugin/shared/build.gradle.kts index 315984875ad..642ddaec34f 100644 --- a/packages/gradle-plugin/shared/build.gradle.kts +++ b/packages/gradle-plugin/shared/build.gradle.kts @@ -37,8 +37,7 @@ tasks.withType().configureEach { // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( - project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false - ) + project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false) } } diff --git a/packages/gradle-plugin/shared/src/test/kotlin/com/facebook/react/utils/JsonUtilsTest.kt b/packages/gradle-plugin/shared/src/test/kotlin/com/facebook/react/utils/JsonUtilsTest.kt index d741ac1812f..8c718fc4d3d 100644 --- a/packages/gradle-plugin/shared/src/test/kotlin/com/facebook/react/utils/JsonUtilsTest.kt +++ b/packages/gradle-plugin/shared/src/test/kotlin/com/facebook/react/utils/JsonUtilsTest.kt @@ -39,21 +39,20 @@ class JsonUtilsTest { val oldJsonConfig = createJsonFile( """ + { + "name": "yet another npm package", + "codegenConfig": { + "libraries": [ { - "name": "yet another npm package", - "codegenConfig": { - "libraries": [ - { - "name": "an awesome library", - "jsSrcsDir": "../js/", - "android": {} - } - ] - } + "name": "an awesome library", + "jsSrcsDir": "../js/", + "android": {} } - """ - .trimIndent() - ) + ] + } + } + """ + .trimIndent()) val parsed = JsonUtils.fromPackageJson(oldJsonConfig)!! @@ -67,22 +66,21 @@ class JsonUtilsTest { val validJson = createJsonFile( """ - { - "name": "yet another npm package", - "codegenConfig": { - "name": "an awesome library", - "jsSrcsDir": "../js/", - "android": { - "javaPackageName": "com.awesome.library" - }, - "ios": { - "other ios only keys": "which are ignored during parsing" - } - } - } - """ - .trimIndent() - ) + { + "name": "yet another npm package", + "codegenConfig": { + "name": "an awesome library", + "jsSrcsDir": "../js/", + "android": { + "javaPackageName": "com.awesome.library" + }, + "ios": { + "other ios only keys": "which are ignored during parsing" + } + } + } + """ + .trimIndent()) val parsed = JsonUtils.fromPackageJson(validJson)!! @@ -113,12 +111,11 @@ class JsonUtilsTest { val validJson = createJsonFile( """ - { - "version": "1000.0.0" - } - """ - .trimIndent() - ) + { + "version": "1000.0.0" + } + """ + .trimIndent()) val parsed = JsonUtils.fromPackageJson(validJson)!! assertThat("1000.0.0").isEqualTo(parsed.version) @@ -136,12 +133,11 @@ class JsonUtilsTest { val validJson = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0" - } - """ - .trimIndent() - ) + { + "reactNativeVersion": "1000.0.0" + } + """ + .trimIndent()) val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!! assertThat("1000.0.0").isEqualTo(parsed.reactNativeVersion) @@ -152,33 +148,32 @@ class JsonUtilsTest { val validJson = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "project": { - "ios": { - "sourceDir": "./packages/rn-tester", - "xcodeProject": { - "name": "RNTesterPods.xcworkspace", - "isWorkspace": true - }, - "automaticPodsInstallation": false - }, - "android": { - "sourceDir": "./packages/rn-tester", - "appName": "RN-Tester", - "packageName": "com.facebook.react.uiapp", - "applicationId": "com.facebook.react.uiapp", - "mainActivity": ".RNTesterActivity", - "watchModeCommandParams": [ - "--mode HermesDebug" - ], - "dependencyConfiguration": "implementation" - } - } - } - """ - .trimIndent() - ) + { + "reactNativeVersion": "1000.0.0", + "project": { + "ios": { + "sourceDir": "./packages/rn-tester", + "xcodeProject": { + "name": "RNTesterPods.xcworkspace", + "isWorkspace": true + }, + "automaticPodsInstallation": false + }, + "android": { + "sourceDir": "./packages/rn-tester", + "appName": "RN-Tester", + "packageName": "com.facebook.react.uiapp", + "applicationId": "com.facebook.react.uiapp", + "mainActivity": ".RNTesterActivity", + "watchModeCommandParams": [ + "--mode HermesDebug" + ], + "dependencyConfiguration": "implementation" + } + } + } + """ + .trimIndent()) val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!! assertThat("./packages/rn-tester").isEqualTo(parsed.project!!.android!!.sourceDir) @@ -197,37 +192,36 @@ class JsonUtilsTest { val validJson = createJsonFile( """ - - > AwesomeProject@0.0.1 npx - > rnc-cli config - - { - "reactNativeVersion": "1000.0.0", - "project": { - "ios": { - "sourceDir": "./packages/rn-tester", - "xcodeProject": { - "name": "RNTesterPods.xcworkspace", - "isWorkspace": true - }, - "automaticPodsInstallation": false - }, - "android": { - "sourceDir": "./packages/rn-tester", - "appName": "RN-Tester", - "packageName": "com.facebook.react.uiapp", - "applicationId": "com.facebook.react.uiapp", - "mainActivity": ".RNTesterActivity", - "watchModeCommandParams": [ - "--mode HermesDebug" - ], - "dependencyConfiguration": "implementation" - } - } - } - """ - .trimIndent() - ) + + > AwesomeProject@0.0.1 npx + > rnc-cli config + + { + "reactNativeVersion": "1000.0.0", + "project": { + "ios": { + "sourceDir": "./packages/rn-tester", + "xcodeProject": { + "name": "RNTesterPods.xcworkspace", + "isWorkspace": true + }, + "automaticPodsInstallation": false + }, + "android": { + "sourceDir": "./packages/rn-tester", + "appName": "RN-Tester", + "packageName": "com.facebook.react.uiapp", + "applicationId": "com.facebook.react.uiapp", + "mainActivity": ".RNTesterActivity", + "watchModeCommandParams": [ + "--mode HermesDebug" + ], + "dependencyConfiguration": "implementation" + } + } + } + """ + .trimIndent()) val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!! assertThat("./packages/rn-tester").isEqualTo(parsed.project!!.android!!.sourceDir) @@ -245,42 +239,41 @@ class JsonUtilsTest { val validJson = createJsonFile( """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", - "version": "0.0.1", - "configurations": [], - "scriptPhases": [] - }, - "android": { - "sourceDir": "./node_modules/@react-native/oss-library-example/android", - "packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;", - "packageInstance": "new OSSLibraryExamplePackage()", - "buildTypes": ["staging", "debug", "release"], - "libraryName": "OSSLibraryExampleSpec", - "componentDescriptors": [ - "SampleNativeComponentComponentDescriptor" - ], - "cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt", - "cxxModuleCMakeListsModuleName": null, - "cxxModuleCMakeListsPath": null, - "cxxModuleHeaderName": null, - "dependencyConfiguration": "implementation", - "isPureCxxDependency": false - } - } - } + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", + "version": "0.0.1", + "configurations": [], + "scriptPhases": [] + }, + "android": { + "sourceDir": "./node_modules/@react-native/oss-library-example/android", + "packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;", + "packageInstance": "new OSSLibraryExamplePackage()", + "buildTypes": ["staging", "debug", "release"], + "libraryName": "OSSLibraryExampleSpec", + "componentDescriptors": [ + "SampleNativeComponentComponentDescriptor" + ], + "cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt", + "cxxModuleCMakeListsModuleName": null, + "cxxModuleCMakeListsPath": null, + "cxxModuleHeaderName": null, + "dependencyConfiguration": "implementation", + "isPureCxxDependency": false } } - """ - .trimIndent() - ) + } + } + } + """ + .trimIndent()) val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!! assertThat("./node_modules/@react-native/oss-library-example") @@ -294,86 +287,73 @@ class JsonUtilsTest { parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .sourceDir - ) + .sourceDir) assertThat("import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;") .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .packageImportPath - ) + .packageImportPath) assertThat("new OSSLibraryExamplePackage()") .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .packageInstance - ) + .packageInstance) assertThat(listOf("staging", "debug", "release")) .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .buildTypes - ) + .buildTypes) assertThat("OSSLibraryExampleSpec") .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .libraryName - ) + .libraryName) assertThat(listOf("SampleNativeComponentComponentDescriptor")) .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .componentDescriptors - ) + .componentDescriptors) assertThat( - "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt" - ) + "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt") .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .cmakeListsPath - ) + .cmakeListsPath) assertThat( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .cxxModuleHeaderName - ) + .cxxModuleHeaderName) .isNull() assertThat( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .cxxModuleCMakeListsPath - ) + .cxxModuleCMakeListsPath) .isNull() assertThat( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .cxxModuleCMakeListsModuleName - ) + .cxxModuleCMakeListsModuleName) .isNull() assertThat("implementation") .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .dependencyConfiguration - ) + .dependencyConfiguration) assertThat( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .isPureCxxDependency!! - ) + .isPureCxxDependency!!) .isFalse() } diff --git a/packages/react-native/ReactAndroid/build.gradle.kts b/packages/react-native/ReactAndroid/build.gradle.kts index fc96244df45..6cb2f055498 100644 --- a/packages/react-native/ReactAndroid/build.gradle.kts +++ b/packages/react-native/ReactAndroid/build.gradle.kts @@ -108,25 +108,21 @@ val preparePrefab by // react_devtoolsruntimesettings Pair( "../ReactCommon/react/devtoolsruntimesettings/", - "react/devtoolsruntimesettings/", - ), + "react/devtoolsruntimesettings/"), // react_renderer_animations Pair( "../ReactCommon/react/renderer/animations/", - "react/renderer/animations/", - ), + "react/renderer/animations/"), // react_renderer_bridging Pair("../ReactCommon/react/renderer/bridging/", "react/renderer/bridging/"), // react_renderer_componentregistry Pair( "../ReactCommon/react/renderer/componentregistry/", - "react/renderer/componentregistry/", - ), + "react/renderer/componentregistry/"), // react_renderer_consistency Pair( "../ReactCommon/react/renderer/consistency/", - "react/renderer/consistency/", - ), + "react/renderer/consistency/"), // react_renderer_core Pair("../ReactCommon/react/renderer/core/", "react/renderer/core/"), // react_renderer_css @@ -141,8 +137,7 @@ val preparePrefab by // react_renderer_imagemanager Pair( "../ReactCommon/react/renderer/imagemanager/", - "react/renderer/imagemanager/", - ), + "react/renderer/imagemanager/"), Pair("../ReactCommon/react/renderer/imagemanager/platform/cxx/", ""), // react_renderer_mounting Pair("../ReactCommon/react/renderer/mounting/", "react/renderer/mounting/"), @@ -155,45 +150,37 @@ val preparePrefab by // rrc_image Pair( "../ReactCommon/react/renderer/components/image/", - "react/renderer/components/image/", - ), + "react/renderer/components/image/"), // rrc_view Pair( "../ReactCommon/react/renderer/components/view/", - "react/renderer/components/view/", - ), + "react/renderer/components/view/"), Pair("../ReactCommon/react/renderer/components/view/platform/android/", ""), // rrc_root Pair( "../ReactCommon/react/renderer/components/root/", - "react/renderer/components/root/", - ), + "react/renderer/components/root/"), // runtimeexecutor Pair("../ReactCommon/runtimeexecutor/", ""), // react_renderer_textlayoutmanager Pair( "../ReactCommon/react/renderer/textlayoutmanager/", - "react/renderer/textlayoutmanager/", - ), + "react/renderer/textlayoutmanager/"), Pair("../ReactCommon/react/renderer/textlayoutmanager/platform/android/", ""), // rrc_text Pair( "../ReactCommon/react/renderer/components/text/", - "react/renderer/components/text/", - ), + "react/renderer/components/text/"), Pair( "../ReactCommon/react/renderer/attributedstring", - "react/renderer/attributedstring", - ), + "react/renderer/attributedstring"), // rrc_textinput Pair( "../ReactCommon/react/renderer/components/textinput/", - "react/renderer/components/textinput/", - ), + "react/renderer/components/textinput/"), Pair( "../ReactCommon/react/renderer/components/textinput/platform/android/", - "", - ), + ""), // react_newarchdefaults Pair("src/main/jni/react/newarchdefaults", ""), // react_nativemodule_core @@ -210,24 +197,20 @@ val preparePrefab by Pair("../ReactCommon/react/nativemodule/core/platform/android/", ""), Pair( "../ReactCommon/react/renderer/componentregistry/", - "react/renderer/componentregistry/", - ), + "react/renderer/componentregistry/"), Pair( "../ReactCommon/react/renderer/components/root/", - "react/renderer/components/root/", - ), + "react/renderer/components/root/"), Pair("../ReactCommon/react/renderer/core/", "react/renderer/core/"), Pair("../ReactCommon/react/renderer/debug/", "react/renderer/debug/"), Pair( "../ReactCommon/react/renderer/leakchecker/", - "react/renderer/leakchecker/", - ), + "react/renderer/leakchecker/"), Pair("../ReactCommon/react/renderer/mapbuffer/", "react/renderer/mapbuffer/"), Pair("../ReactCommon/react/renderer/mounting/", "react/renderer/mounting/"), Pair( "../ReactCommon/react/renderer/runtimescheduler/", - "react/renderer/runtimescheduler/", - ), + "react/renderer/runtimescheduler/"), Pair("../ReactCommon/react/renderer/scheduler/", "react/renderer/scheduler/"), Pair("../ReactCommon/react/renderer/telemetry/", "react/renderer/telemetry/"), Pair("../ReactCommon/react/renderer/uimanager/", "react/renderer/uimanager/"), @@ -239,32 +222,26 @@ val preparePrefab by // react_performance_timeline Pair( "../ReactCommon/react/performance/timeline/", - "react/performance/timeline/", - ), + "react/performance/timeline/"), // react_performance_cdpmetrics Pair( "../ReactCommon/react/performance/cdpmetrics/", - "react/performance/cdpmetrics/", - ), + "react/performance/cdpmetrics/"), // react_renderer_observers_events Pair( "../ReactCommon/react/renderer/observers/events/", - "react/renderer/observers/events/", - ), + "react/renderer/observers/events/"), // react_timing Pair("../ReactCommon/react/timing/", "react/timing/"), // yoga Pair("../ReactCommon/yoga/", ""), Pair("src/main/jni/first-party/yogajni/jni", ""), - ), - ), + )), PrefabPreprocessingEntry( "hermestooling", // hermes_executor - Pair("../ReactCommon/hermes/inspector-modern/", "hermes/inspector-modern/"), - ), - ) - ) + Pair("../ReactCommon/hermes/inspector-modern/", "hermes/inspector-modern/")), + )) outputDir.set(prefabHeadersDir) } @@ -279,8 +256,7 @@ val downloadBoost by tasks.registering(Download::class) { dependsOn(createNativeDepsDirectories) src( - "https://archives.boost.io/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz" - ) + "https://archives.boost.io/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz") onlyIfModified(true) overwrite(false) retries(5) @@ -303,8 +279,7 @@ val downloadDoubleConversion by tasks.registering(Download::class) { dependsOn(createNativeDepsDirectories) src( - "https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz" - ) + "https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz") onlyIfModified(true) overwrite(false) retries(5) @@ -443,8 +418,7 @@ val buildCodegenCLI by fileTree(codegenDir) { include("lib/**/*.js") include("lib/**/*.js.flow") - } - ) + }) rootProjectName.set(rootProject.name) } @@ -555,8 +529,7 @@ android { "-DANDROID_STL=c++_shared", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", - "-DCMAKE_POLICY_DEFAULT_CMP0069=NEW", - ) + "-DCMAKE_POLICY_DEFAULT_CMP0069=NEW") targets( "reactnative", @@ -581,13 +554,11 @@ android { buildCodegenCLI, "generateCodegenArtifactsFromSchema", prepareNative3pDependencies, - preparePrefab, - ) + preparePrefab) tasks.getByName("generateCodegenSchemaFromJavaScript").dependsOn(buildCodegenCLI) prepareKotlinBuildScriptModel.dependsOn("preBuild") prepareKotlinBuildScriptModel.dependsOn( - ":packages:react-native:ReactAndroid:hermes-engine:preBuild" - ) + ":packages:react-native:ReactAndroid:hermes-engine:preBuild") sourceSets.getByName("main") { res.setSrcDirs( @@ -597,9 +568,7 @@ android { "src/main/res/views/alert", "src/main/res/views/modal", "src/main/res/views/uimanager", - "src/main/res/views/view", - ) - ) + "src/main/res/views/view")) java.exclude("com/facebook/react/processing") java.exclude("com/facebook/react/module/processing") } diff --git a/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts b/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts index 5da626a50af..69814d86625 100644 --- a/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts +++ b/packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts @@ -129,8 +129,7 @@ val installCMake by tasks.registering(CustomExecTask::class) { onlyIfProvidedPathDoesNotExists.set(cmakePath) commandLine( - windowsAwareCommandLine(getSDKManagerPath(), "--install", "cmake;${cmakeVersion}") - ) + windowsAwareCommandLine(getSDKManagerPath(), "--install", "cmake;${cmakeVersion}")) } val configureBuildForHermes by @@ -265,8 +264,7 @@ android { "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True", // We intentionally build Hermes with Intl support only. This is to simplify // the build setup and to avoid overcomplicating the build-type matrix. - "-DHERMES_ENABLE_INTL=True", - ) + "-DHERMES_ENABLE_INTL=True") targets("libhermes") } @@ -304,8 +302,7 @@ android { arguments( "-DCMAKE_BUILD_TYPE=MinSizeRel", // For release builds, we don't want to enable the Hermes Debugger. - "-DHERMES_ENABLE_DEBUGGER=False", - ) + "-DHERMES_ENABLE_DEBUGGER=False") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/BaseReactPackage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/BaseReactPackage.kt index c662ace3c28..097387ff737 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/BaseReactPackage.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/BaseReactPackage.kt @@ -25,8 +25,7 @@ public abstract class BaseReactPackage : ReactPackage { @Deprecated("Migrate to [BaseReactPackage] and implement [getModule] instead.") override fun createNativeModules(reactContext: ReactApplicationContext): List { throw UnsupportedOperationException( - "createNativeModules method is not supported. Use getModule() method instead." - ) + "createNativeModules method is not supported. Use getModule() method instead.") } /** @@ -67,10 +66,8 @@ public abstract class BaseReactPackage : ReactPackage { // This Iterator is used to create the NativeModule registry. The NativeModule // registry must not have TurboModules. Therefore, if TurboModules are enabled, and // the current NativeModule is a TurboModule, we need to skip iterating over it. - if ( - ReactNativeNewArchitectureFeatureFlags.useTurboModules() && - reactModuleInfo.isTurboModule - ) { + if (ReactNativeNewArchitectureFeatureFlags.useTurboModules() && + reactModuleInfo.isTurboModule) { continue } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.kt index 9693326d710..2e0f0b207eb 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.kt @@ -54,8 +54,7 @@ import com.facebook.systrace.Systrace SourceCodeModule::class, TimingModule::class, com.facebook.react.uimanager.UIManagerModule::class, - ] -) + ]) @LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR) @Deprecated( message = "This class is part of Legacy Architecture and will be removed in a future release", @@ -154,8 +153,7 @@ internal class CoreModulesPackage( DeviceInfoModule.NAME -> DeviceInfoModule(reactContext) else -> throw IllegalArgumentException( - "In CoreModulesPackage, could not find Native module for $name" - ) + "In CoreModulesPackage, could not find Native module for $name") } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.kt index b77f83f3211..64e044fe55d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.kt @@ -26,8 +26,7 @@ public class DebugCorePackage public constructor() : lazy(LazyThreadSafetyMode.NONE) { mapOf( DebuggingOverlayManager.REACT_CLASS to - ModuleSpec.viewManagerSpec { DebuggingOverlayManager() } - ) + ModuleSpec.viewManagerSpec { DebuggingOverlayManager() }) } override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.kt index 48202e177a0..dd30369b7e6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.kt @@ -145,8 +145,7 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList invokeStartTask(context, taskConfig) reactHost.removeReactInstanceEventListener(this) } - } - ) + }) reactHost.start() } else { val reactInstanceManager = reactNativeHost.reactInstanceManager @@ -156,8 +155,7 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList invokeStartTask(context, taskConfig) reactInstanceManager.removeReactInstanceEventListener(this) } - } - ) + }) reactInstanceManager.createReactContextInBackground() } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactAndroidHWInputDeviceHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactAndroidHWInputDeviceHelper.kt index 50e8a5b1336..527f9895deb 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactAndroidHWInputDeviceHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactAndroidHWInputDeviceHelper.kt @@ -25,10 +25,8 @@ internal class ReactAndroidHWInputDeviceHelper { fun handleKeyEvent(ev: KeyEvent, context: ReactContext) { val eventKeyCode = ev.keyCode val eventKeyAction = ev.action - if ( - (eventKeyAction == KeyEvent.ACTION_UP || eventKeyAction == KeyEvent.ACTION_DOWN) && - KEY_EVENTS_ACTIONS.containsKey(eventKeyCode) - ) { + if ((eventKeyAction == KeyEvent.ACTION_UP || eventKeyAction == KeyEvent.ACTION_DOWN) && + KEY_EVENTS_ACTIONS.containsKey(eventKeyCode)) { dispatchEvent(context, KEY_EVENTS_ACTIONS[eventKeyCode], lastFocusedViewId, eventKeyAction) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.kt index e7886bf38cf..54ad34249ee 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.kt @@ -59,8 +59,7 @@ public open class ReactDelegate { * used for New Architecture. */ @Deprecated( - "Use one of the other constructors instead to account for New Architecture. Deprecated since 0.75.0" - ) + "Use one of the other constructors instead to account for New Architecture. Deprecated since 0.75.0") public constructor( activity: Activity, reactNativeHost: ReactNativeHost?, @@ -105,14 +104,11 @@ public open class ReactDelegate { private val devSupportManager: DevSupportManager? get() = - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && - reactHost?.devSupportManager != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost?.devSupportManager != null) { reactHost?.devSupportManager - } else if ( - reactNativeHost?.hasInstance() == true && reactNativeHost?.reactInstanceManager != null - ) { + } else if (reactNativeHost?.hasInstance() == true && + reactNativeHost?.reactInstanceManager != null) { reactNativeHost?.reactInstanceManager?.devSupportManager } else { null @@ -121,12 +117,10 @@ public open class ReactDelegate { public fun onHostResume() { if (activity !is DefaultHardwareBackBtnHandler) { throw ClassCastException( - "Host Activity `${activity.javaClass.simpleName}` does not implement DefaultHardwareBackBtnHandler" - ) + "Host Activity `${activity.javaClass.simpleName}` does not implement DefaultHardwareBackBtnHandler") } - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null) { reactHost?.onHostResume(activity, activity as DefaultHardwareBackBtnHandler) } else { if (reactNativeHost?.hasInstance() == true) { @@ -138,9 +132,8 @@ public open class ReactDelegate { } public fun onUserLeaveHint() { - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null) { reactHost?.onHostLeaveHint(activity) } else { if (reactNativeHost?.hasInstance() == true) { @@ -150,9 +143,8 @@ public open class ReactDelegate { } public fun onHostPause() { - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null) { reactHost?.onHostPause(activity) } else { if (reactNativeHost?.hasInstance() == true) { @@ -163,9 +155,8 @@ public open class ReactDelegate { public fun onHostDestroy() { unloadApp() - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null) { reactHost?.onHostDestroy(activity) } else { if (reactNativeHost?.hasInstance() == true) { @@ -175,9 +166,8 @@ public open class ReactDelegate { } public fun onBackPressed(): Boolean { - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null) { reactHost?.onBackPressed() return true } else { @@ -190,9 +180,8 @@ public open class ReactDelegate { } public fun onNewIntent(intent: Intent): Boolean { - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null) { reactHost?.onNewIntent(intent) return true } else { @@ -210,11 +199,9 @@ public open class ReactDelegate { data: Intent?, shouldForwardToReactInstance: Boolean, ) { - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && - reactHost != null && - shouldForwardToReactInstance - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null && + shouldForwardToReactInstance) { reactHost?.onActivityResult(activity, requestCode, resultCode, data) } else { if (reactNativeHost?.hasInstance() == true && shouldForwardToReactInstance) { @@ -226,9 +213,8 @@ public open class ReactDelegate { } public fun onWindowFocusChanged(hasFocus: Boolean) { - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null) { reactHost?.onWindowFocusChange(hasFocus) } else { if (reactNativeHost?.hasInstance() == true) { @@ -238,9 +224,8 @@ public open class ReactDelegate { } public fun onConfigurationChanged(newConfig: Configuration?) { - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null) { reactHost?.onConfigurationChanged(checkNotNull(activity)) } else { if (reactNativeHost?.hasInstance() == true) { @@ -250,13 +235,11 @@ public open class ReactDelegate { } public fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { - if ( - keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD && - ((ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && - reactHost?.devSupportManager != null) || - (reactNativeHost?.hasInstance() == true && - reactNativeHost?.useDeveloperSupport == true)) - ) { + if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD && + ((ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost?.devSupportManager != null) || + (reactNativeHost?.hasInstance() == true && + reactNativeHost?.useDeveloperSupport == true))) { event.startTracking() return true } @@ -265,9 +248,8 @@ public open class ReactDelegate { public fun onKeyLongPress(keyCode: Int): Boolean { if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD || keyCode == KeyEvent.KEYCODE_BACK) { - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && reactHost != null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + reactHost != null) { val devSupportManager = reactHost?.devSupportManager // onKeyLongPress is a Dev API and not supported in RELEASE mode. if (devSupportManager != null && devSupportManager !is ReleaseDevSupportManager) { @@ -275,9 +257,8 @@ public open class ReactDelegate { return true } } else { - if ( - reactNativeHost?.hasInstance() == true && reactNativeHost?.useDeveloperSupport == true - ) { + if (reactNativeHost?.hasInstance() == true && + reactNativeHost?.useDeveloperSupport == true) { reactNativeHost?.reactInstanceManager?.showDevOptionsDialog() return true } @@ -296,10 +277,8 @@ public open class ReactDelegate { reactHost?.reload("ReactDelegate.reload()") } else { runOnUiThread { - if ( - reactNativeHost?.hasInstance() == true && - reactNativeHost?.reactInstanceManager != null - ) { + if (reactNativeHost?.hasInstance() == true && + reactNativeHost?.reactInstanceManager != null) { reactNativeHost?.reactInstanceManager?.recreateReactContextInBackground() } } @@ -410,8 +389,7 @@ public open class ReactDelegate { } @Deprecated( - "Do not access [ReactInstanceManager] directly. This class is going away in the New Architecture. You should use [ReactHost] instead." - ) + "Do not access [ReactInstanceManager] directly. This class is going away in the New Architecture. You should use [ReactHost] instead.") public fun getReactInstanceManager(): ReactInstanceManager { val nonNullReactNativeHost = checkNotNull(reactNativeHost) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.kt index d1b64a19c09..927c1fbc485 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.kt @@ -203,8 +203,7 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity { public fun build(): ReactFragment = newInstance(componentName, launchOptions, fabricEnabled) @Deprecated( - "You should not change call ReactFragment.setFabricEnabled. Instead enable the NewArchitecture for the whole application with newArchEnabled=true in your gradle.properties file" - ) + "You should not change call ReactFragment.setFabricEnabled. Instead enable the NewArchitecture for the whole application with newArchEnabled=true in your gradle.properties file") public fun setFabricEnabled(fabricEnabled: Boolean): Builder { this.fabricEnabled = fabricEnabled return this @@ -217,8 +216,7 @@ public open class ReactFragment : Fragment(), PermissionAwareActivity { protected const val ARG_FABRIC_ENABLED: String = "arg_fabric_enabled" @Deprecated( - "We will remove this and use a different solution for handling Fragment lifecycle events." - ) + "We will remove this and use a different solution for handling Fragment lifecycle events.") protected const val ARG_DISABLE_HOST_LIFECYCLE_EVENTS: String = "arg_disable_host_lifecycle_events" diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.kt index 55ccfbe9bab..f0be7a4d77f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.kt @@ -42,8 +42,7 @@ import com.facebook.react.packagerconnection.RequestHandler @LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR) @Deprecated( message = "This class is part of Legacy Architecture and will be removed in a future release", - level = DeprecationLevel.WARNING, -) + level = DeprecationLevel.WARNING) public class ReactInstanceManagerBuilder { private val packages: MutableList = mutableListOf() private var jsBundleAssetUrl: String? = null diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.kt index 805d065743b..43c5e363b01 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.kt @@ -135,10 +135,8 @@ public abstract class ReactPackageTurboModuleManagerDelegate : TurboModuleManage for (moduleProvider in moduleProviders) { val moduleInfo: ReactModuleInfo? = packageModuleInfos[moduleProvider]?.get(moduleName) - if ( - moduleInfo?.isTurboModule == true && - (resolvedModule == null || moduleInfo.canOverrideExistingModule) - ) { + if (moduleInfo?.isTurboModule == true && + (resolvedModule == null || moduleInfo.canOverrideExistingModule)) { val module = moduleProvider.getModule(moduleName) if (module != null) { resolvedModule = module @@ -184,10 +182,8 @@ public abstract class ReactPackageTurboModuleManagerDelegate : TurboModuleManage for (moduleProvider in moduleProviders) { val moduleInfo: ReactModuleInfo? = packageModuleInfos[moduleProvider]?.get(moduleName) - if ( - moduleInfo?.isTurboModule == false && - (resolvedModule == null || moduleInfo.canOverrideExistingModule) - ) { + if (moduleInfo?.isTurboModule == false && + (resolvedModule == null || moduleInfo.canOverrideExistingModule)) { val module = moduleProvider.getModule(moduleName) if (module != null) { resolvedModule = module diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.kt index 1c3a57cbced..4cb74744844 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.kt @@ -42,8 +42,7 @@ internal class AdditionAnimatedNode( acc + animatedNode.getValue() } else { throw JSApplicationCausedNativeException( - "Illegal node ID set as an input for Animated.Add node" - ) + "Illegal node ID set as an input for Animated.Add node") } }, ) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.kt index 66b7fe4c398..e55fa2435d4 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.kt @@ -35,7 +35,6 @@ internal abstract class AnimationDriver { */ open fun resetConfig(config: ReadableMap) { throw JSApplicationCausedNativeException( - "Animation config for ${javaClass.simpleName} cannot be reset" - ) + "Animation config for ${javaClass.simpleName} cannot be reset") } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.kt index 44c6812a980..99f2d2b60fa 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.kt @@ -40,8 +40,7 @@ internal class DiffClampAnimatedNode( val animatedNode = nativeAnimatedNodesManager.getNodeById(inputNodeTag) if (animatedNode == null || animatedNode !is ValueAnimatedNode) { throw JSApplicationCausedNativeException( - "Illegal node ID set as an input for Animated.DiffClamp node" - ) + "Illegal node ID set as an input for Animated.DiffClamp node") } return animatedNode.getValue() } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.kt index 8611f8b29b1..2fbf7ab1e16 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.kt @@ -39,15 +39,13 @@ internal class DivisionAnimatedNode( nodeValue = v } else if (v == 0.0) { throw JSApplicationCausedNativeException( - "Detected a division by zero in Animated.divide node with Animated ID $tag" - ) + "Detected a division by zero in Animated.divide node with Animated ID $tag") } else { nodeValue /= v } } else { throw JSApplicationCausedNativeException( - "Illegal node ID set as an input for Animated.divide node with Animated ID $tag" - ) + "Illegal node ID set as an input for Animated.divide node with Animated ID $tag") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.kt index 6a4771d5a66..3971db7a502 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.kt @@ -173,8 +173,7 @@ internal class InterpolationAnimatedNode(config: ReadableMap) : ValueAnimatedNod EXTRAPOLATE_TYPE_EXTEND -> {} else -> throw JSApplicationIllegalArgumentException( - "Invalid extrapolation type " + extrapolateLeft + "for left extrapolation" - ) + "Invalid extrapolation type " + extrapolateLeft + "for left extrapolation") } } if (result > inputMax) { @@ -184,8 +183,7 @@ internal class InterpolationAnimatedNode(config: ReadableMap) : ValueAnimatedNod EXTRAPOLATE_TYPE_EXTEND -> {} else -> throw JSApplicationIllegalArgumentException( - "Invalid extrapolation type " + extrapolateRight + "for right extrapolation" - ) + "Invalid extrapolation type " + extrapolateRight + "for right extrapolation") } } if (outputMin == outputMax) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.kt index bb5169e1530..c5a0ed3b39b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.kt @@ -25,8 +25,7 @@ internal class ModulusAnimatedNode( nodeValue = (animatedNodeValue % modulus + modulus) % modulus } else { throw JSApplicationCausedNativeException( - "Illegal node ID set as an input for Animated.modulus node" - ) + "Illegal node ID set as an input for Animated.modulus node") } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.kt index 7a44ba87cfa..9d9694329ca 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.kt @@ -39,8 +39,7 @@ internal class MultiplicationAnimatedNode( animatedNode.getValue() } else { throw JSApplicationCausedNativeException( - "Illegal node ID set as an input for Animated.multiply node" - ) + "Illegal node ID set as an input for Animated.multiply node") } nodeValue *= multiplier } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt index 6c5a505c921..5f0e8ade2a4 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt @@ -311,10 +311,8 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : if (operations.isEmpty && preOperations.isEmpty) { return } - if ( - uiManagerType == UIManagerType.FABRIC || - ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE - ) { + if (uiManagerType == UIManagerType.FABRIC || + ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) { return } @@ -423,8 +421,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : ReactSoftExceptionLogger.logSoftException( NAME, RuntimeException( - "initializeLifecycleEventListenersForViewTag could not get NativeAnimatedNodesManager" - ), + "initializeLifecycleEventListenersForViewTag could not get NativeAnimatedNodesManager"), ) } @@ -469,17 +466,13 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : // If there are ongoing Fabric animations from a previous screen, // and we tear down the current non-Fabric screen, we should expect // the animation mode to switch back - and vice-versa. - if ( - numNonFabricAnimations == 0 && - numFabricAnimations > 0 && - uiManagerType != UIManagerType.FABRIC - ) { + if (numNonFabricAnimations == 0 && + numFabricAnimations > 0 && + uiManagerType != UIManagerType.FABRIC) { uiManagerType = UIManagerType.FABRIC - } else if ( - numFabricAnimations == 0 && - numNonFabricAnimations > 0 && - uiManagerType != UIManagerType.LEGACY - ) { + } else if (numFabricAnimations == 0 && + numNonFabricAnimations > 0 && + uiManagerType != UIManagerType.LEGACY) { uiManagerType = UIManagerType.LEGACY } } @@ -508,8 +501,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.createAnimatedNode(tag, config) } - } - ) + }) } override fun updateAnimatedNodeConfig(tagDouble: Double, config: ReadableMap) { @@ -526,8 +518,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.updateAnimatedNodeConfig(tag, config) } - } - ) + }) } override fun startListeningToAnimatedNodeValue(tagDouble: Double) { @@ -555,8 +546,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.startListeningToAnimatedNodeValue(tag, listener) } - } - ) + }) } override fun stopListeningToAnimatedNodeValue(tagDouble: Double) { @@ -573,8 +563,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.stopListeningToAnimatedNodeValue(tag) } - } - ) + }) } override fun dropAnimatedNode(tagDouble: Double) { @@ -591,8 +580,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.dropAnimatedNode(tag) } - } - ) + }) } override fun setAnimatedNodeValue(tagDouble: Double, value: Double) { @@ -609,8 +597,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.setAnimatedNodeValue(tag, value) } - } - ) + }) } override fun setAnimatedNodeOffset(tagDouble: Double, value: Double) { @@ -627,8 +614,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.setAnimatedNodeOffset(tag, value) } - } - ) + }) } override fun flattenAnimatedNodeOffset(tagDouble: Double) { @@ -645,8 +631,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.flattenAnimatedNodeOffset(tag) } - } - ) + }) } override fun extractAnimatedNodeOffset(tagDouble: Double) { @@ -663,8 +648,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.extractAnimatedNodeOffset(tag) } - } - ) + }) } override fun startAnimatingNode( @@ -692,8 +676,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : endCallback, ) } - } - ) + }) } override fun stopAnimation(animationIdDouble: Double) { @@ -710,8 +693,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.stopAnimation(animationId) } - } - ) + }) } override fun connectAnimatedNodes(parentNodeTagDouble: Double, childNodeTagDouble: Double) { @@ -732,8 +714,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.connectAnimatedNodes(parentNodeTag, childNodeTag) } - } - ) + }) } override fun disconnectAnimatedNodes(parentNodeTagDouble: Double, childNodeTagDouble: Double) { @@ -754,8 +735,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.disconnectAnimatedNodes(parentNodeTag, childNodeTag) } - } - ) + }) } override fun connectAnimatedNodeToView(animatedNodeTagDouble: Double, viewTagDouble: Double) { @@ -781,8 +761,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.connectAnimatedNodeToView(animatedNodeTag, viewTag) } - } - ) + }) } override fun disconnectAnimatedNodeFromView( @@ -808,8 +787,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.disconnectAnimatedNodeFromView(animatedNodeTag, viewTag) } - } - ) + }) } override fun restoreDefaultValues(animatedNodeTagDouble: Double) { @@ -826,8 +804,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.restoreDefaultValues(animatedNodeTag) } - } - ) + }) } override fun addAnimatedEventToView( @@ -856,8 +833,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.addAnimatedEventToView(viewTag, eventName, eventMapping) } - } - ) + }) } override fun removeAnimatedEventFromView( @@ -887,8 +863,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } animatedNodesManager.removeAnimatedEventFromView(viewTag, eventName, animatedValueTag) } - } - ) + }) } override fun addListener(eventName: String) { @@ -906,8 +881,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : override fun execute(animatedNodesManager: NativeAnimatedNodesManager) { animatedNodesManager.getValue(animatedValueNodeTag, callback) } - } - ) + }) } override fun invalidate() { @@ -1107,8 +1081,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) : } } } - } - ) + }) finishOperationBatch() } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.kt index f7237025ab3..638f58c1211 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.kt @@ -103,8 +103,7 @@ public class NativeAnimatedNodesManager( public fun createAnimatedNode(tag: Int, config: ReadableMap) { if (animatedNodes.get(tag) != null) { throw JSApplicationIllegalArgumentException( - "createAnimatedNode: Animated node [$tag] already exists" - ) + "createAnimatedNode: Animated node [$tag] already exists") } val node = when (val type = config.getString("type")) { @@ -134,8 +133,7 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(tag) ?: throw JSApplicationIllegalArgumentException( - "updateAnimatedNode: Animated node [$tag] does not exist" - ) + "updateAnimatedNode: Animated node [$tag] does not exist") if (node is AnimatedNodeWithUpdateableConfig) { stopAnimationsForNode(node) @@ -155,8 +153,7 @@ public class NativeAnimatedNodesManager( val node = animatedNodes[tag] if (node == null || node !is ValueAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("startListeningToAnimatedNodeValue: Animated node [${tag}] does not exist, or is not a 'value' node") - ) + ("startListeningToAnimatedNodeValue: Animated node [${tag}] does not exist, or is not a 'value' node")) } node.setValueListener(listener) } @@ -166,8 +163,7 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(tag) if (node == null || node !is ValueAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("startListeningToAnimatedNodeValue: Animated node [${tag}] does not exist, or is not a 'value' node") - ) + ("startListeningToAnimatedNodeValue: Animated node [${tag}] does not exist, or is not a 'value' node")) } node.setValueListener(null) } @@ -177,8 +173,7 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(tag) if (node == null || node !is ValueAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("setAnimatedNodeValue: Animated node [${tag}] does not exist, or is not a 'value' node") - ) + ("setAnimatedNodeValue: Animated node [${tag}] does not exist, or is not a 'value' node")) } stopAnimationsForNode(node) node.nodeValue = value @@ -190,8 +185,7 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(tag) if (node == null || node !is ValueAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("setAnimatedNodeOffset: Animated node [${tag}] does not exist, or is not a 'value' node") - ) + ("setAnimatedNodeOffset: Animated node [${tag}] does not exist, or is not a 'value' node")) } node.offset = offset updatedNodes.put(tag, node) @@ -202,8 +196,7 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(tag) if (node == null || node !is ValueAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("flattenAnimatedNodeOffset: Animated node [${tag}] does not exist, or is not a 'value' node") - ) + ("flattenAnimatedNodeOffset: Animated node [${tag}] does not exist, or is not a 'value' node")) } node.flattenOffset() } @@ -213,8 +206,7 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(tag) if (node == null || node !is ValueAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("extractAnimatedNodeOffset: Animated node [${tag}] does not exist, or is not a 'value' node") - ) + ("extractAnimatedNodeOffset: Animated node [${tag}] does not exist, or is not a 'value' node")) } node.extractOffset() } @@ -229,12 +221,10 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(animatedNodeTag) ?: throw JSApplicationIllegalArgumentException( - "startAnimatingNode: Animated node [$animatedNodeTag] does not exist" - ) + "startAnimatingNode: Animated node [$animatedNodeTag] does not exist") if (node !is ValueAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("startAnimatingNode: Animated node [${animatedNodeTag}] should be of type ${ValueAnimatedNode::class.java.name}") - ) + ("startAnimatingNode: Animated node [${animatedNodeTag}] should be of type ${ValueAnimatedNode::class.java.name}")) } val existingDriver = activeAnimations[animationId] @@ -252,8 +242,7 @@ public class NativeAnimatedNodesManager( "decay" -> DecayAnimation(animationConfig) else -> { throw JSApplicationIllegalArgumentException( - "startAnimatingNode: Unsupported animation type [$animatedNodeTag]: $type" - ) + "startAnimatingNode: Unsupported animation type [$animatedNodeTag]: $type") } } animation.id = animationId @@ -354,13 +343,11 @@ public class NativeAnimatedNodesManager( val parentNode = animatedNodes.get(parentNodeTag) ?: throw JSApplicationIllegalArgumentException( - ("connectAnimatedNodes: Animated node with tag (parent) [${parentNodeTag}] does not exist") - ) + ("connectAnimatedNodes: Animated node with tag (parent) [${parentNodeTag}] does not exist")) val childNode = animatedNodes.get(childNodeTag) ?: throw JSApplicationIllegalArgumentException( - ("connectAnimatedNodes: Animated node with tag (child) [${childNodeTag}] does not exist") - ) + ("connectAnimatedNodes: Animated node with tag (child) [${childNodeTag}] does not exist")) parentNode.addChild(childNode) updatedNodes.put(childNodeTag, childNode) } @@ -369,13 +356,11 @@ public class NativeAnimatedNodesManager( val parentNode = animatedNodes.get(parentNodeTag) ?: throw JSApplicationIllegalArgumentException( - ("disconnectAnimatedNodes: Animated node with tag (parent) [${parentNodeTag}] does not exist") - ) + ("disconnectAnimatedNodes: Animated node with tag (parent) [${parentNodeTag}] does not exist")) val childNode = animatedNodes.get(childNodeTag) ?: throw JSApplicationIllegalArgumentException( - ("disconnectAnimatedNodes: Animated node with tag (child) [${childNodeTag}] does not exist") - ) + ("disconnectAnimatedNodes: Animated node with tag (child) [${childNodeTag}] does not exist")) parentNode.removeChild(childNode) updatedNodes.put(childNodeTag, childNode) } @@ -385,12 +370,10 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(animatedNodeTag) ?: throw JSApplicationIllegalArgumentException( - ("connectAnimatedNodeToView: Animated node with tag [${animatedNodeTag}] does not exist") - ) + ("connectAnimatedNodeToView: Animated node with tag [${animatedNodeTag}] does not exist")) if (node !is PropsAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("connectAnimatedNodeToView: Animated node connected to view [${viewTag}] should be of type ${PropsAnimatedNode::class.java.name}") - ) + ("connectAnimatedNodeToView: Animated node connected to view [${viewTag}] should be of type ${PropsAnimatedNode::class.java.name}")) } checkNotNull(reactApplicationContext) { ("connectAnimatedNodeToView: Animated node could not be connected, no ReactApplicationContext: $viewTag") @@ -401,8 +384,7 @@ public class NativeAnimatedNodesManager( ReactSoftExceptionLogger.logSoftException( TAG, ReactNoCrashSoftException( - ("connectAnimatedNodeToView: Animated node could not be connected to UIManager - uiManager disappeared for tag: $viewTag") - ), + ("connectAnimatedNodeToView: Animated node could not be connected to UIManager - uiManager disappeared for tag: $viewTag")), ) return } @@ -416,12 +398,10 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(animatedNodeTag) ?: throw JSApplicationIllegalArgumentException( - ("disconnectAnimatedNodeFromView: Animated node with tag [${animatedNodeTag}] does not exist") - ) + ("disconnectAnimatedNodeFromView: Animated node with tag [${animatedNodeTag}] does not exist")) if (node !is PropsAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("disconnectAnimatedNodeFromView: Animated node connected to view [${viewTag}] should be of type ${PropsAnimatedNode::class.java.name}") - ) + ("disconnectAnimatedNodeFromView: Animated node connected to view [${viewTag}] should be of type ${PropsAnimatedNode::class.java.name}")) } node.disconnectFromView(viewTag) } @@ -431,8 +411,7 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(tag) if (node == null || node !is ValueAnimatedNode) { throw JSApplicationIllegalArgumentException( - "getValue: Animated node with tag [$tag] does not exist or is not a 'value' node" - ) + "getValue: Animated node with tag [$tag] does not exist or is not a 'value' node") } val value = node.getValue() if (callback != null) { @@ -463,8 +442,7 @@ public class NativeAnimatedNodesManager( // default values since it will never actually update the view. if (node !is PropsAnimatedNode) { throw JSApplicationIllegalArgumentException( - "Animated node connected to view [?] should be of type ${PropsAnimatedNode::class.java.name}" - ) + "Animated node connected to view [?] should be of type ${PropsAnimatedNode::class.java.name}") } node.restoreDefaultValues() } @@ -479,12 +457,10 @@ public class NativeAnimatedNodesManager( val node = animatedNodes.get(nodeTag) ?: throw JSApplicationIllegalArgumentException( - "addAnimatedEventToView: Animated node with tag [$nodeTag] does not exist" - ) + "addAnimatedEventToView: Animated node with tag [$nodeTag] does not exist") if (node !is ValueAnimatedNode) { throw JSApplicationIllegalArgumentException( - ("addAnimatedEventToView: Animated node on view [${viewTag}] connected to event handler (${eventHandlerName}) should be of type ${ValueAnimatedNode::class.java.name}") - ) + ("addAnimatedEventToView: Animated node on view [${viewTag}] connected to event handler (${eventHandlerName}) should be of type ${ValueAnimatedNode::class.java.name}")) } val path = checkNotNull(eventMapping.getArray("nativeEventPath")) @@ -771,8 +747,7 @@ public class NativeAnimatedNodesManager( val reason = if (cyclesDetected > 0) ("cycles ($cyclesDetected)") else "disconnected regions" val ex = IllegalStateException( - ("Looks like animated nodes graph has ${reason}, there are $activeNodesCount but toposort visited only $updatedNodesCount") - ) + ("Looks like animated nodes graph has ${reason}, there are $activeNodesCount but toposort visited only $updatedNodesCount")) if (eventListenerInitializedForFabric && cyclesDetected == 0) { // TODO T71377544: investigate these SoftExceptions and see if we can remove entirely // or fix the root cause diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/ObjectAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/ObjectAnimatedNode.kt index 015e58fd611..5eb7f2e4006 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/ObjectAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/ObjectAnimatedNode.kt @@ -45,11 +45,9 @@ internal class ObjectAnimatedNode( ReadableType.String -> result.pushString(source.getString(i)) ReadableType.Map -> { val map = source.getMap(i) - if ( - map != null && - map.hasKey(NODE_TAG_KEY) && - map.getType(NODE_TAG_KEY) == ReadableType.Number - ) { + if (map != null && + map.hasKey(NODE_TAG_KEY) && + map.getType(NODE_TAG_KEY) == ReadableType.Number) { val node = nativeAnimatedNodesManager.getNodeById(map.getInt(NODE_TAG_KEY)) requireNotNull(node) { "Mapped value node does not exist" } if (node is ValueAnimatedNode) { @@ -87,11 +85,9 @@ internal class ObjectAnimatedNode( ReadableType.String -> result.putString(propKey, source.getString(propKey)) ReadableType.Map -> { val map = source.getMap(propKey) - if ( - map != null && - map.hasKey(NODE_TAG_KEY) && - map.getType(NODE_TAG_KEY) == ReadableType.Number - ) { + if (map != null && + map.hasKey(NODE_TAG_KEY) && + map.getType(NODE_TAG_KEY) == ReadableType.Number) { val node = nativeAnimatedNodesManager.getNodeById(map.getInt(NODE_TAG_KEY)) requireNotNull(node) { "Mapped value node does not exist" } if (node is ValueAnimatedNode) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.kt index f809458b722..ab21eb434a9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.kt @@ -43,8 +43,7 @@ internal class PropsAnimatedNode( fun connectToView(viewTag: Int, uiManager: UIManager?) { if (connectedViewTag != -1) { throw JSApplicationIllegalArgumentException( - "Animated node $tag is already attached to a view: $connectedViewTag" - ) + "Animated node $tag is already attached to a view: $connectedViewTag") } connectedViewTag = viewTag connectedViewUIManager = uiManager @@ -55,8 +54,7 @@ internal class PropsAnimatedNode( throw JSApplicationIllegalArgumentException( "Attempting to disconnect view that has " + "not been connected with the given animated node: $viewTag " + - "but is connected to view $connectedViewTag" - ) + "but is connected to view $connectedViewTag") } connectedViewTag = -1 } @@ -105,8 +103,7 @@ internal class PropsAnimatedNode( node.collectViewUpdates(key, propMap) } else { throw IllegalArgumentException( - "Unsupported type of node used in property node ${node.javaClass}" - ) + "Unsupported type of node used in property node ${node.javaClass}") } } connectedViewUIManager?.synchronouslyUpdateViewOnUIThread(connectedViewTag, propMap) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.kt index 05bb0611410..2ffacb50b6c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.kt @@ -52,8 +52,7 @@ internal class StyleAnimatedNode( node.collectViewUpdates(key, propsMap) } else { throw IllegalArgumentException( - "Unsupported type of node used in property node ${node.javaClass}" - ) + "Unsupported type of node used in property node ${node.javaClass}") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.kt index 7d8a682fb4d..c56ba98e06b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.kt @@ -42,8 +42,7 @@ internal class SubtractionAnimatedNode( } } else { throw JSApplicationCausedNativeException( - "Illegal node ID set as an input for Animated.subtract node" - ) + "Illegal node ID set as an input for Animated.subtract node") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.kt index f302085b0e6..7943d26b365 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.kt @@ -60,8 +60,7 @@ internal class TransformAnimatedNode( throw IllegalArgumentException( "Unsupported type of node used as a transform child " + "node " + - node.javaClass - ) + node.javaClass) } } else { (transformConfig as StaticTransformConfig).value diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.kt index b5a465bdd1e..9dfdc6eac8e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.kt @@ -75,8 +75,7 @@ public object Arguments { get() = java.lang.reflect.Array.getLength(objects) override fun get(index: Int): Any? = java.lang.reflect.Array.get(objects, index) - } - ) + }) } private fun addEntry(nativeMap: WritableNativeMap, key: String, value: Any?) { @@ -134,8 +133,7 @@ public object Arguments { @Suppress("UNCHECKED_CAST") @JvmStatic @Deprecated( - "Use fromJavaArgs(Array) instead. This method is added only to retain compatibility with Java consumers." - ) + "Use fromJavaArgs(Array) instead. This method is added only to retain compatibility with Java consumers.") public fun fromJavaArgs(args: Any?): WritableNativeArray = fromJavaArgs(args as Array) @JvmStatic diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CallbackImpl.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CallbackImpl.kt index 717c72d09c2..ca493739578 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CallbackImpl.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CallbackImpl.kt @@ -26,8 +26,7 @@ internal class CallbackImpl(private val jsInstance: JSInstance, private val call override fun invoke(vararg args: Any?) { if (invoked) { throw RuntimeException( - "Illegal callback invocation from native module. This callback type only permits a single invocation from native code." - ) + "Illegal callback invocation from native module. This callback type only permits a single invocation from native code.") } @Suppress("UNCHECKED_CAST") jsInstance.invokeCallback(callbackId, Arguments.fromJavaArgs(args as Array)) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.kt index 81ee574dd1d..93a83736237 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.kt @@ -23,8 +23,7 @@ import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHol */ @Deprecated( message = - "This class is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead." -) + "This class is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.") @DoNotStrip @LegacyArchitecture public interface CatalystInstance : MemoryPressureListener, JSInstance, JSBundleLoaderDelegate { @@ -129,19 +128,16 @@ public interface CatalystInstance : MemoryPressureListener, JSInstance, JSBundle @Deprecated( message = - "This method is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead." - ) + "This method is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.") public fun setTurboModuleRegistry(turboModuleRegistry: TurboModuleRegistry) @Deprecated( message = - "This method is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead." - ) + "This method is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.") public fun setFabricUIManager(fabricUIManager: UIManager) @Deprecated( message = - "This method is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead." - ) + "This method is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.") public fun getFabricUIManager(): UIManager? } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.kt index e4ad53e487b..fdff175db97 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.kt @@ -54,8 +54,7 @@ public object ColorPropConverter { val resourcePaths = value.getArray(JSON_KEY) ?: throw JSApplicationCausedNativeException( - "ColorValue: The `$JSON_KEY` must be an array of color resource path strings." - ) + "ColorValue: The `$JSON_KEY` must be an array of color resource path strings.") for (i in 0 until resourcePaths.size()) { val result = resolveResourcePath(context, resourcePaths.getString(i)) @@ -65,8 +64,7 @@ public object ColorPropConverter { } throw JSApplicationCausedNativeException( - "ColorValue: None of the paths in the `$JSON_KEY` array resolved to a color resource." - ) + "ColorValue: None of the paths in the `$JSON_KEY` array resolved to a color resource.") } throw JSApplicationCausedNativeException("ColorValue: the value must be a number or Object.") @@ -103,8 +101,7 @@ public object ColorPropConverter { val resourcePaths = value.getArray(JSON_KEY) ?: throw JSApplicationCausedNativeException( - "ColorValue: The `$JSON_KEY` must be an array of color resource path strings." - ) + "ColorValue: The `$JSON_KEY` must be an array of color resource path strings.") for (i in 0 until resourcePaths.size()) { val result = resolveResourcePath(context, resourcePaths.getString(i)) @@ -114,8 +111,7 @@ public object ColorPropConverter { } throw JSApplicationCausedNativeException( - "ColorValue: None of the paths in the `$JSON_KEY` array resolved to a color resource." - ) + "ColorValue: None of the paths in the `$JSON_KEY` array resolved to a color resource.") } throw JSApplicationCausedNativeException("ColorValue: the value must be a number or Object.") diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.kt index 6e9ec59472f..69118b7dd68 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.kt @@ -33,8 +33,7 @@ protected constructor( } @Deprecated( - "The method canOverrideExistingModule is not used in the New Architecture and will be removed in a future release." - ) + "The method canOverrideExistingModule is not used in the New Architecture and will be removed in a future release.") override fun canOverrideExistingModule(): Boolean = false override fun invalidate() { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/DimensionPropConverter.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/DimensionPropConverter.kt index be2f48bea03..bfaaa3c3c9b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/DimensionPropConverter.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/DimensionPropConverter.kt @@ -20,8 +20,7 @@ internal class DimensionPropConverter { is String -> YogaValue.parse(value) else -> throw JSApplicationCausedNativeException( - "DimensionValue: the value must be a number or string." - ) + "DimensionValue: the value must be a number or string.") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.kt index a5d763772d4..887fd3bee34 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.kt @@ -190,8 +190,7 @@ internal class JavaMethodWrapper( if (jsArgumentsNeeded != parameters.size()) { throw NativeArgumentsParseException( - "$traceName got ${parameters.size()} arguments, expected $jsArgumentsNeeded" - ) + "$traceName got ${parameters.size()} arguments, expected $jsArgumentsNeeded") } var i = 0 diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.kt index 9818ea29334..878492529c8 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.kt @@ -98,8 +98,7 @@ public class JavaOnlyMap() : ReadableMap, WritableMap { value is Dynamic -> value.type else -> { throw IllegalArgumentException( - "Invalid value $value for key $name contained in JavaOnlyMap" - ) + "Invalid value $value for key $name contained in JavaOnlyMap") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModuleRegistry.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModuleRegistry.kt index 6f950585334..4c552e97300 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModuleRegistry.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModuleRegistry.kt @@ -57,8 +57,7 @@ public class JavaScriptModuleRegistry { for (method in moduleInterface.declaredMethods) { if (!methodNames.add(method.name)) { throw AssertionError( - "Method overloading is unsupported: ${moduleInterface.name}#${method.name}" - ) + "Method overloading is unsupported: ${moduleInterface.name}#${method.name}") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt index 9cc64c1119a..7e0013477c9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.kt @@ -43,8 +43,7 @@ public class NativeModuleRegistry( } @get:JvmName( - "getCxxModules" - ) // This is needed till there are Java Consumer of this API inside React + "getCxxModules") // This is needed till there are Java Consumer of this API inside React // Native internal val cxxModules: List get() = buildList { @@ -57,8 +56,7 @@ public class NativeModuleRegistry( /** Adds any new modules to the current module registry */ @JvmName( - "registerModules" - ) // This is needed till there are Java Consumer of this API inside React + "registerModules") // This is needed till there are Java Consumer of this API inside React // Native internal fun registerModules(newRegister: NativeModuleRegistry) { check(reactApplicationContext == newRegister.reactApplicationContext) { @@ -75,8 +73,7 @@ public class NativeModuleRegistry( } @JvmName( - "notifyJSInstanceDestroy" - ) // This is needed till there are Java Consumer of this API inside + "notifyJSInstanceDestroy") // This is needed till there are Java Consumer of this API inside // React Native internal fun notifyJSInstanceDestroy() { reactApplicationContext.assertOnNativeModulesQueueThread() @@ -95,8 +92,7 @@ public class NativeModuleRegistry( internal fun notifyJSInstanceInitialized() { reactApplicationContext.assertOnNativeModulesQueueThread( "From version React Native v0.44, " + - "native modules are explicitly not initialized on the UI thread." - ) + "native modules are explicitly not initialized on the UI thread.") logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_START) beginSection(Systrace.TRACE_TAG_REACT, "NativeModuleRegistry_notifyJSInstanceInitialized") try { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.kt index 7f943654369..c8ff387d34f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.kt @@ -63,8 +63,7 @@ public open class ReadableNativeMap protected constructor() : NativeMap(), Reada private inline fun checkInstance(name: String, instance: Any?, type: Class): T = instance as? T ?: throw UnexpectedNativeTypeException( - "Value for $name cannot be cast from ${instance?.javaClass?.simpleName ?: "NULL"} to ${type.simpleName}" - ) + "Value for $name cannot be cast from ${instance?.javaClass?.simpleName ?: "NULL"} to ${type.simpleName}") private fun getValue(name: String): Any { if (hasKey(name)) { @@ -133,8 +132,7 @@ public open class ReadableNativeMap protected constructor() : NativeMap(), Reada override fun setValue(newValue: Any): Any { throw UnsupportedOperationException( - "Can't set a value while iterating over a ReadableNativeMap" - ) + "Can't set a value while iterating over a ReadableNativeMap") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt index ca81f28d83b..f3b8b34dd84 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt @@ -91,8 +91,7 @@ public object DefaultNewArchitectureEntryPoint { when (releaseLevel) { ReleaseLevel.EXPERIMENTAL -> { ReactNativeFeatureFlags.override( - ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android() - ) + ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android()) } ReleaseLevel.CANARY -> { ReactNativeFeatureFlags.override(ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android()) @@ -103,8 +102,7 @@ public object DefaultNewArchitectureEntryPoint { fabricEnabled, bridgelessEnabled, turboModulesEnabled, - ) - ) + )) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt index bc11a5791a3..9b0082f6b01 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt @@ -191,8 +191,7 @@ public object DefaultReactHost { exceptionHandler: (Exception) -> Unit, bindingsInstaller: BindingsInstaller?, ): ReactHost - """ - ), + """), ) @JvmStatic public fun getDefaultReactHost( @@ -252,8 +251,7 @@ public object DefaultReactHost { useDevSupport: Boolean, cxxReactPackageProviders: List<(ReactContext) -> CxxReactPackage>, ): ReactHost - """ - ), + """), ) @JvmStatic public fun getDefaultReactHost( diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt index f3f4696a32a..72bacc0c1b1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt @@ -43,8 +43,7 @@ protected constructor( DefaultTurboModuleManagerDelegate.Builder() } else { error( - "Overriding isNewArchEnabled to false is not supported anymore since React Native 0.82. Please check your MainApplication.kt file, and remove the override for `isNewArchEnabled`." - ) + "Overriding isNewArchEnabled to false is not supported anymore since React Native 0.82. Please check your MainApplication.kt file, and remove the override for `isNewArchEnabled`.") } override fun getUIManagerProvider(): UIManagerProvider? = @@ -61,12 +60,10 @@ protected constructor( reactInstanceManager.createViewManager(viewManagerName) override fun getViewManagerNames() = reactInstanceManager.viewManagerNames - } - ) + }) } else { ViewManagerRegistry( - reactInstanceManager.getOrCreateViewManagers(reactApplicationContext) - ) + reactInstanceManager.getOrCreateViewManagers(reactApplicationContext)) } FabricUIManagerProviderImpl(componentFactory, viewManagerRegistry) @@ -74,8 +71,7 @@ protected constructor( } } else { error( - "Overriding isNewArchEnabled to false is not supported anymore since React Native 0.82. Please check your MainApplication.kt file, and remove the override for `isNewArchEnabled`." - ) + "Overriding isNewArchEnabled to false is not supported anymore since React Native 0.82. Please check your MainApplication.kt file, and remove the override for `isNewArchEnabled`.") } override fun clear() { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultTurboModuleManagerDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultTurboModuleManagerDelegate.kt index becc5987e78..0b6e09597d6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultTurboModuleManagerDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultTurboModuleManagerDelegate.kt @@ -36,8 +36,7 @@ private constructor( override fun initHybrid(): HybridData { throw UnsupportedOperationException( - "DefaultTurboModuleManagerDelegate.initHybrid() must never be called!" - ) + "DefaultTurboModuleManagerDelegate.initHybrid() must never be called!") } public class Builder : ReactPackageTurboModuleManagerDelegate.Builder() { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.kt index c7b814a4299..1d4a942fa6a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.kt @@ -92,28 +92,23 @@ public class BundleDownloader public constructor(private val client: OkHttpClien object : Callback { override fun onFailure(call: Call, e: IOException) { // ignore callback if call was cancelled - if ( - downloadBundleFromURLCall == null || - downloadBundleFromURLCall?.isCanceled() == true - ) { + if (downloadBundleFromURLCall == null || + downloadBundleFromURLCall?.isCanceled() == true) { downloadBundleFromURLCall = null return } downloadBundleFromURLCall = null val url = call.request().url().toString() callback.onFailure( - makeGeneric(url, "Could not connect to development server.", "URL: $url", e) - ) + makeGeneric(url, "Could not connect to development server.", "URL: $url", e)) } @Throws(IOException::class) override fun onResponse(call: Call, response: Response) { response.use { resp -> // ignore callback if call was cancelled - if ( - downloadBundleFromURLCall == null || - downloadBundleFromURLCall?.isCanceled() == true - ) { + if (downloadBundleFromURLCall == null || + downloadBundleFromURLCall?.isCanceled() == true) { downloadBundleFromURLCall = null return } @@ -151,8 +146,7 @@ public class BundleDownloader public constructor(private val client: OkHttpClien } } } - } - ) + }) } @Throws(IOException::class) @@ -176,9 +170,7 @@ public class BundleDownloader public constructor(private val client: OkHttpClien """ - .trimIndent()) - ) - ) + .trimIndent()))) return } val source = checkNotNull(response.body()?.source()) @@ -212,10 +204,8 @@ public class BundleDownloader public constructor(private val client: OkHttpClien callback, ) } else { - if ( - !headers.containsKey("Content-Type") || - headers["Content-Type"] != "application/json" - ) { + if (!headers.containsKey("Content-Type") || + headers["Content-Type"] != "application/json") { return } @@ -251,8 +241,7 @@ public class BundleDownloader public constructor(private val client: OkHttpClien ) } } - } - ) + }) if (!completed) { callback.onFailure( DebugServerException( @@ -265,9 +254,7 @@ public class BundleDownloader public constructor(private val client: OkHttpClien """ - .trimIndent()) - ) - ) + .trimIndent()))) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.kt index 79f13c0e66e..07656a00def 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.kt @@ -52,8 +52,7 @@ internal class DebugOverlayController(private val reactContext: ReactContext) { windowManager.removeView(fpsDebugViewContainer) fpsDebugViewContainer = null } - } - ) + }) } companion object { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.kt index ad2e4f3ed43..d99e7830c06 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.kt @@ -29,8 +29,7 @@ internal class DefaultDevSupportManagerFactory : DevSupportManagerFactory { "Use the other create() method with useDevSupport parameter for New Architecture. This method will be removed in a future release.", replaceWith = ReplaceWith( - "create(applicationContext, reactInstanceManagerHelper, packagerPathForJSBundleName, enableOnCreate, redBoxHandler, devBundleDownloadListener, minNumShakes, customPackagerCommandHandlers, surfaceDelegateFactory, devLoadingViewManager, pausedInDebuggerOverlayManager)" - ), + "create(applicationContext, reactInstanceManagerHelper, packagerPathForJSBundleName, enableOnCreate, redBoxHandler, devBundleDownloadListener, minNumShakes, customPackagerCommandHandlers, surfaceDelegateFactory, devLoadingViewManager, pausedInDebuggerOverlayManager)"), ) override fun create( applicationContext: Context, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.kt index 89ee299a20a..c6dd8d34a66 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.kt @@ -59,11 +59,9 @@ internal class DevInternalSettings(applicationContext: Context, private val list override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String?) { if (listener != null) { - if ( - PREFS_FPS_DEBUG_KEY == key || - PREFS_JS_DEV_MODE_DEBUG_KEY == key || - PREFS_JS_MINIFY_DEBUG_KEY == key - ) { + if (PREFS_FPS_DEBUG_KEY == key || + PREFS_JS_DEV_MODE_DEBUG_KEY == key || + PREFS_JS_MINIFY_DEBUG_KEY == key) { listener.onInternalSettingsChanged() } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.kt index fb2191c9182..0ae5cd9ea04 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.kt @@ -58,8 +58,7 @@ import okio.Okio * - Genymotion emulator with default settings: 10.0.3.2 */ @SuppressLint( - "StaticFieldLeak" -) // TODO: This entire class should be rewritten to don't use AsyncTask + "StaticFieldLeak") // TODO: This entire class should be rewritten to don't use AsyncTask public open class DevServerHelper( private val settings: DeveloperSettings, private val applicationContext: Context, @@ -362,8 +361,7 @@ public open class DevServerHelper( "http://%s/open-debugger?device=%s", packagerConnectionSettings.debugServerHost, Uri.encode(inspectorDeviceId), - ) - ) + )) if (landingView != null) { requestUrlBuilder.append("&landingView=" + Uri.encode(landingView)) @@ -384,8 +382,7 @@ public open class DevServerHelper( } override fun onResponse(call: Call, response: Response) = Unit - } - ) + }) } private companion object { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt index ac7f03b04f1..b855c4b4289 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt @@ -210,14 +210,11 @@ public abstract class DevSupportManagerBase( return@Supplier null } context - } - ) + }) } - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && - ReactNativeFeatureFlags.perfMonitorV2Enabled() && - perfMonitorOverlayManager == null - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + ReactNativeFeatureFlags.perfMonitorV2Enabled() && + perfMonitorOverlayManager == null) { perfMonitorOverlayManager = PerfMonitorOverlayViewManager( Supplier { @@ -227,8 +224,7 @@ public abstract class DevSupportManagerBase( } context }, - { openDebugger() }, - ) + { openDebugger() }) } } @@ -354,8 +350,7 @@ public abstract class DevSupportManagerBase( val debuggerItemString = applicationContext.getString( if (isConnected) R.string.catalyst_debug_open - else R.string.catalyst_debug_open_disabled - ) + else R.string.catalyst_debug_open_disabled) if (!isConnected) { disabledItemKeys.add(debuggerItemString) } @@ -613,16 +608,14 @@ public abstract class DevSupportManagerBase( applicationContext.getString( R.string.catalyst_loading_from_url, parsedURL.host + ":" + port, - ) - ) + )) devLoadingViewVisible = true } @UiThread protected fun showDevLoadingViewForRemoteJSEnabled() { devLoadingViewManager?.showMessage( - applicationContext.getString(R.string.catalyst_debug_connecting) - ) + applicationContext.getString(R.string.catalyst_debug_connecting)) devLoadingViewVisible = true } @@ -903,10 +896,8 @@ public abstract class DevSupportManagerBase( exported: Boolean, ) { @SuppressLint("UnspecifiedRegisterReceiverFlag") - if ( - Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && - context.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE - ) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && + context.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { context.registerReceiver( receiver, filter, @@ -921,8 +912,7 @@ public abstract class DevSupportManagerBase( devServerHelper.openDebugger( currentReactContext, applicationContext.getString(R.string.catalyst_open_debugger_error), - ChromeDevToolsViewKeys.Performance.value, - ) + ChromeDevToolsViewKeys.Performance.value) } override fun showPausedInDebuggerOverlay( @@ -944,12 +934,7 @@ public abstract class DevSupportManagerBase( ) { perfMonitorOverlayManager?.update( PerfMonitorOverlayManager.PerfMonitorUpdateData( - eventName, - durationMs, - responsivenessScore, - ttl, - ) - ) + eventName, durationMs, responsivenessScore, ttl)) } override fun setAdditionalOptionForPackager(name: String, value: String) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.kt index 9bc293477a9..37c435129c9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.kt @@ -27,8 +27,7 @@ public interface DevSupportManagerFactory { "Use the other create() method with useDevSupport parameter for New Architecture. This method will be removed in a future release.", replaceWith = ReplaceWith( - "create(applicationContext, reactInstanceManagerHelper, packagerPathForJSBundleName, enableOnCreate, redBoxHandler, devBundleDownloadListener, minNumShakes, customPackagerCommandHandlers, surfaceDelegateFactory, devLoadingViewManager, pausedInDebuggerOverlayManager)" - ), + "create(applicationContext, reactInstanceManagerHelper, packagerPathForJSBundleName, enableOnCreate, redBoxHandler, devBundleDownloadListener, minNumShakes, customPackagerCommandHandlers, surfaceDelegateFactory, devLoadingViewManager, pausedInDebuggerOverlayManager)"), ) public fun create( applicationContext: Context, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialogSurfaceDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialogSurfaceDelegate.kt index a173a8b71ab..a600c875fe6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialogSurfaceDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialogSurfaceDelegate.kt @@ -52,8 +52,7 @@ internal class LogBoxDialogSurfaceDelegate(private val devSupportManager: DevSup if (context == null || context.isFinishing) { e( "Unable to launch logbox because react activity " + - "is not available, here is the error that logbox would've displayed: " - ) + "is not available, here is the error that logbox would've displayed: ") return } dialog = LogBoxDialog(context, reactRootView) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.kt index bbb86aa95e6..f7fdd18ff85 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.kt @@ -86,8 +86,7 @@ internal class PackagerStatusCheck { } callback.onPackagerStatusFetched(true) } - } - ) + }) } private companion object { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerfMonitorOverlayViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerfMonitorOverlayViewManager.kt index 3b6c05c2800..5c67c90337d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerfMonitorOverlayViewManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerfMonitorOverlayViewManager.kt @@ -155,8 +155,7 @@ internal class PerfMonitorOverlayViewManager( textSize = TEXT_SIZE_PRIMARY setTextColor(Color.WHITE) typeface = TYPEFACE_BOLD - } - ) + }) buttonInner.addView( TextView(context).apply { text = "cmd + A" @@ -164,8 +163,7 @@ internal class PerfMonitorOverlayViewManager( setTextColor(Color.WHITE) alpha = 0.7f typeface = TYPEFACE_BOLD - } - ) + }) val buttonView = LinearLayout(context).apply { orientation = LinearLayout.VERTICAL diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt index 30440cf10d1..dbbc58453b4 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt @@ -139,8 +139,7 @@ internal class RedBoxContentView( holder.fileView.text = StackTraceHelper.formatFrameSource(frame) holder.methodView.setTextColor(if (frame.isCollapsed) 0xFFAAAAAA.toInt() else Color.WHITE) holder.fileView.setTextColor( - if (frame.isCollapsed) 0xFF808080.toInt() else 0xFFB3B3B3.toInt() - ) + if (frame.isCollapsed) 0xFF808080.toInt() else 0xFFB3B3B3.toInt()) return frameView } } @@ -188,8 +187,7 @@ internal class RedBoxContentView( "methodName" to frame.method, "lineNumber" to frame.line, "column" to frame.column, - ) - ) + )) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialogSurfaceDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialogSurfaceDelegate.kt index 9346cc25412..14c85460308 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialogSurfaceDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialogSurfaceDelegate.kt @@ -155,8 +155,7 @@ internal class RedBoxDialogSurfaceDelegate(private val devSupportManager: DevSup override fun onHostPause() = Unit override fun onHostDestroy() = Unit - } - ) + }) } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.kt index 77c40e2e07b..556115e2e3c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.kt @@ -210,8 +210,7 @@ public object StackTraceHelper { frame.lineNumber?.let { putDouble(LINE_NUMBER_KEY, it.toDouble()) } putString(FILE_KEY, frame.file) putString(METHOD_NAME_KEY, frame.methodName) - } - ) + }) } return JavaOnlyMap().apply { @@ -256,7 +255,6 @@ public object StackTraceHelper { LINE_NUMBER_KEY to line, COLUMN_KEY to column, COLLAPSE_KEY to isCollapsed, - ) - ) + )) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt index a7ba76b09e0..2c4a0e7f4bb 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt @@ -83,7 +83,6 @@ internal object InspectorNetworkHelper { listener.onError(e.message) } } - } - ) + }) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PerfMonitorOverlayManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PerfMonitorOverlayManager.kt index 64cd2c87975..79d7c884720 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PerfMonitorOverlayManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PerfMonitorOverlayManager.kt @@ -13,7 +13,7 @@ internal interface PerfMonitorOverlayManager { val eventName: String, val durationMs: Int, val responsivenessScore: Int, - val ttl: Int, + val ttl: Int ) /** Enable the Perf Monitor overlay. Will be shown when updates are received. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerProviderImpl.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerProviderImpl.kt index 8bcd7e658e0..d5c96183872 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerProviderImpl.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerProviderImpl.kt @@ -69,8 +69,7 @@ public class FabricUIManagerProviderImpl( } else { throw IllegalStateException( "Unable to register FabricUIManager with CatalystInstance, runtimeExecutor and" + - " runtimeScheduler must not be null" - ) + " runtimeScheduler must not be null") } Systrace.endSection(Systrace.TRACE_TAG_REACT) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt index 8069cb17584..d812b4fe59b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt @@ -86,8 +86,7 @@ internal class MountingManager( logSoftException( TAG, IllegalStateException( - "Called startSurface more than once for the SurfaceId [$surfaceId]" - ), + "Called startSurface more than once for the SurfaceId [$surfaceId]"), ) } @@ -159,8 +158,7 @@ internal class MountingManager( fun getSurfaceManagerEnforced(surfaceId: Int, context: String): SurfaceMountingManager = getSurfaceManager(surfaceId) ?: throw RetryableMountingLayerException( - ("Unable to find SurfaceMountingManager for surfaceId: [$surfaceId]. Context: $context") - ) + ("Unable to find SurfaceMountingManager for surfaceId: [$surfaceId]. Context: $context")) fun surfaceIsStopped(surfaceId: Int): Boolean { if (stoppedSurfaceIds.contains(surfaceId)) { @@ -216,8 +214,7 @@ internal class MountingManager( fun getSurfaceManagerForViewEnforced(reactTag: Int): SurfaceMountingManager = getSurfaceManagerForView(reactTag) ?: throw RetryableMountingLayerException( - "Unable to find SurfaceMountingManager for tag: [$reactTag]" - ) + "Unable to find SurfaceMountingManager for tag: [$reactTag]") fun getViewExists(reactTag: Int): Boolean = getSurfaceManagerForView(reactTag) != null diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.kt index 4a87e388dfe..6daff1088d8 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.kt @@ -178,8 +178,7 @@ internal class IntBufferBatchMountItem( } else -> { throw IllegalArgumentException( - "Invalid type argument to IntBufferBatchMountItem: $type at index: $i" - ) + "Invalid type argument to IntBufferBatchMountItem: $type at index: $i") } } } @@ -218,8 +217,7 @@ internal class IntBufferBatchMountItem( intBuffer[i++], intBuffer[i++], fabricComponentName, - ) - ) + )) } INSTRUCTION_DELETE -> s.append(String.format(Locale.ROOT, "DELETE [%d]\n", intBuffer[i++])) @@ -231,8 +229,7 @@ internal class IntBufferBatchMountItem( intBuffer[i++], intBuffer[i++], intBuffer[i++], - ) - ) + )) INSTRUCTION_REMOVE -> s.append( String.format( @@ -241,16 +238,15 @@ internal class IntBufferBatchMountItem( intBuffer[i++], intBuffer[i++], intBuffer[i++], - ) - ) + )) INSTRUCTION_UPDATE_PROPS -> { val props = objBuffer[j++] val propsString = if (FabricUIManager.IS_DEVELOPMENT_ENVIRONMENT) (props?.toString() ?: "") else "" s.append( - String.format(Locale.ROOT, "UPDATE PROPS [%d]: %s\n", intBuffer[i++], propsString) - ) + String.format( + Locale.ROOT, "UPDATE PROPS [%d]: %s\n", intBuffer[i++], propsString)) } INSTRUCTION_UPDATE_STATE -> { val state: StateWrapper? = objBuffer[j++] as StateWrapper? @@ -258,8 +254,8 @@ internal class IntBufferBatchMountItem( if (FabricUIManager.IS_DEVELOPMENT_ENVIRONMENT) (state?.toString() ?: "") else "" s.append( - String.format(Locale.ROOT, "UPDATE STATE [%d]: %s\n", intBuffer[i++], stateString) - ) + String.format( + Locale.ROOT, "UPDATE STATE [%d]: %s\n", intBuffer[i++], stateString)) } INSTRUCTION_UPDATE_LAYOUT -> s.append( @@ -275,8 +271,7 @@ internal class IntBufferBatchMountItem( intBuffer[i++], intBuffer[i++], intBuffer[i++], - ) - ) + )) INSTRUCTION_UPDATE_PADDING -> s.append( String.format( @@ -287,8 +282,7 @@ internal class IntBufferBatchMountItem( intBuffer[i++], intBuffer[i++], intBuffer[i++], - ) - ) + )) INSTRUCTION_UPDATE_OVERFLOW_INSET -> s.append( String.format( @@ -299,8 +293,7 @@ internal class IntBufferBatchMountItem( intBuffer[i++], intBuffer[i++], intBuffer[i++], - ) - ) + )) INSTRUCTION_UPDATE_EVENT_EMITTER -> { j += 1 s.append(String.format(Locale.ROOT, "UPDATE EVENTEMITTER [%d]\n", intBuffer[i++])) @@ -308,8 +301,7 @@ internal class IntBufferBatchMountItem( else -> { FLog.e(TAG, "String so far: $s") throw IllegalArgumentException( - "Invalid type argument to IntBufferBatchMountItem: $type at index: $i" - ) + "Invalid type argument to IntBufferBatchMountItem: $type at index: $i") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/interop/InteropEventEmitter.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/interop/InteropEventEmitter.kt index 3cc4cba393e..98d1b15099f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/interop/InteropEventEmitter.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/interop/InteropEventEmitter.kt @@ -50,8 +50,7 @@ internal class InteropEventEmitter(private val reactContext: ReactContext) : RCT changedIndices: WritableArray, ) { throw UnsupportedOperationException( - "EventEmitter#receiveTouches is not supported by the Fabric Interop Layer" - ) + "EventEmitter#receiveTouches is not supported by the Fabric Interop Layer") } @VisibleForTesting diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleInteropUtils.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleInteropUtils.kt index fb8bfdc2c22..c2139e58e75 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleInteropUtils.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleInteropUtils.kt @@ -56,11 +56,9 @@ internal object TurboModuleInteropUtils { if (returnType != MutableMap::class.java) { throw ParsingException(moduleName, "getConstants must return a Map") } - } else if ( - (annotation != null) && - ((annotation.isBlockingSynchronousMethod && returnType == Void.TYPE) || - (!annotation.isBlockingSynchronousMethod && returnType != Void.TYPE)) - ) { + } else if ((annotation != null) && + ((annotation.isBlockingSynchronousMethod && returnType == Void.TYPE) || + (!annotation.isBlockingSynchronousMethod && returnType != Void.TYPE))) { throw ParsingException( moduleName, "TurboModule system assumes returnType == void iff the method is synchronous.", @@ -73,8 +71,7 @@ internal object TurboModuleInteropUtils { createJniSignature(moduleName, methodName, paramClasses, returnType), createJSIReturnKind(moduleName, methodName, paramClasses, returnType), getJsArgCount(moduleName, methodName, paramClasses), - ) - ) + )) } return methodDescriptors @@ -128,18 +125,16 @@ internal object TurboModuleInteropUtils { return "F" } - if ( - paramClass == Boolean::class.javaObjectType || - paramClass == Int::class.javaObjectType || - paramClass == Double::class.javaObjectType || - paramClass == Float::class.javaObjectType || - paramClass == String::class.java || - paramClass == Callback::class.java || - paramClass == Promise::class.java || - paramClass == ReadableMap::class.java || - paramClass == ReadableArray::class.java || - paramClass == Dynamic::class.java - ) { + if (paramClass == Boolean::class.javaObjectType || + paramClass == Int::class.javaObjectType || + paramClass == Double::class.javaObjectType || + paramClass == Float::class.javaObjectType || + paramClass == String::class.java || + paramClass == Callback::class.java || + paramClass == Promise::class.java || + paramClass == ReadableMap::class.java || + paramClass == ReadableArray::class.java || + paramClass == Dynamic::class.java) { return convertClassToJniType(paramClass) } @@ -175,16 +170,14 @@ internal object TurboModuleInteropUtils { return "V" } - if ( - returnClass == Boolean::class.javaObjectType || - returnClass == Integer::class.javaObjectType || - returnClass == Double::class.javaObjectType || - returnClass == Float::class.javaObjectType || - returnClass == String::class.java || - returnClass == WritableMap::class.java || - returnClass == WritableArray::class.java || - returnClass == MutableMap::class.java - ) { + if (returnClass == Boolean::class.javaObjectType || + returnClass == Integer::class.javaObjectType || + returnClass == Double::class.javaObjectType || + returnClass == Float::class.javaObjectType || + returnClass == String::class.java || + returnClass == WritableMap::class.java || + returnClass == WritableArray::class.java || + returnClass == MutableMap::class.java) { return convertClassToJniType(returnClass) } @@ -247,21 +240,17 @@ internal object TurboModuleInteropUtils { i += 1 } - if ( - returnClass == Boolean::class.javaPrimitiveType || - returnClass == Boolean::class.javaObjectType - ) { + if (returnClass == Boolean::class.javaPrimitiveType || + returnClass == Boolean::class.javaObjectType) { return "BooleanKind" } - if ( - returnClass == Double::class.javaPrimitiveType || - returnClass == Double::class.javaObjectType || - returnClass == Float::class.javaPrimitiveType || - returnClass == Float::class.javaObjectType || - returnClass == Int::class.javaPrimitiveType || - returnClass == Int::class.javaObjectType - ) { + if (returnClass == Double::class.javaPrimitiveType || + returnClass == Double::class.javaObjectType || + returnClass == Float::class.javaPrimitiveType || + returnClass == Float::class.javaObjectType || + returnClass == Int::class.javaPrimitiveType || + returnClass == Int::class.javaObjectType) { return "NumberKind" } @@ -300,15 +289,13 @@ internal object TurboModuleInteropUtils { moduleName: String, message: String, ) : super( - ("Unable to parse @ReactMethod annotations from native module: ${moduleName}. Details: ${message}") - ) + ("Unable to parse @ReactMethod annotations from native module: ${moduleName}. Details: ${message}")) constructor( moduleName: String, methodName: String, message: String, ) : super( - ("Unable to parse @ReactMethod annotation from native module method: ${moduleName}.${methodName}(). Details: ${message}") - ) + ("Unable to parse @ReactMethod annotation from native module method: ${moduleName}.${methodName}(). Details: ${message}")) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.kt index faad9b4df7c..d45ab53ee37 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.kt @@ -76,10 +76,9 @@ public class HeadlessJsTaskContext private constructor(reactContext: ReactContex ) check( !(reactContext.lifecycleState == LifecycleState.RESUMED && - !taskConfig.isAllowedInForeground) - ) { - "Tried to start task ${taskConfig.taskKey} while in foreground, but this is not allowed." - } + !taskConfig.isAllowedInForeground)) { + "Tried to start task ${taskConfig.taskKey} while in foreground, but this is not allowed." + } activeTasks.add(taskId) activeTaskConfigs[taskId] = HeadlessJsTaskConfig(taskConfig) if (reactContext.hasActiveReactInstance()) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModule.kt index fa2a0b294ec..615d6226c65 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModule.kt @@ -31,8 +31,7 @@ public annotation class ReactModule( */ @get:Deprecated( """This property is unused and it's planning to be removed in a future version of - React Native. Please refrain from using it.""" - ) + React Native. Please refrain from using it.""") public val hasConstants: Boolean = true, /** * Indicates if a module is a C++ module or a Java Module diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.kt index 708c8957f07..2394271a4a0 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.kt @@ -27,8 +27,7 @@ public class ReactModuleInfo( replaceWith = ReplaceWith( expression = - "ReactModuleInfo(name, className, canOverrideExistingModule, needsEagerInit, isCxxModule, isTurboModule)" - ), + "ReactModuleInfo(name, className, canOverrideExistingModule, needsEagerInit, isCxxModule, isTurboModule)"), level = DeprecationLevel.WARNING, ) public constructor( diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.kt index e525c620ca9..7958bb6b118 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.kt @@ -241,8 +241,7 @@ internal class AccessibilityInfoModule(context: ReactApplicationContext) : override fun onHostResume() { accessibilityManager?.addTouchExplorationStateChangeListener( - touchExplorationStateChangeListener - ) + touchExplorationStateChangeListener) accessibilityManager?.addAccessibilityStateChangeListener(accessibilityServiceChangeListener) val transitionUri = Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE) contentResolver.registerContentObserver(transitionUri, false, animationScaleObserver) @@ -250,8 +249,7 @@ internal class AccessibilityInfoModule(context: ReactApplicationContext) : Settings.Secure.getUriFor(ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED_CONSTANT) contentResolver.registerContentObserver(highTextContrastUri, false, highTextContrastObserver) updateAndSendTouchExplorationChangeEvent( - accessibilityManager?.isTouchExplorationEnabled == true - ) + accessibilityManager?.isTouchExplorationEnabled == true) updateAndSendAccessibilityServiceChangeEvent(accessibilityManager?.isEnabled == true) updateAndSendReduceMotionChangeEvent() updateAndSendHighTextContrastChangeEvent() @@ -261,8 +259,7 @@ internal class AccessibilityInfoModule(context: ReactApplicationContext) : override fun onHostPause() { accessibilityManager?.removeTouchExplorationStateChangeListener( - touchExplorationStateChangeListener - ) + touchExplorationStateChangeListener) accessibilityManager?.removeAccessibilityStateChangeListener(accessibilityServiceChangeListener) contentResolver.unregisterContentObserver(animationScaleObserver) contentResolver.unregisterContentObserver(highTextContrastObserver) @@ -271,8 +268,7 @@ internal class AccessibilityInfoModule(context: ReactApplicationContext) : override fun initialize() { reactApplicationContext.addLifecycleEventListener(this) updateAndSendTouchExplorationChangeEvent( - accessibilityManager?.isTouchExplorationEnabled == true - ) + accessibilityManager?.isTouchExplorationEnabled == true) updateAndSendAccessibilityServiceChangeEvent(accessibilityManager?.isEnabled == true) updateAndSendReduceMotionChangeEvent() updateAndSendHighTextContrastChangeEvent() diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.kt index 3718d046326..576babdccce 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.kt @@ -106,8 +106,7 @@ public class BlobModule(reactContext: ReactApplicationContext) : val blob = checkNotNull(map.getMap("blob")) val bytes = checkNotNull( - resolve(blob.getString("blobId"), blob.getInt("offset"), blob.getInt("size")) - ) + resolve(blob.getString("blobId"), blob.getInt("offset"), blob.getInt("size"))) return RequestBody.create(MediaType.parse(type), bytes) } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt index b9445960927..3d171a28213 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt @@ -209,8 +209,7 @@ public open class JavaTimerManager( if (driftTime > 60000) { javaScriptTimerExecutor.emitTimeDriftWarning( "Debugger and device times have drifted by more than 60s. Please correct this by " + - "running adb shell \"date `date +%m%d%H%M%Y.%S`\" on your debugger machine." - ) + "running adb shell \"date `date +%m%d%H%M%Y.%S`\" on your debugger machine.") } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.kt index 10ab8c2ca54..a680a588cc9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.kt @@ -6,8 +6,7 @@ */ @file:Suppress( - "DEPRECATION" -) // Suppressing deprecation of NotThreadSafeViewHierarchyUpdateDebugListener + "DEPRECATION") // Suppressing deprecation of NotThreadSafeViewHierarchyUpdateDebugListener package com.facebook.react.modules.debug diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.kt index 8fd2bd42291..b190481ee0b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.kt @@ -87,8 +87,7 @@ internal class FpsDebugFrameCallback(private val reactContext: ReactContext) : reactContext.getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java) if (!reactContext.isBridgeless) { reactContext.catalystInstance.removeBridgeIdleDebugListener( - didJSUpdateUiDuringFrameDetector - ) + didJSUpdateUiDuringFrameDetector) } uiManagerModule?.setViewHierarchyUpdateDebugListener(null) } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.kt index e958038e97b..e1fcd77539c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.kt @@ -24,8 +24,7 @@ public class SourceCodeModule(reactContext: ReactApplicationContext) : Assertions.assertNotNull( reactApplicationContext.getSourceURL(), "No source URL loaded, have you initialised the instance?", - ) - ) + )) public companion object { public const val NAME: String = NativeSourceCodeSpec.NAME diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.kt index 9c3a0a625d3..214e479fc2d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.kt @@ -69,8 +69,7 @@ internal class DeviceInfoModule(reactContext: ReactApplicationContext) : ReactSoftExceptionLogger.logSoftException( NativeDeviceInfoSpec.NAME, ReactNoCrashSoftException( - "No active CatalystInstance, cannot emitUpdateDimensionsEvent" - ), + "No active CatalystInstance, cannot emitUpdateDimensionsEvent"), ) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/AlertFragment.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/AlertFragment.kt index 5df5c26cb3e..65c5791cf9a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/AlertFragment.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/AlertFragment.kt @@ -105,8 +105,7 @@ public class AlertFragment : DialogFragment, DialogInterface.OnClickListener { val accessibleTitle: TextView = Assertions.assertNotNull( - titleContainer.findViewById(R.id.alert_title) - ) + titleContainer.findViewById(R.id.alert_title)) accessibleTitle.text = titleText accessibleTitle.isFocusable = true diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.kt index 86a78386e84..f98f4b2d5b2 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.kt @@ -98,8 +98,7 @@ public class I18nUtil private constructor() { ReplaceWith("instance"), ) @JvmName( - "DEPRECATED\$getInstance" - ) // We intentionally don't want to expose this accessor to Java. + "DEPRECATED\$getInstance") // We intentionally don't want to expose this accessor to Java. public fun getInstance(): I18nUtil = instance } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.kt index 0288966c6fa..211e258343d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.kt @@ -58,10 +58,8 @@ public open class IntentModule(reactContext: ReactApplicationContext) : val uri = intent.data val initialURL = - if ( - uri != null && - (Intent.ACTION_VIEW == action || NfcAdapter.ACTION_NDEF_DISCOVERED == action) - ) { + if (uri != null && + (Intent.ACTION_VIEW == action || NfcAdapter.ACTION_NDEF_DISCOVERED == action)) { uri.toString() } else { null @@ -70,8 +68,7 @@ public open class IntentModule(reactContext: ReactApplicationContext) : promise.resolve(initialURL) } catch (e: Exception) { promise.reject( - JSApplicationIllegalArgumentException("Could not get the initial URL : ${e.message}") - ) + JSApplicationIllegalArgumentException("Could not get the initial URL : ${e.message}")) } } @@ -123,8 +120,7 @@ public open class IntentModule(reactContext: ReactApplicationContext) : promise.resolve(true) } catch (e: Exception) { promise.reject( - JSApplicationIllegalArgumentException("Could not open URL '${url}': ${e.message}") - ) + JSApplicationIllegalArgumentException("Could not open URL '${url}': ${e.message}")) } } @@ -151,9 +147,7 @@ public open class IntentModule(reactContext: ReactApplicationContext) : } catch (e: Exception) { promise.reject( JSApplicationIllegalArgumentException( - "Could not check if URL '${url}' can be opened: ${e.message}" - ) - ) + "Could not check if URL '${url}' can be opened: ${e.message}")) } } @@ -179,8 +173,7 @@ public open class IntentModule(reactContext: ReactApplicationContext) : promise.resolve(true) } catch (e: Exception) { promise.reject( - JSApplicationIllegalArgumentException("Could not open the Settings: ${e.message}") - ) + JSApplicationIllegalArgumentException("Could not open the Settings: ${e.message}")) } } @@ -205,8 +198,7 @@ public open class IntentModule(reactContext: ReactApplicationContext) : val packageManager = reactApplicationContext.packageManager if (packageManager == null || intent.resolveActivity(packageManager) == null) { promise.reject( - JSApplicationIllegalArgumentException("Could not launch Intent with action $action.") - ) + JSApplicationIllegalArgumentException("Could not launch Intent with action $action.")) return } @@ -233,8 +225,7 @@ public open class IntentModule(reactContext: ReactApplicationContext) : } else -> { promise.reject( - JSApplicationIllegalArgumentException("Extra type for $name not supported.") - ) + JSApplicationIllegalArgumentException("Extra type for $name not supported.")) return } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.kt index 9f5e964423e..9b6c20069d9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.kt @@ -164,8 +164,7 @@ public class NetworkingModule( @Deprecated( """To be removed in a future release. See - https://github.com/facebook/react-native/pull/37798#pullrequestreview-1518338914""" - ) + https://github.com/facebook/react-native/pull/37798#pullrequestreview-1518338914""") public interface CustomClientBuilder : com.facebook.react.modules.network.CustomClientBuilder override fun initialize() { @@ -670,8 +669,7 @@ public class NetworkingModule( NetworkEventUtil.onRequestError(reactApplicationContext, requestId, e.message, e) } } - } - ) + }) } private fun wrapRequestBodyWithProgressEmitter( @@ -832,16 +830,13 @@ public class NetworkingModule( headers = headers.newBuilder().removeAll(CONTENT_TYPE_HEADER_NAME).build() } - if ( - bodyPart.hasKey(REQUEST_BODY_KEY_STRING) && - bodyPart.getString(REQUEST_BODY_KEY_STRING) != null - ) { + if (bodyPart.hasKey(REQUEST_BODY_KEY_STRING) && + bodyPart.getString(REQUEST_BODY_KEY_STRING) != null) { val bodyValue = bodyPart.getString(REQUEST_BODY_KEY_STRING).orEmpty() @Suppress("DEPRECATION") multipartBuilder.addPart(headers, RequestBody.create(partContentType, bodyValue)) - } else if ( - bodyPart.hasKey(REQUEST_BODY_KEY_URI) && bodyPart.getString(REQUEST_BODY_KEY_URI) != null - ) { + } else if (bodyPart.hasKey(REQUEST_BODY_KEY_URI) && + bodyPart.getString(REQUEST_BODY_KEY_URI) != null) { if (partContentType == null) { NetworkEventUtil.onRequestError( reactApplicationContext, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.kt index df98bd7eefc..2ff81dc3a76 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.kt @@ -75,7 +75,6 @@ internal class ProgressRequestBody( val contentLength = contentLength() progressListener.onProgress(bytesWritten, contentLength, bytesWritten == contentLength) } - } - ) + }) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt index 1e773ba83d6..6c0c986e0aa 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt @@ -80,8 +80,7 @@ internal class StatusBarModule(reactContext: ReactApplicationContext?) : window.statusBarColor = color } } - } - ) + }) } override fun setTranslucent(translucent: Boolean) { @@ -105,8 +104,7 @@ internal class StatusBarModule(reactContext: ReactApplicationContext?) : override fun runGuarded() { activity.window?.setStatusBarTranslucency(translucent) } - } - ) + }) } override fun setHidden(hidden: Boolean) { @@ -159,8 +157,7 @@ internal class StatusBarModule(reactContext: ReactApplicationContext?) : } decorView.systemUiVisibility = systemUiVisibilityFlags } - } - ) + }) } companion object { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/FileIoHandler.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/FileIoHandler.kt index 60d9f05fa38..475ee0e09e2 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/FileIoHandler.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/FileIoHandler.kt @@ -56,8 +56,7 @@ public class FileIoHandler : Runnable { val paramsObj = params as JSONObject? ?: throw Exception( - "params must be an object { mode: string, filename: string }" - ) + "params must be an object { mode: string, filename: string }") val mode = paramsObj.optString("mode") ?: throw Exception("missing params.mode") val filename = paramsObj.optString("filename") ?: throw Exception("missing params.filename") @@ -99,8 +98,7 @@ public class FileIoHandler : Runnable { val paramsObj = params as JSONObject? ?: throw Exception( - "params must be an object { file: handle, size: number }" - ) + "params must be an object { file: handle, size: number }") val file = paramsObj.optInt("file") if (file == 0) { throw Exception("invalid or missing file handle") diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessAtomicRef.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessAtomicRef.kt index 00287d87963..5e0c35404b1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessAtomicRef.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessAtomicRef.kt @@ -41,8 +41,7 @@ internal class BridgelessAtomicRef( } if (state == State.Failure) { throw RuntimeException( - "BridgelessAtomicRef: Failed to create object. Reason: $failureMessage" - ) + "BridgelessAtomicRef: Failed to create object. Reason: $failureMessage") } if (state != State.Creating) { state = State.Creating @@ -88,8 +87,7 @@ internal class BridgelessAtomicRef( if (state == State.Failure) { throw RuntimeException( - "BridgelessAtomicRef: Failed to create object. Reason: $failureMessage" - ) + "BridgelessAtomicRef: Failed to create object. Reason: $failureMessage") } return get() } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt index d70ec496050..e36f0cf9b34 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt @@ -35,8 +35,7 @@ import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHol @Deprecated( message = - "This class is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead." -) + "This class is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.") @LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR) @FrameworkAPI internal class BridgelessCatalystInstance(private val reactHost: ReactHostImpl) : CatalystInstance { @@ -109,8 +108,7 @@ internal class BridgelessCatalystInstance(private val reactHost: ReactHostImpl) override val nativeMethodCallInvokerHolder: NativeMethodCallInvokerHolder get() = throw UnsupportedOperationException( - "Unimplemented method 'getNativeMethodCallInvokerHolder'" - ) + "Unimplemented method 'getNativeMethodCallInvokerHolder'") override fun hasNativeModule(nativeModuleInterface: Class): Boolean = reactHost.hasNativeModule(nativeModuleInterface) @@ -159,24 +157,21 @@ internal class BridgelessCatalystInstance(private val reactHost: ReactHostImpl) @Deprecated( message = - "This class is deprecated, please migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead." - ) + "This class is deprecated, please migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.") override fun setTurboModuleRegistry(turboModuleRegistry: TurboModuleRegistry) { throw UnsupportedOperationException("Unimplemented method 'setTurboModuleRegistry'") } @Deprecated( message = - "This class is deprecated, please migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead." - ) + "This class is deprecated, please migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.") override fun setFabricUIManager(fabricUIManager: UIManager) { throw UnsupportedOperationException("Unimplemented method 'setFabricUIManager'") } @Deprecated( message = - "This class is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead." - ) + "This class is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.") override fun getFabricUIManager(): UIManager { throw UnsupportedOperationException("Unimplemented method 'getFabricUIManager'") } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.kt index 045d0e7a05a..c0eb0cd6d7e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.kt @@ -67,8 +67,7 @@ internal class BridgelessReactContext(context: Context, private val reactHost: R override fun getCatalystInstance(): CatalystInstance { if (ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) { throw UnsupportedOperationException( - "CatalystInstance is not supported when Bridgeless mode is enabled." - ) + "CatalystInstance is not supported when Bridgeless mode is enabled.") } Log.w( TAG, @@ -79,16 +78,14 @@ internal class BridgelessReactContext(context: Context, private val reactHost: R } @Deprecated( - "This API has been deprecated due to naming consideration, please use hasActiveReactInstance() instead" - ) + "This API has been deprecated due to naming consideration, please use hasActiveReactInstance() instead") override fun hasActiveCatalystInstance(): Boolean = hasActiveReactInstance() @Deprecated("DO NOT USE, this method will be removed in the near future.") override fun isBridgeless(): Boolean = true @Deprecated( - "This API has been deprecated due to naming consideration, please use hasReactInstance() instead" - ) + "This API has been deprecated due to naming consideration, please use hasReactInstance() instead") override fun hasCatalystInstance(): Boolean = false override fun hasActiveReactInstance(): Boolean = reactHost.isInstanceInitialized diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/CoreReactPackage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/CoreReactPackage.kt index f571ffc1210..d2b992d649a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/CoreReactPackage.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/CoreReactPackage.kt @@ -38,8 +38,7 @@ import java.util.HashMap LogBoxModule::class, DeviceEventManagerModule::class, ExceptionsManagerModule::class, - ] -) + ]) internal class CoreReactPackage( private val devSupportManager: DevSupportManager, private val hardwareBackBtnHandler: DefaultHardwareBackBtnHandler, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt index 28b6616f4a2..a3423a5697c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt @@ -424,7 +424,7 @@ public class ReactHostImpl( eventName: String, durationMs: Int, responsivenessScore: Int, - ttl: Int, + ttl: Int ) { if (devSupportManager is PerfMonitorV2Handler) { devSupportManager.unstable_updatePerfMonitor(eventName, durationMs, responsivenessScore, ttl) @@ -545,15 +545,12 @@ public class ReactHostImpl( @Suppress("DEPRECATION") internal fun getNativeModule(nativeModuleInterface: Class): T? { - if ( - !ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE && - nativeModuleInterface == com.facebook.react.uimanager.UIManagerModule::class.java - ) { + if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE && + nativeModuleInterface == com.facebook.react.uimanager.UIManagerModule::class.java) { ReactSoftExceptionLogger.logSoftExceptionVerbose( TAG, ReactNoCrashSoftException( - "getNativeModule(UIManagerModule.class) cannot be called when the bridge is disabled" - ), + "getNativeModule(UIManagerModule.class) cannot be called when the bridge is disabled"), ) } @@ -636,10 +633,8 @@ public class ReactHostImpl( val action = intent.action val uri = intent.data - if ( - uri != null && - (Intent.ACTION_VIEW == action || NfcAdapter.ACTION_NDEF_DISCOVERED == action) - ) { + if (uri != null && + (Intent.ACTION_VIEW == action || NfcAdapter.ACTION_NDEF_DISCOVERED == action)) { val deviceEventManagerModule = currentContext.getNativeModule(DeviceEventManagerModule::class.java) deviceEventManagerModule?.emitNewIntentReceived(uri) @@ -1118,8 +1113,7 @@ public class ReactHostImpl( val asyncDevSupportManager = devSupportManager as DevSupportManagerBase val bundleURL = asyncDevSupportManager.devServerHelper.getDevServerBundleURL( - checkNotNull(asyncDevSupportManager.jsAppBundleName) - ) + checkNotNull(asyncDevSupportManager.jsAppBundleName)) asyncDevSupportManager.reloadJSFromServer( bundleURL, @@ -1257,10 +1251,8 @@ public class ReactHostImpl( raiseSoftException(method, "ReactContext is null. Reload reason: $reason") } - if ( - reactContext != null && - reactLifecycleStateManager.lifecycleState == LifecycleState.RESUMED - ) { + if (reactContext != null && + reactLifecycleStateManager.lifecycleState == LifecycleState.RESUMED) { log(method, "Calling ReactContext.onHostPause()") reactContext.onHostPause() } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.kt index 96bb76b3b2a..ea054163bf1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.kt @@ -161,8 +161,7 @@ internal class ReactInstance( val reactPackages: MutableList = ArrayList() reactPackages.add( - CoreReactPackage(context.devSupportManager, context.defaultHardwareBackBtnHandler) - ) + CoreReactPackage(context.devSupportManager, context.defaultHardwareBackBtnHandler)) if (useDevSupport) { reactPackages.add(DebugCorePackage()) } @@ -288,8 +287,7 @@ internal class ReactInstance( try { val exceptionsManager = checkNotNull( - getNativeModule(NativeExceptionsManagerSpec.NAME) - ) + getNativeModule(NativeExceptionsManagerSpec.NAME)) exceptionsManager.reportException(data) } catch (e: Exception) { // Sometimes (e.g: always with the default exception manager) the native module exceptions @@ -329,8 +327,7 @@ internal class ReactInstance( override fun setSourceURLs(deviceURL: String, remoteURL: String) { context.sourceURL = deviceURL } - } - ) + }) Systrace.endSection(Systrace.TRACE_TAG_REACT) } @@ -392,8 +389,7 @@ internal class ReactInstance( ReactSoftExceptionLogger.logSoftException( TAG, IllegalViewOperationException( - "surfaceView's is NOT equal to View.NO_ID before calling startSurface." - ), + "surfaceView's is NOT equal to View.NO_ID before calling startSurface."), ) view.id = View.NO_ID } @@ -469,8 +465,7 @@ internal class ReactInstance( ReactSoftExceptionLogger.logSoftException( TAG, ReactNoCrashSoftException( - "Native method handleMemoryPressureJs is called earlier than librninstance.so got ready." - ), + "Native method handleMemoryPressureJs is called earlier than librninstance.so got ready."), ) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactSurfaceImpl.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactSurfaceImpl.kt index 503056c86ab..ad7d00880bb 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactSurfaceImpl.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactSurfaceImpl.kt @@ -123,26 +123,21 @@ internal constructor( reactHost ?: return Task.forError( IllegalStateException( - "Trying to call ReactSurface.prerender(), but no ReactHost is attached." - ) - ) + "Trying to call ReactSurface.prerender(), but no ReactHost is attached.")) return host.prerenderSurface(this) } override fun start(): TaskInterface { if (surfaceViewRef.get() == null) { return Task.forError( - IllegalStateException("Trying to call ReactSurface.start(), but view is not created.") - ) + IllegalStateException("Trying to call ReactSurface.start(), but view is not created.")) } val host = reactHost ?: return Task.forError( IllegalStateException( - "Trying to call ReactSurface.start(), but no ReactHost is attached." - ) - ) + "Trying to call ReactSurface.start(), but no ReactHost is attached.")) return host.startSurface(this) } @@ -151,9 +146,7 @@ internal constructor( reactHost ?: return Task.forError( IllegalStateException( - "Trying to call ReactSurface.stop(), but no ReactHost is attached." - ) - ) + "Trying to call ReactSurface.stop(), but no ReactHost is attached.")) return host.stopSurface(this) } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/internal/bolts/Task.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/internal/bolts/Task.kt index 4341d3577de..f3e6d944a76 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/internal/bolts/Task.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/internal/bolts/Task.kt @@ -125,8 +125,7 @@ public class Task : TaskInterface { completed = this.isCompleted() if (!completed) { continuations.add( - Continuation { task -> completeImmediately(tcs, continuation, task, executor) } - ) + Continuation { task -> completeImmediately(tcs, continuation, task, executor) }) } } if (completed) { @@ -150,8 +149,7 @@ public class Task : TaskInterface { completed = this.isCompleted() if (!completed) { continuations.add( - Continuation { task -> completeAfterTask(tcs, continuation, task, executor) } - ) + Continuation { task -> completeAfterTask(tcs, continuation, task, executor) }) } } if (completed) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt index c122c2f20e7..7c115f18a9f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt @@ -94,8 +94,7 @@ import com.facebook.react.views.view.ReactViewManager ToastModule::class, VibrationModule::class, WebSocketModule::class, - ] -) + ]) public class MainReactPackage @JvmOverloads constructor(private val config: MainPackageConfig? = null) : @@ -224,8 +223,7 @@ constructor(private val config: MainPackageConfig? = null) : try { val reactModuleInfoProviderClass = ClassFinder.findClass( - "com.facebook.react.shell.MainReactPackage$\$ReactModuleInfoProvider" - ) + "com.facebook.react.shell.MainReactPackage$\$ReactModuleInfoProvider") @Suppress("DEPRECATION") return reactModuleInfoProviderClass?.newInstance() as? ReactModuleInfoProvider ?: fallbackForMissingClass() diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt index cb0d78ed04d..91a53ac8759 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt @@ -52,10 +52,8 @@ public object BackgroundStyleApplicator { @JvmStatic public fun setBackgroundColor(view: View, @ColorInt color: Int?): Unit { // No color to set, and no color already set - if ( - (color == null || color == Color.TRANSPARENT) && - view.background !is CompositeBackgroundDrawable - ) { + if ((color == null || color == Color.TRANSPARENT) && + view.background !is CompositeBackgroundDrawable) { return } @@ -304,8 +302,7 @@ public object BackgroundStyleApplicator { offsetY = offsetY, blurRadius = blurRadius, spread = spreadDistance, - ) - ) + )) } else if (!inset && Build.VERSION.SDK_INT >= MIN_OUTSET_BOX_SHADOW_SDK_VERSION) { outerShadows.add( OutsetBoxShadowDrawable( @@ -316,8 +313,7 @@ public object BackgroundStyleApplicator { offsetY = offsetY, blurRadius = blurRadius, spread = spreadDistance, - ) - ) + )) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt index adaff375674..0fb1c2c5a80 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt @@ -111,8 +111,7 @@ public object DisplayMetricsHolder { .getInsets( WindowInsetsCompat.Type.statusBars() or WindowInsetsCompat.Type.navigationBars() or - WindowInsetsCompat.Type.displayCutout() - ) + WindowInsetsCompat.Type.displayCutout()) .top } @@ -135,8 +134,7 @@ public object DisplayMetricsHolder { windowInsets.getInsets( WindowInsetsCompat.Type.statusBars() or WindowInsetsCompat.Type.navigationBars() or - WindowInsetsCompat.Type.displayCutout() - ) + WindowInsetsCompat.Type.displayCutout()) val verticalInsets = insets.top + insets.bottom return encodeFloatsToLong( (checkNotNull(screenDisplayMetrics).widthPixels).toFloat().pxToDp(), diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/FilterHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/FilterHelper.kt index dab9f5529c7..ca77b2dce3e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/FilterHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/FilterHelper.kt @@ -224,8 +224,7 @@ internal object FilterHelper { 0f, 1f, 0f, - ) - ) + )) } // https://www.w3.org/TR/filter-effects-1/#grayscaleEquivalent @@ -257,8 +256,7 @@ internal object FilterHelper { 0f, 1f, 0f, - ) - ) + )) } // https://www.w3.org/TR/filter-effects-1/#sepiaEquivalent @@ -290,8 +288,7 @@ internal object FilterHelper { 0f, 1f, 0f, - ) - ) + )) } // https://www.w3.org/TR/filter-effects-1/#saturateEquivalent @@ -336,8 +333,7 @@ internal object FilterHelper { 0f, 1f, 0f, - ) - ) + )) } // https://www.w3.org/TR/filter-effects-1/#invertEquivalent @@ -370,8 +366,7 @@ internal object FilterHelper { 0f, 1f, 0f, - ) - ) + )) } private fun createColorMatrixEffect( diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.kt index 136265e4974..e1d140a204c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.kt @@ -119,8 +119,7 @@ public class JSTouchDispatcher(private val viewGroup: ViewGroup) { targetCoordinates[0], targetCoordinates[1], touchEventCoalescingKeyHelper, - ) - ) + )) } else if (childIsHandlingNativeGesture) { // If the touch was intercepted by a child, we've already sent a cancel event to JS for this // gesture, so we shouldn't send any more touches related to it. @@ -148,8 +147,7 @@ public class JSTouchDispatcher(private val viewGroup: ViewGroup) { targetCoordinates[0], targetCoordinates[1], touchEventCoalescingKeyHelper, - ) - ) + )) sweepActiveTouchForTag(surfaceId, targetTag, reactContext) targetTag = -1 gestureStartTime = TouchEvent.UNSET @@ -166,8 +164,7 @@ public class JSTouchDispatcher(private val viewGroup: ViewGroup) { targetCoordinates[0], targetCoordinates[1], touchEventCoalescingKeyHelper, - ) - ) + )) } else if (action == MotionEvent.ACTION_POINTER_DOWN) { // New pointer goes down, this can only happen after ACTION_DOWN is sent for the first pointer eventDispatcher.dispatchEvent( @@ -180,8 +177,7 @@ public class JSTouchDispatcher(private val viewGroup: ViewGroup) { targetCoordinates[0], targetCoordinates[1], touchEventCoalescingKeyHelper, - ) - ) + )) } else if (action == MotionEvent.ACTION_POINTER_UP) { // Exactly one of the pointers goes up eventDispatcher.dispatchEvent( @@ -194,8 +190,7 @@ public class JSTouchDispatcher(private val viewGroup: ViewGroup) { targetCoordinates[0], targetCoordinates[1], touchEventCoalescingKeyHelper, - ) - ) + )) } else if (action == MotionEvent.ACTION_CANCEL) { if (touchEventCoalescingKeyHelper.hasCoalescingKey(ev.downTime)) { dispatchCancelEvent(ev, eventDispatcher) @@ -273,7 +268,6 @@ public class JSTouchDispatcher(private val viewGroup: ViewGroup) { targetCoordinates[0], targetCoordinates[1], touchEventCoalescingKeyHelper, - ) - ) + )) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/MatrixMathHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/MatrixMathHelper.kt index 779562200c5..9657a21a70b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/MatrixMathHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/MatrixMathHelper.kt @@ -190,8 +190,7 @@ public object MatrixMathHelper { rotationDegrees[0] = roundTo3Places(-atan2(row[2][1], row[2][2]) * conv) rotationDegrees[1] = roundTo3Places( - -atan2(-row[2][0], sqrt(row[2][1] * row[2][1] + row[2][2] * row[2][2])) * conv - ) + -atan2(-row[2][0], sqrt(row[2][1] * row[2][1] + row[2][2] * row[2][2])) * conv) rotationDegrees[2] = roundTo3Places(-atan2(row[1][0], row[0][0]) * conv) } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/MeasureSpecAssertions.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/MeasureSpecAssertions.kt index 17c02b7dc80..582c1094c7f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/MeasureSpecAssertions.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/MeasureSpecAssertions.kt @@ -18,8 +18,7 @@ public object MeasureSpecAssertions { if (widthMode == View.MeasureSpec.UNSPECIFIED || heightMode == View.MeasureSpec.UNSPECIFIED) { throw IllegalStateException( "A catalyst view must have an explicit width and height given to it. This should " + - "normally happen as part of the standard catalyst UI framework." - ) + "normally happen as part of the standard catalyst UI framework.") } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.kt index a821996fba8..35461509c31 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.kt @@ -75,8 +75,7 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac val accessibilityStateExpanded = host.getTag(R.id.accessibility_state_expanded) as Boolean info.addAction( if (accessibilityStateExpanded) AccessibilityNodeInfoCompat.ACTION_COLLAPSE - else AccessibilityNodeInfoCompat.ACTION_EXPAND - ) + else AccessibilityNodeInfoCompat.ACTION_EXPAND) } val accessibilityRole = AccessibilityRole.fromViewTag(host) val accessibilityHint = host.getTag(R.id.accessibility_hint) as String? @@ -137,20 +136,16 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac // Process accessibilityValue val accessibilityValue = host.getTag(R.id.accessibility_value) as ReadableMap? - if ( - accessibilityValue != null && - accessibilityValue.hasKey("min") && - accessibilityValue.hasKey("now") && - accessibilityValue.hasKey("max") - ) { + if (accessibilityValue != null && + accessibilityValue.hasKey("min") && + accessibilityValue.hasKey("now") && + accessibilityValue.hasKey("max")) { val minDynamic = accessibilityValue.getDynamic("min") val nowDynamic = accessibilityValue.getDynamic("now") val maxDynamic = accessibilityValue.getDynamic("max") - if ( - minDynamic.type == ReadableType.Number && - nowDynamic.type == ReadableType.Number && - maxDynamic.type == ReadableType.Number - ) { + if (minDynamic.type == ReadableType.Number && + nowDynamic.type == ReadableType.Number && + maxDynamic.type == ReadableType.Number) { val min = minDynamic.asInt() val now = nowDynamic.asInt() val max = maxDynamic.asInt() @@ -192,20 +187,16 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac // Set item count and current item index on accessibility events for adjustable // in order to make Talkback announce the value of the adjustable val accessibilityValue = host.getTag(R.id.accessibility_value) as ReadableMap? - if ( - accessibilityValue != null && - accessibilityValue.hasKey("min") && - accessibilityValue.hasKey("now") && - accessibilityValue.hasKey("max") - ) { + if (accessibilityValue != null && + accessibilityValue.hasKey("min") && + accessibilityValue.hasKey("now") && + accessibilityValue.hasKey("max")) { val minDynamic = accessibilityValue.getDynamic("min") val nowDynamic = accessibilityValue.getDynamic("now") val maxDynamic = accessibilityValue.getDynamic("max") - if ( - minDynamic.type == ReadableType.Number && - nowDynamic.type == ReadableType.Number && - maxDynamic.type == ReadableType.Number - ) { + if (minDynamic.type == ReadableType.Number && + nowDynamic.type == ReadableType.Number && + maxDynamic.type == ReadableType.Number) { val min = minDynamic.asInt() val now = nowDynamic.asInt() val max = maxDynamic.asInt() @@ -234,8 +225,7 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac val uiManager = getUIManager(reactContext, getUIManagerType(reactTag)) if (uiManager != null) { uiManager.eventDispatcher.dispatchEvent( - AccessibilityActionEvent(eventData, surfaceId, reactTag) - ) + AccessibilityActionEvent(eventData, surfaceId, reactTag)) } } else { logSoftException( @@ -248,11 +238,9 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac // schedule to send a TYPE_VIEW_SELECTED event after performing the scroll actions. val accessibilityRole = host.getTag(R.id.accessibility_role) as AccessibilityRole val accessibilityValue = host.getTag(R.id.accessibility_value) as ReadableMap? - if ( - accessibilityRole == AccessibilityRole.ADJUSTABLE && - (action == AccessibilityActionCompat.ACTION_SCROLL_FORWARD.id || - (action == AccessibilityActionCompat.ACTION_SCROLL_BACKWARD.id)) - ) { + if (accessibilityRole == AccessibilityRole.ADJUSTABLE && + (action == AccessibilityActionCompat.ACTION_SCROLL_FORWARD.id || + (action == AccessibilityActionCompat.ACTION_SCROLL_BACKWARD.id))) { if (accessibilityValue != null && !accessibilityValue.hasKey("text")) { scheduleAccessibilityEventSender(host) } @@ -591,16 +579,14 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac ) { // if a view already has an accessibility delegate, replacing it could cause // problems, so leave it alone. - if ( - !ViewCompat.hasAccessibilityDelegate(view) && - (view.getTag(R.id.accessibility_role) != null || - view.getTag(R.id.accessibility_state) != null || - view.getTag(R.id.accessibility_actions) != null || - view.getTag(R.id.react_test_id) != null || - view.getTag(R.id.accessibility_collection_item) != null || - view.getTag(R.id.accessibility_links) != null || - view.getTag(R.id.role) != null) - ) { + if (!ViewCompat.hasAccessibilityDelegate(view) && + (view.getTag(R.id.accessibility_role) != null || + view.getTag(R.id.accessibility_state) != null || + view.getTag(R.id.accessibility_actions) != null || + view.getTag(R.id.react_test_id) != null || + view.getTag(R.id.accessibility_collection_item) != null || + view.getTag(R.id.accessibility_links) != null || + view.getTag(R.id.role) != null)) { ViewCompat.setAccessibilityDelegate( view, ReactAccessibilityDelegate(view, originalFocus, originalImportantForAccessibility), @@ -824,10 +810,8 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac } val important = ViewCompat.getImportantForAccessibility(view) - if ( - important == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS || - (important == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO && node.childCount <= 0) - ) { + if (important == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS || + (important == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO && node.childCount <= 0)) { return false } @@ -990,10 +974,8 @@ public open class ReactAccessibilityDelegate( // The View this delegate is attac @Suppress("DEPRECATION") // TODO: Replace with direct invocation on view ViewCompat.onInitializeAccessibilityNodeInfo(child, childNodeInfo) - if ( - isSpeakingNode(childNodeInfo, child) && - !isAccessibilityFocusable(childNodeInfo, child) - ) { + if (isSpeakingNode(childNodeInfo, child) && + !isAccessibilityFocusable(childNodeInfo, child)) { val childNodeDescription = getTalkbackDescription(child, null) if (!childNodeDescription.isNullOrEmpty()) { concatChildDescription.append(childNodeDescription.toString() + delimiter) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroupHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroupHelper.kt index ecc935ac5d1..e002301fb37 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroupHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroupHelper.kt @@ -42,14 +42,12 @@ public object ReactClippingViewGroupHelper { if (parent.removeClippedSubviews) { parent.getClippingRect(helperRect) // Intersect the view with the parent's rectangle - if ( - !helperRect.intersect( - view.left, - view.top + view.translationY.toInt(), - view.right, - view.bottom + view.translationY.toInt(), - ) - ) { + if (!helperRect.intersect( + view.left, + view.top + view.translationY.toInt(), + view.right, + view.bottom + view.translationY.toInt(), + )) { outputRect.setEmpty() return } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactStage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactStage.kt index 27e834078ff..6746f74d7dd 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactStage.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactStage.kt @@ -21,8 +21,7 @@ import androidx.annotation.IntDef ReactStage.SURFACE_DID_INITIAL_LAYOUT, ReactStage.SURFACE_DID_INITIAL_MOUNTING, ReactStage.SURFACE_DID_STOP, - ] -) + ]) public annotation class ReactStage { public companion object { public const val SURFACE_DID_INITIALIZE: Int = 0 diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.kt index 57cdf5085b5..1d3ba863b91 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.kt @@ -62,8 +62,7 @@ internal class ShadowNodeRegistry { threadAsserter.assertNow() if (rootTags[tag]) { throw IllegalViewOperationException( - "Trying to remove root node $tag without using removeRootNode!" - ) + "Trying to remove root node $tag without using removeRootNode!") } tagsToCSSNodes.remove(tag) } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/Spacing.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/Spacing.kt index 2439018b76b..9c9f63c4c7a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/Spacing.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/Spacing.kt @@ -66,13 +66,11 @@ public class Spacing(private val defaultValue: Float, private val spacing: Float */ public operator fun get(spacingType: Int): Float { val defaultVal = - if ( - spacingType == START || - spacingType == END || - spacingType == BLOCK || - spacingType == BLOCK_END || - spacingType == BLOCK_START - ) { + if (spacingType == START || + spacingType == END || + spacingType == BLOCK || + spacingType == BLOCK_END || + spacingType == BLOCK_START) { YogaConstants.UNDEFINED } else { defaultValue diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.kt index d91b7f1b189..038eb13882a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.kt @@ -86,8 +86,7 @@ public class ThemedReactContext( reactApplicationContext.getNativeModule(moduleName) @Deprecated( - "This method is deprecated and will be removed once the Legacy Architecture is removed" - ) + "This method is deprecated and will be removed once the Legacy Architecture is removed") @LegacyArchitecture override fun getCatalystInstance(): CatalystInstance? = reactApplicationContext.getCatalystInstance() @@ -124,8 +123,7 @@ public class ThemedReactContext( * with this [ThemedReactContext] */ @Deprecated( - "Do not depend on this method. It will be removed in a future release of React Native." - ) + "Do not depend on this method. It will be removed in a future release of React Native.") public fun getSurfaceID(): String? = moduleName override fun handleException(e: Exception?) { @@ -133,8 +131,7 @@ public class ThemedReactContext( } @Deprecated( - "You should not invoke isBridgeless and let your code depend on this check. This function will be removed in the future." - ) + "You should not invoke isBridgeless and let your code depend on this check. This function will be removed in the future.") override fun isBridgeless(): Boolean = reactApplicationContext.isBridgeless() override fun getJavaScriptContextHolder(): JavaScriptContextHolder? = diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.kt index 6cc469efb63..edea84f62d5 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.kt @@ -193,10 +193,8 @@ public object TouchTargetHelper { if (view is ReactOverflowViewWithInset) { // If the touch point is outside of the overflow inset for the view, we can safely ignore // it. - if ( - ViewUtil.getUIManagerType(view.id) == UIManagerType.FABRIC && - !isTouchPointInViewWithOverflowInset(eventCoords[0], eventCoords[1], view) - ) { + if (ViewUtil.getUIManagerType(view.id) == UIManagerType.FABRIC && + !isTouchPointInViewWithOverflowInset(eventCoords[0], eventCoords[1], view)) { return null } @@ -238,10 +236,8 @@ public object TouchTargetHelper { } // Check if parent can handle the touch after the children - if ( - allowReturnTouchTargetTypes.contains(TouchTargetReturnType.SELF) && - isTouchPointInView(eventCoords[0], eventCoords[1], view) - ) { + if (allowReturnTouchTargetTypes.contains(TouchTargetReturnType.SELF) && + isTouchPointInView(eventCoords[0], eventCoords[1], view)) { return view } @@ -255,12 +251,10 @@ public object TouchTargetHelper { private fun isTouchPointInView(x: Float, y: Float, view: View): Boolean { val hitSlopRect = (view as? ReactHitSlopView)?.hitSlopRect if (hitSlopRect != null) { - if ( - x >= -hitSlopRect.left && - x < view.width + hitSlopRect.right && - y >= -hitSlopRect.top && - y < view.height + hitSlopRect.bottom - ) { + if (x >= -hitSlopRect.left && + x < view.width + hitSlopRect.right && + y >= -hitSlopRect.top && + y < view.height + hitSlopRect.bottom) { return true } return false @@ -393,11 +387,9 @@ public object TouchTargetHelper { FLog.w(ReactConstants.TAG, "Unknown pointer event type: $pointerEvents") } // Either this view or one of its children is the target - if ( - view is ReactCompoundViewGroup && - isTouchPointInView(eventCoords[0], eventCoords[1], view) && - view.interceptsTouchEvent(eventCoords[0], eventCoords[1]) - ) { + if (view is ReactCompoundViewGroup && + isTouchPointInView(eventCoords[0], eventCoords[1], view) && + view.interceptsTouchEvent(eventCoords[0], eventCoords[1])) { pathAccumulator?.add(ViewTarget(view.id, view)) return view } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.kt index 554f4051680..ea8ea9c7e3b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.kt @@ -73,12 +73,10 @@ public object TransformHelper { transformOrigin: ReadableArray?, allowPercentageResolution: Boolean, ) { - if ( - allowPercentageResolution && - ReactNativeFeatureFlags.useNativeTransformHelperAndroid() && - transforms is NativeArray && - transformOrigin is NativeArray? - ) { + if (allowPercentageResolution && + ReactNativeFeatureFlags.useNativeTransformHelperAndroid() && + transforms is NativeArray && + transformOrigin is NativeArray?) { nativeProcessTransform(transforms, result, viewWidth, viewHeight, transformOrigin) return } @@ -162,20 +160,16 @@ public object TransformHelper { } "translateX" -> { val translateValue = - if ( - transform.getType(transformType) == ReadableType.String && - allowPercentageResolution - ) + if (transform.getType(transformType) == ReadableType.String && + allowPercentageResolution) parseTranslateValue(transform.getString(transformType)!!, viewWidth.toDouble()) else transform.getDouble(transformType) MatrixMathHelper.applyTranslate2D(helperMatrix, translateValue, 0.0) } "translateY" -> { val translateValue = - if ( - transform.getType(transformType) == ReadableType.String && - allowPercentageResolution - ) + if (transform.getType(transformType) == ReadableType.String && + allowPercentageResolution) parseTranslateValue(transform.getString(transformType)!!, viewHeight.toDouble()) else transform.getDouble(transformType) MatrixMathHelper.applyTranslate2D(helperMatrix, 0.0, translateValue) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.kt index 87288fcc61d..cb1a973e2a6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.kt @@ -57,8 +57,7 @@ public object UIManagerHelper { ReactSoftExceptionLogger.logSoftException( TAG, ReactNoCrashSoftException( - "Cannot get UIManager because the instance hasn't been initialized yet." - ), + "Cannot get UIManager because the instance hasn't been initialized yet."), ) return null } @@ -79,8 +78,7 @@ public object UIManagerHelper { ReactSoftExceptionLogger.logSoftException( TAG, ReactNoCrashSoftException( - "Cannot get UIManager because the context doesn't contain a CatalystInstance." - ), + "Cannot get UIManager because the context doesn't contain a CatalystInstance."), ) return null } @@ -91,8 +89,7 @@ public object UIManagerHelper { TAG, ReactNoCrashSoftException( "Cannot get UIManager because the context doesn't contain an active" + - " CatalystInstance." - ), + " CatalystInstance."), ) if (returnNullIfCatalystIsInactive) { return null @@ -215,8 +212,7 @@ public object UIManagerHelper { ReactSoftExceptionLogger.logSoftException( TAG, IllegalStateException( - "Fabric View [$reactTag] does not have SurfaceId associated with it" - ), + "Fabric View [$reactTag] does not have SurfaceId associated with it"), ) } return surfaceId diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.kt index 5967be095a7..881610c9c81 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.kt @@ -19,33 +19,27 @@ internal object UIManagerModuleConstants { "topChange" to mapOf( "phasedRegistrationNames" to - mapOf("bubbled" to "onChange", "captured" to "onChangeCapture") - ), + mapOf("bubbled" to "onChange", "captured" to "onChangeCapture")), "topSelect" to mapOf( "phasedRegistrationNames" to - mapOf("bubbled" to "onSelect", "captured" to "onSelectCapture") - ), + mapOf("bubbled" to "onSelect", "captured" to "onSelectCapture")), TouchEventType.getJSEventName(TouchEventType.START) to mapOf( "phasedRegistrationNames" to - mapOf("bubbled" to "onTouchStart", "captured" to "onTouchStartCapture") - ), + mapOf("bubbled" to "onTouchStart", "captured" to "onTouchStartCapture")), TouchEventType.getJSEventName(TouchEventType.MOVE) to mapOf( "phasedRegistrationNames" to - mapOf("bubbled" to "onTouchMove", "captured" to "onTouchMoveCapture") - ), + mapOf("bubbled" to "onTouchMove", "captured" to "onTouchMoveCapture")), TouchEventType.getJSEventName(TouchEventType.END) to mapOf( "phasedRegistrationNames" to - mapOf("bubbled" to "onTouchEnd", "captured" to "onTouchEndCapture") - ), + mapOf("bubbled" to "onTouchEnd", "captured" to "onTouchEndCapture")), TouchEventType.getJSEventName(TouchEventType.CANCEL) to mapOf( "phasedRegistrationNames" to - mapOf("bubbled" to "onTouchCancel", "captured" to "onTouchCancelCapture") - ), + mapOf("bubbled" to "onTouchCancel", "captured" to "onTouchCancelCapture")), ) @JvmField @@ -80,8 +74,7 @@ internal object UIManagerModuleConstants { "ScaleAspectFit" to ImageView.ScaleType.FIT_CENTER.ordinal, "ScaleAspectFill" to ImageView.ScaleType.CENTER_CROP.ordinal, "ScaleAspectCenter" to ImageView.ScaleType.CENTER_INSIDE.ordinal, - ) - ), + )), "StyleConstants" to mapOf( "PointerEventsValues" to @@ -90,8 +83,7 @@ internal object UIManagerModuleConstants { "boxNone" to PointerEvents.BOX_NONE.ordinal, "boxOnly" to PointerEvents.BOX_ONLY.ordinal, "unspecified" to PointerEvents.AUTO.ordinal, - ) - ), + )), "AccessibilityEventTypes" to mapOf( "typeWindowStateChanged" to AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.kt index dadcf1ce612..8ba30c004ca 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.kt @@ -37,8 +37,7 @@ internal object UIManagerModuleConstantsHelper { mapOf( "ViewManagerNames" to ArrayList(resolver.getViewManagerNames()), "LazyViewManagersEnabled" to true, - ) - ) + )) @JvmStatic val defaultExportableEventTypes: Map @@ -59,12 +58,10 @@ internal object UIManagerModuleConstantsHelper { for ((key, value) in directEvents) { if (value is MutableMap<*, *>) { val regName = value["registrationName"] as String? - if ( - regName != null && - key.startsWith("top") && - regName.startsWith("on") && - (key.substring(3) != regName.substring(2)) - ) { + if (regName != null && + key.startsWith("top") && + regName.startsWith("on") && + (key.substring(3) != regName.substring(2))) { FLog.e( TAG, "Direct event name for '$viewManagerName' doesn't correspond to the naming convention," + @@ -231,9 +228,9 @@ internal object UIManagerModuleConstantsHelper { for ((key, sourceValue) in source) { var destValue = dest[key] - if ( - destValue != null && (sourceValue is MutableMap<*, *>) && (destValue is MutableMap<*, *>) - ) { + if (destValue != null && + (sourceValue is MutableMap<*, *>) && + (destValue is MutableMap<*, *>)) { // Since event maps are client based Map interface, it could be immutable if (destValue !is HashMap<*, *>) { destValue = HashMap(destValue) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.kt index 2d76c45b98c..a7d33ea0216 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.kt @@ -57,11 +57,9 @@ public class ViewGroupDrawingOrderHelper(private val viewGroup: ViewGroup) { */ public fun getChildDrawingOrder(childCount: Int, index: Int): Int { var currentDrawingOrderIndices = this.drawingOrderIndices - if ( - currentDrawingOrderIndices != null && - (index >= currentDrawingOrderIndices.size || - currentDrawingOrderIndices[index] >= childCount) - ) { + if (currentDrawingOrderIndices != null && + (index >= currentDrawingOrderIndices.size || + currentDrawingOrderIndices[index] >= childCount)) { FLog.w( ReactConstants.TAG, "getChildDrawingOrder index out of bounds! Please check any custom view manipulations you" + diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.kt index 8937450ea6d..a47cf314412 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.kt @@ -71,8 +71,7 @@ public class ViewManagerRegistry : ComponentCallbacks2 { throw IllegalViewOperationException( "Can't find ViewManager '$className' nor '$rctViewManagerName' in ViewManagerRegistry, " + - "existing names are: ${viewManagerResolver.getViewManagerNames()}" - ) + "existing names are: ${viewManagerResolver.getViewManagerNames()}") } throw IllegalViewOperationException("No ViewManager found for class $className") diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.kt index dd4883e23e0..925e031fb94 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.kt @@ -254,8 +254,7 @@ public object ViewProps { PADDING_BOTTOM, PADDING_START, PADDING_END, - ) - ) + )) @JvmStatic public fun isLayoutOnly(map: ReadableMap, prop: String): Boolean { @@ -273,19 +272,16 @@ public object ViewProps { BORDER_RADIUS -> { if (map.hasKey(BACKGROUND_COLOR)) { val valueType = map.getType(BACKGROUND_COLOR) - if ( - valueType == ReadableType.Number && map.getInt(BACKGROUND_COLOR) != Color.TRANSPARENT - ) { + if (valueType == ReadableType.Number && + map.getInt(BACKGROUND_COLOR) != Color.TRANSPARENT) { return false } else if (valueType != ReadableType.Null) { return false } } - if ( - map.hasKey(BORDER_WIDTH) && - !map.isNull(BORDER_WIDTH) && - map.getDouble(BORDER_WIDTH) != 0.0 - ) { + if (map.hasKey(BORDER_WIDTH) && + !map.isNull(BORDER_WIDTH) && + map.getDouble(BORDER_WIDTH) != 0.0) { return false } else { return true diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt index 912d8c68f7f..bd2464d010f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.kt @@ -15,8 +15,7 @@ import androidx.annotation.IntDef public annotation class UIManagerType { public companion object { @Deprecated( - "UIManagerType.DEFAULT will be deleted in the next release of React Native. Use [LEGACY] instead." - ) + "UIManagerType.DEFAULT will be deleted in the next release of React Native. Use [LEGACY] instead.") public const val DEFAULT: Int = 1 public const val LEGACY: Int = 1 public const val FABRIC: Int = 2 diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.kt index abeda63335f..221efbc8c2b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.kt @@ -18,8 +18,7 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel * guarantees what thread onViewHierarchyUpdateEnqueued is called on. */ @Deprecated( - "NotThreadSafeViewHierarchyUpdateDebugListener will be deleted in the new architecture." -) + "NotThreadSafeViewHierarchyUpdateDebugListener will be deleted in the new architecture.") @LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR) internal interface NotThreadSafeViewHierarchyUpdateDebugListener { /** Called when `UIManagerModule` enqueues a UI batch to be dispatched to the main thread. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BackgroundDrawable.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BackgroundDrawable.kt index 474d148e79b..3373bd6fe65 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BackgroundDrawable.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BackgroundDrawable.kt @@ -194,10 +194,8 @@ internal class BackgroundDrawable( computedBorderInsets?.right != 0f || computedBorderInsets?.bottom != 0f) - if ( - computedBorderRadius?.hasRoundedBorders() == true && - computedBorderRadius?.isUniform() == false - ) { + if (computedBorderRadius?.hasRoundedBorders() == true && + computedBorderRadius?.isUniform() == false) { backgroundRenderPath = backgroundRenderPath ?: Path() backgroundRenderPath?.reset() } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BorderDrawable.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BorderDrawable.kt index d1293ee48d9..4491dcd0dfc 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BorderDrawable.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/BorderDrawable.kt @@ -367,27 +367,23 @@ internal class BorderDrawable( canvas.clipPath(checkNotNull(outerClipPathForBorderRadius)) val borderWidth = computeBorderInsets() - if ( - borderWidth.top > 0 || - borderWidth.bottom > 0 || - borderWidth.left > 0 || - borderWidth.right > 0 - ) { + if (borderWidth.top > 0 || + borderWidth.bottom > 0 || + borderWidth.left > 0 || + borderWidth.right > 0) { // If it's a full and even border draw inner rect path with stroke val fullBorderWidth: Float = getFullBorderWidth() val borderColor = getBorderColor(LogicalEdge.ALL) - if ( - borderWidth.top == fullBorderWidth && - borderWidth.bottom == fullBorderWidth && - borderWidth.left == fullBorderWidth && - borderWidth.right == fullBorderWidth && - computedBorderColors.left == borderColor && - computedBorderColors.top == borderColor && - computedBorderColors.right == borderColor && - computedBorderColors.bottom == borderColor - ) { + if (borderWidth.top == fullBorderWidth && + borderWidth.bottom == fullBorderWidth && + borderWidth.left == fullBorderWidth && + borderWidth.right == fullBorderWidth && + computedBorderColors.left == borderColor && + computedBorderColors.top == borderColor && + computedBorderColors.right == borderColor && + computedBorderColors.bottom == borderColor) { if (fullBorderWidth > 0) { borderPaint.color = multiplyColorAlpha(borderColor, borderAlpha) borderPaint.style = Paint.Style.STROKE @@ -494,12 +490,10 @@ internal class BorderDrawable( colorBottom: Int, ): Int { // If any of the border colors are translucent then we can't use the fast path. - if ( - Color.alpha(colorLeft) < 255 || - Color.alpha(colorTop) < 255 || - Color.alpha(colorRight) < 255 || - Color.alpha(colorBottom) < 255 - ) { + if (Color.alpha(colorLeft) < 255 || + Color.alpha(colorTop) < 255 || + Color.alpha(colorRight) < 255 || + Color.alpha(colorBottom) < 255) { return 0 } @@ -691,12 +685,10 @@ internal class BorderDrawable( val borderWidth = computeBorderInsets() // Clip border ONLY if at least one edge is non-transparent - if ( - Color.alpha(computedBorderColors.left) != 0 || - Color.alpha(computedBorderColors.top) != 0 || - Color.alpha(computedBorderColors.right) != 0 || - Color.alpha(computedBorderColors.bottom) != 0 - ) { + if (Color.alpha(computedBorderColors.left) != 0 || + Color.alpha(computedBorderColors.top) != 0 || + Color.alpha(computedBorderColors.right) != 0 || + Color.alpha(computedBorderColors.bottom) != 0) { innerClipTempRectForBorderRadius?.top = innerClipTempRectForBorderRadius?.top?.plus(borderWidth.top) ?: 0f innerClipTempRectForBorderRadius?.bottom = diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CompositeBackgroundDrawable.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CompositeBackgroundDrawable.kt index ad8f83b887e..0c6ca358587 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CompositeBackgroundDrawable.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CompositeBackgroundDrawable.kt @@ -74,8 +74,7 @@ internal class CompositeBackgroundDrawable( feedbackUnderlay, innerShadows, outline, - ) - ) { + )) { init { // We want to overlay drawables, instead of placing future drawables within the content area of diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/InsetBoxShadowDrawable.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/InsetBoxShadowDrawable.kt index 0cfc3191515..8d74db906c1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/InsetBoxShadowDrawable.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/InsetBoxShadowDrawable.kt @@ -132,8 +132,7 @@ internal class InsetBoxShadowDrawable( canvas.save().let { saveCount -> if (paddingBoxRadii != null) { canvas.clipPath( - Path().apply { addRoundRect(paddingBoxRect, paddingBoxRadii, Path.Direction.CW) } - ) + Path().apply { addRoundRect(paddingBoxRect, paddingBoxRadii, Path.Direction.CW) }) val innerRadii = paddingBoxRadii.map { adjustRadiusForSpread(it, -spreadExtent) }.toFloatArray() diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/OutsetBoxShadowDrawable.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/OutsetBoxShadowDrawable.kt index b2ff610532c..6d4fb8e02db 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/OutsetBoxShadowDrawable.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/OutsetBoxShadowDrawable.kt @@ -136,8 +136,7 @@ internal class OutsetBoxShadowDrawable( ), Path.Direction.CW, ) - } - ) + }) canvas.drawPath( Path().apply { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventCategoryDef.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventCategoryDef.kt index 2e764dd0af4..0d8bd48979e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventCategoryDef.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventCategoryDef.kt @@ -21,8 +21,7 @@ import androidx.annotation.IntDef EventCategoryDef.UNSPECIFIED, EventCategoryDef.DISCRETE, EventCategoryDef.CONTINUOUS, - ] -) + ]) @Retention(AnnotationRetention.SOURCE) internal annotation class EventCategoryDef { companion object { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventEmitterImpl.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventEmitterImpl.kt index df84f8de5e0..268213ab74a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventEmitterImpl.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventEmitterImpl.kt @@ -88,8 +88,7 @@ internal class EventEmitterImpl( logSoftException( TAG, ReactNoCrashSoftException( - "Cannot get RCTEventEmitter without active Catalyst instance!" - ), + "Cannot get RCTEventEmitter without active Catalyst instance!"), ) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FabricEventDispatcher.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FabricEventDispatcher.kt index 8380092e7cc..9bd21a04692 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FabricEventDispatcher.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FabricEventDispatcher.kt @@ -95,8 +95,7 @@ internal class FabricEventDispatcher( ReactSoftExceptionLogger.logSoftException( TAG, IllegalStateException( - "Fabric UIManager expected to implement SynchronousEventReceiver." - ), + "Fabric UIManager expected to implement SynchronousEventReceiver."), ) } } finally { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.kt index a725ee10977..ca18044dfa6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.kt @@ -58,8 +58,7 @@ internal class PointerEvent private constructor() : Event() { TAG, IllegalStateException( "Cannot dispatch a Pointer that has no MotionEvent; the PointerEvent has been" + - " recycled" - ), + " recycled"), ) return } @@ -245,8 +244,7 @@ internal class PointerEvent private constructor() : Event() { logSoftException( TAG, IllegalStateException( - "Cannot dispatch a Pointer that has no MotionEvent; the PointerEvent has been recycled" - ), + "Cannot dispatch a Pointer that has no MotionEvent; the PointerEvent has been recycled"), ) return } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.kt index 1e4566be1bf..c0675328ae5 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.kt @@ -152,8 +152,7 @@ public class TouchEvent private constructor() : Event() { TAG, IllegalStateException( "Cannot dispatch a TouchEvent that has no MotionEvent; the TouchEvent has been" + - " recycled" - ), + " recycled"), ) return false } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.kt index eff00259d5d..7c12af79422 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.kt @@ -155,8 +155,7 @@ public open class LayoutAnimationController { } override fun onAnimationRepeat(animation: Animation) = Unit - } - ) + }) } else { view.layout(x, y, x + width, y + height) } @@ -198,8 +197,7 @@ public open class LayoutAnimationController { override fun onAnimationEnd(anim: Animation) { listener.onAnimationEnd() } - } - ) + }) val animationDuration = animation.duration if (animationDuration > maxAnimationDuration) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt index 523e2c482cf..c49b6f25a99 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/RadialGradient.kt @@ -297,8 +297,7 @@ internal class RadialGradient( var distance = sqrt( (centerX - corners[cornerIndex].first).pow(2) + - (centerY - corners[cornerIndex].second).pow(2) - ) + (centerY - corners[cornerIndex].second).pow(2)) val isClosestCorner = sizeKeyword == GradientSize.KeywordType.CLOSEST_CORNER for (i in 1 until corners.size) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/JSStackTrace.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/JSStackTrace.kt index f253d4b36e4..469bbecb3e6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/JSStackTrace.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/util/JSStackTrace.kt @@ -26,20 +26,16 @@ internal object JSStackTrace { for (i in 0 until stack.size()) { val frame = stack.getMap(i) ?: continue stringBuilder.append(frame.getString(METHOD_NAME_KEY)).append("@").append(parseFileId(frame)) - if ( - frame.hasKey(LINE_NUMBER_KEY) && - !frame.isNull(LINE_NUMBER_KEY) && - frame.getType(LINE_NUMBER_KEY) == ReadableType.Number - ) { + if (frame.hasKey(LINE_NUMBER_KEY) && + !frame.isNull(LINE_NUMBER_KEY) && + frame.getType(LINE_NUMBER_KEY) == ReadableType.Number) { stringBuilder.append(frame.getInt(LINE_NUMBER_KEY)) } else { stringBuilder.append(-1) } - if ( - frame.hasKey(COLUMN_KEY) && - !frame.isNull(COLUMN_KEY) && - frame.getType(COLUMN_KEY) == ReadableType.Number - ) { + if (frame.hasKey(COLUMN_KEY) && + !frame.isNull(COLUMN_KEY) && + frame.getType(COLUMN_KEY) == ReadableType.Number) { stringBuilder.append(":").append(frame.getInt(COLUMN_KEY)) } stringBuilder.append("\n") @@ -55,11 +51,9 @@ internal object JSStackTrace { // stack traces with a single source map file. // NOTE: The ".js" suffix is kept to avoid ambiguities between "module-id:line" and "line:column". private fun parseFileId(frame: ReadableMap): String { - if ( - frame.hasKey(FILE_KEY) && - !frame.isNull(FILE_KEY) && - frame.getType(FILE_KEY) == ReadableType.String - ) { + if (frame.hasKey(FILE_KEY) && + !frame.isNull(FILE_KEY) && + frame.getType(FILE_KEY) == ReadableType.String) { val file = frame.getString(FILE_KEY) if (file != null) { val matcher = FILE_ID_PATTERN.matcher(file) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/debuggingoverlay/DebuggingOverlayManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/debuggingoverlay/DebuggingOverlayManager.kt index fcd7ddad19b..44b948ebd99 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/debuggingoverlay/DebuggingOverlayManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/debuggingoverlay/DebuggingOverlayManager.kt @@ -41,8 +41,7 @@ internal class DebuggingOverlayManager : ReactSoftExceptionLogger.logSoftException( REACT_CLASS, ReactNoCrashSoftException( - "Unexpected payload for highlighting trace updates: rectangle field is null" - ), + "Unexpected payload for highlighting trace updates: rectangle field is null"), ) successfullyParsedPayload = false break @@ -68,8 +67,7 @@ internal class DebuggingOverlayManager : REACT_CLASS, ReactNoCrashSoftException( "Unexpected payload for highlighting trace updates: rectangle field should" + - " have x, y, width, height fields" - ), + " have x, y, width, height fields"), ) successfullyParsedPayload = false } @@ -105,8 +103,7 @@ internal class DebuggingOverlayManager : REACT_CLASS, ReactNoCrashSoftException( "Unexpected payload for highlighting elements: every element should have x," + - " y, width, height fields" - ), + " y, width, height fields"), ) successfullyParsedPayload = false } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.kt index 2495a76716e..a09a6c17378 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.kt @@ -179,8 +179,7 @@ public class ReactDrawerLayoutManager : mapOf( DRAWER_POSITION_LEFT to Gravity.START, DRAWER_POSITION_RIGHT to Gravity.END, - ) - ) + )) public override fun getExportedCustomDirectEventTypeConstants(): Map { val eventTypeConstants = super.getExportedCustomDirectEventTypeConstants() ?: mutableMapOf() @@ -203,8 +202,7 @@ public class ReactDrawerLayoutManager : } if (index != 0 && index != 1) { throw JSApplicationIllegalArgumentException( - "The only valid indices for drawer's child are 0 or 1. Got $index instead." - ) + "The only valid indices for drawer's child are 0 or 1. Got $index instead.") } parent.addView(child, index) parent.setDrawerProperties() @@ -218,26 +216,22 @@ public class ReactDrawerLayoutManager : ) : DrawerListener { override fun onDrawerSlide(view: View, v: Float) { eventDispatcher.dispatchEvent( - DrawerSlideEvent(UIManagerHelper.getSurfaceId(drawerLayout), drawerLayout.id, v) - ) + DrawerSlideEvent(UIManagerHelper.getSurfaceId(drawerLayout), drawerLayout.id, v)) } override fun onDrawerOpened(view: View) { eventDispatcher.dispatchEvent( - DrawerOpenedEvent(UIManagerHelper.getSurfaceId(drawerLayout), drawerLayout.id) - ) + DrawerOpenedEvent(UIManagerHelper.getSurfaceId(drawerLayout), drawerLayout.id)) } override fun onDrawerClosed(view: View) { eventDispatcher.dispatchEvent( - DrawerClosedEvent(UIManagerHelper.getSurfaceId(drawerLayout), drawerLayout.id) - ) + DrawerClosedEvent(UIManagerHelper.getSurfaceId(drawerLayout), drawerLayout.id)) } override fun onDrawerStateChanged(i: Int) { eventDispatcher.dispatchEvent( - DrawerStateChangedEvent(UIManagerHelper.getSurfaceId(drawerLayout), drawerLayout.id, i) - ) + DrawerStateChangedEvent(UIManagerHelper.getSurfaceId(drawerLayout), drawerLayout.id, i)) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.kt index 3d40fbf95d7..61098ad9c38 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.kt @@ -44,13 +44,11 @@ public object ImageResizeMode { /** Converts JS resize modes into `Shader.TileMode`. See `ImageResizeMode.js`. */ @JvmStatic public fun toTileMode(resizeModeValue: String?): TileMode { - if ( - RESIZE_MODE_CONTAIN == resizeModeValue || - RESIZE_MODE_COVER == resizeModeValue || - RESIZE_MODE_STRETCH == resizeModeValue || - RESIZE_MODE_CENTER == resizeModeValue || - RESIZE_MODE_NONE == resizeModeValue - ) { + if (RESIZE_MODE_CONTAIN == resizeModeValue || + RESIZE_MODE_COVER == resizeModeValue || + RESIZE_MODE_STRETCH == resizeModeValue || + RESIZE_MODE_CENTER == resizeModeValue || + RESIZE_MODE_NONE == resizeModeValue) { return TileMode.CLAMP } if (RESIZE_MODE_REPEAT == resizeModeValue) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.kt index 9105b610374..ebbd7f7b3f1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.kt @@ -53,8 +53,7 @@ public constructor( replaceWith = ReplaceWith( expression = - "ReactImageManager(draweeControllerBuilder, globalImageLoadListener, callerContextFactory)" - ), + "ReactImageManager(draweeControllerBuilder, globalImageLoadListener, callerContextFactory)"), ) public constructor( draweeControllerBuilder: AbstractDraweeControllerBuilder<*, *, *, *>?, @@ -73,8 +72,7 @@ public constructor( replaceWith = ReplaceWith( expression = - "ReactImageManager(draweeControllerBuilder, globalImageLoadListener, callerContextFactory)" - ), + "ReactImageManager(draweeControllerBuilder, globalImageLoadListener, callerContextFactory)"), ) public constructor( draweeControllerBuilder: AbstractDraweeControllerBuilder<*, *, *, *>?, @@ -127,8 +125,7 @@ public constructor( callerContextFactory.getOrCreateCallerContext( (view.context as ThemedReactContext).moduleName, analyticTag, - ) - ) + )) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.kt index 233989e634e..af3f718e3fc 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.kt @@ -147,8 +147,7 @@ public class ReactImageView( imageSource?.source, loaded, total, - ) - ) + )) } override fun onSubmit(id: String, callerContext: Any?) { @@ -156,8 +155,7 @@ public class ReactImageView( return } eventDispatcher.dispatchEvent( - createLoadStartEvent(UIManagerHelper.getSurfaceId(this@ReactImageView), getId()) - ) + createLoadStartEvent(UIManagerHelper.getSurfaceId(this@ReactImageView), getId())) } override fun onFinalImageSet( @@ -173,11 +171,9 @@ public class ReactImageView( imageSource?.source, imageInfo.width, imageInfo.height, - ) - ) + )) eventDispatcher.dispatchEvent( - createLoadEndEvent(UIManagerHelper.getSurfaceId(this@ReactImageView), getId()) - ) + createLoadEndEvent(UIManagerHelper.getSurfaceId(this@ReactImageView), getId())) } } @@ -190,8 +186,7 @@ public class ReactImageView( UIManagerHelper.getSurfaceId(this@ReactImageView), getId(), throwable, - ) - ) + )) } } } @@ -596,10 +591,8 @@ public class ReactImageView( // 3. ReactImageView detects the null src; displays a warning in LogBox (via this code). // 3. LogBox renders an , which fabric preallocates. // 4. Rinse and repeat. - if ( - ReactBuildConfig.DEBUG && - !ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() - ) { + if (ReactBuildConfig.DEBUG && + !ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture()) { RNLog.w(context as ReactContext, "ReactImageView: Image source \"$uri\" doesn't exist") } } @@ -640,8 +633,7 @@ public class ReactImageView( private fun buildHierarchy(context: Context) = GenericDraweeHierarchyBuilder(context.resources) .setRoundingParams( - RoundingParams.fromCornersRadius(0f).apply { setPaintFilterBitmap(true) } - ) + RoundingParams.fromCornersRadius(0f).apply { setPaintFilterBitmap(true) }) .build() } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/MultiSourceHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/MultiSourceHelper.kt index 442ef575e87..31a144ddb74 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/MultiSourceHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/MultiSourceHelper.kt @@ -60,15 +60,13 @@ internal object MultiSourceHelper { bestPrecision = precision best = source } - if ( - precision < bestCachePrecision && - source.cacheControl != ImageCacheControl.RELOAD && - (imagePipeline.isInBitmapMemoryCache(source.uri) || - // TODO: T206445115 isInDiskCacheSync is a blocking operation, we should move this - // to - // a separate thread - imagePipeline.isInDiskCacheSync(source.uri)) - ) { + if (precision < bestCachePrecision && + source.cacheControl != ImageCacheControl.RELOAD && + (imagePipeline.isInBitmapMemoryCache(source.uri) || + // TODO: T206445115 isInDiskCacheSync is a blocking operation, we should move this + // to + // a separate thread + imagePipeline.isInDiskCacheSync(source.uri))) { bestCachePrecision = precision bestCached = source } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ResourceDrawableIdHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ResourceDrawableIdHelper.kt index e236d548fbb..43b9d2a5ae4 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ResourceDrawableIdHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ResourceDrawableIdHelper.kt @@ -79,7 +79,6 @@ public object ResourceDrawableIdHelper { */ @Deprecated("Use .instance instead, this API is for backward compat", ReplaceWith("instance")) @JvmName( - "DEPRECATED\$getInstance" - ) // We intentionally don't want to expose this accessor to Java. + "DEPRECATED\$getInstance") // We intentionally don't want to expose this accessor to Java. public fun getInstance(): ResourceDrawableIdHelper = this } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt index 0b928ca820c..ecdae30ae19 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt @@ -95,8 +95,7 @@ internal class ReactModalHostManager : if (dispatcher != null) { view.onRequestCloseListener = OnRequestCloseListener { dispatcher.dispatchEvent( - RequestCloseEvent(UIManagerHelper.getSurfaceId(reactContext), view.id) - ) + RequestCloseEvent(UIManagerHelper.getSurfaceId(reactContext), view.id)) } view.onShowListener = OnShowListener { dispatcher.dispatchEvent(ShowEvent(UIManagerHelper.getSurfaceId(reactContext), view.id)) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt index 994d4ce8159..48efe1652cf 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt @@ -323,8 +323,7 @@ public class ReactModalHostView(context: ThemedReactContext) : } return false } - } - ) + }) window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) if (hardwareAccelerated) { @@ -561,8 +560,7 @@ public class ReactModalHostView(context: ThemedReactContext) : .getNativeModule(UIManagerModule::class.java) ?.updateNodeSize(id, viewWidth, viewHeight) } - } - ) + }) } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/safeareaview/ReactSafeAreaView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/safeareaview/ReactSafeAreaView.kt index 86c25787dec..6c72a41f167 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/safeareaview/ReactSafeAreaView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/safeareaview/ReactSafeAreaView.kt @@ -29,8 +29,7 @@ internal class ReactSafeAreaView(val reactContext: ThemedReactContext) : ViewGro ViewCompat.setOnApplyWindowInsetsListener(this) { _, windowInsets -> val insets = windowInsets.getInsets( - WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout() - ) + WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()) updateState(insets) CONSUMED } @@ -61,8 +60,7 @@ internal class ReactSafeAreaView(val reactContext: ThemedReactContext) : ViewGro .getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java) ?.updateInsetsPadding(id, insets.top, insets.left, insets.bottom, insets.right) } - } - ) + }) } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.kt index 20e998d83e8..0b445644af6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.kt @@ -48,8 +48,7 @@ internal class MaintainVisibleScrollPositionHelper( UIManagerHelper.getUIManager( checkNotNull(scrollView?.context as ReactContext?), getUIManagerType(scrollView?.id ?: 0), - ) - ) + )) class Config internal constructor(val minIndexForVisible: Int, val autoScrollToTopThreshold: Int?) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.kt index 7898e999620..b40442cacd8 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.kt @@ -221,8 +221,7 @@ constructor(private val fpsListener: FpsListener? = null) : val child = scrollView.getChildAt(0) ?: throw RetryableMountingLayerException( - "scrollToEnd called on HorizontalScrollView without child" - ) + "scrollToEnd called on HorizontalScrollView without child") val right = child.width + scrollView.paddingRight scrollView.abortAnimation() if (data.mAnimated) { @@ -346,8 +345,7 @@ constructor(private val fpsListener: FpsListener? = null) : if (view.fadingEdgeLengthStart > 0 || view.fadingEdgeLengthEnd > 0) { view.isHorizontalFadingEdgeEnabled = true view.setFadingEdgeLength( - Math.round(Math.max(view.fadingEdgeLengthStart, view.fadingEdgeLengthEnd).dpToPx()) - ) + Math.round(Math.max(view.fadingEdgeLengthStart, view.fadingEdgeLengthEnd).dpToPx())) } else { view.isHorizontalFadingEdgeEnabled = false view.setFadingEdgeLength(0) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewAccessibilityDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewAccessibilityDelegate.kt index 56c6224230a..eb65ba3a8f5 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewAccessibilityDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewAccessibilityDelegate.kt @@ -31,8 +31,7 @@ internal class ReactScrollViewAccessibilityDelegate : AccessibilityDelegateCompa ReactSoftExceptionLogger.logSoftException( TAG, AssertionException( - "ReactScrollViewAccessibilityDelegate should only be used with ReactAccessibleScrollView, not with class: ${host.javaClass.simpleName}" - ), + "ReactScrollViewAccessibilityDelegate should only be used with ReactAccessibleScrollView, not with class: ${host.javaClass.simpleName}"), ) } } @@ -45,8 +44,7 @@ internal class ReactScrollViewAccessibilityDelegate : AccessibilityDelegateCompa ReactSoftExceptionLogger.logSoftException( TAG, AssertionException( - "ReactScrollViewAccessibilityDelegate should only be used with ReactAccessibleScrollView, not with class: ${host.javaClass.simpleName}" - ), + "ReactScrollViewAccessibilityDelegate should only be used with ReactAccessibleScrollView, not with class: ${host.javaClass.simpleName}"), ) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewCommandHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewCommandHelper.kt index a922cdbfd6f..f9b1d52c35a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewCommandHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewCommandHelper.kt @@ -40,8 +40,7 @@ public class ReactScrollViewCommandHelper { COMMAND_FLASH_SCROLL_INDICATORS -> viewManager.flashScrollIndicators(scrollView) else -> throw IllegalArgumentException( - "Unsupported command $commandType received by ${viewManager::class.java.simpleName}." - ) + "Unsupported command $commandType received by ${viewManager::class.java.simpleName}.") } } @@ -60,8 +59,7 @@ public class ReactScrollViewCommandHelper { "flashScrollIndicators" -> viewManager.flashScrollIndicators(scrollView) else -> throw IllegalArgumentException( - "Unsupported command $commandType received by ${viewManager::class.java.simpleName}." - ) + "Unsupported command $commandType received by ${viewManager::class.java.simpleName}.") } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt index ea5b3a3890e..53daa64348d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt @@ -66,26 +66,30 @@ public object ReactScrollViewHelper { /** Shared by [ReactScrollView] and [ReactHorizontalScrollView]. */ @JvmStatic - public fun emitScrollEvent(scrollView: T, xVelocity: Float, yVelocity: Float) - where T : HasScrollEventThrottle?, T : ViewGroup { + public fun emitScrollEvent(scrollView: T, xVelocity: Float, yVelocity: Float) where + T : HasScrollEventThrottle?, + T : ViewGroup { emitScrollEvent(scrollView, ScrollEventType.SCROLL, xVelocity, yVelocity) } @JvmStatic - public fun emitScrollBeginDragEvent(scrollView: T) - where T : HasScrollEventThrottle?, T : ViewGroup { + public fun emitScrollBeginDragEvent(scrollView: T) where + T : HasScrollEventThrottle?, + T : ViewGroup { emitScrollEvent(scrollView, ScrollEventType.BEGIN_DRAG) } @JvmStatic - public fun emitScrollEndDragEvent(scrollView: T, xVelocity: Float, yVelocity: Float) - where T : HasScrollEventThrottle?, T : ViewGroup { + public fun emitScrollEndDragEvent(scrollView: T, xVelocity: Float, yVelocity: Float) where + T : HasScrollEventThrottle?, + T : ViewGroup { emitScrollEvent(scrollView, ScrollEventType.END_DRAG, xVelocity, yVelocity) } @JvmStatic - public fun emitScrollMomentumBeginEvent(scrollView: T, xVelocity: Int, yVelocity: Int) - where T : HasScrollEventThrottle?, T : ViewGroup { + public fun emitScrollMomentumBeginEvent(scrollView: T, xVelocity: Int, yVelocity: Int) where + T : HasScrollEventThrottle?, + T : ViewGroup { emitScrollEvent( scrollView, ScrollEventType.MOMENTUM_BEGIN, @@ -95,13 +99,15 @@ public object ReactScrollViewHelper { } @JvmStatic - public fun emitScrollMomentumEndEvent(scrollView: T) - where T : HasScrollEventThrottle?, T : ViewGroup { + public fun emitScrollMomentumEndEvent(scrollView: T) where + T : HasScrollEventThrottle?, + T : ViewGroup { emitScrollEvent(scrollView, ScrollEventType.MOMENTUM_END) } - private fun emitScrollEvent(scrollView: T, scrollEventType: ScrollEventType) - where T : HasScrollEventThrottle?, T : ViewGroup { + private fun emitScrollEvent(scrollView: T, scrollEventType: ScrollEventType) where + T : HasScrollEventThrottle?, + T : ViewGroup { emitScrollEvent(scrollView, scrollEventType, 0f, 0f) } @@ -115,10 +121,8 @@ public object ReactScrollViewHelper { // Throttle the scroll event if scrollEventThrottle is set to be equal or more than 17 ms. // We limit the delta to 17ms so that small throttles intended to enable 60fps updates will not // inadvertently filter out any scroll events. - if ( - scrollEventType == ScrollEventType.SCROLL && - scrollView.scrollEventThrottle >= max(17, now - scrollView.lastScrollDispatchTime) - ) { + if (scrollEventType == ScrollEventType.SCROLL && + scrollView.scrollEventThrottle >= max(17, now - scrollView.lastScrollDispatchTime)) { // Scroll events are throttled. return } @@ -148,8 +152,7 @@ public object ReactScrollViewHelper { contentView.height, scrollView.width, scrollView.height, - ) - ) + )) if (scrollEventType == ScrollEventType.SCROLL) { scrollView.lastScrollDispatchTime = now } @@ -265,8 +268,11 @@ public object ReactScrollViewHelper { * y), then apply that to the animator. */ @JvmStatic - public fun smoothScrollTo(scrollView: T, x: Int, y: Int) - where T : HasFlingAnimator?, T : HasScrollState?, T : HasStateWrapper?, T : ViewGroup { + public fun smoothScrollTo(scrollView: T, x: Int, y: Int) where + T : HasFlingAnimator?, + T : HasScrollState?, + T : HasStateWrapper?, + T : ViewGroup { if (DEBUG_MODE) { FLog.i(TAG, "smoothScrollTo[%d] x %d y %d", scrollView.id, x, y) } @@ -307,9 +313,8 @@ public object ReactScrollViewHelper { // the final animated value, we will return the final animated value. This is because follow up // animation should consider the "would be" animated location, so that previous quick small // scrolls are still working. - return if ( - !scrollState.isFinished || (scrollState.isCanceled && isMovingTowardsAnimatedValue) - ) { + return if (!scrollState.isFinished || + (scrollState.isCanceled && isMovingTowardsAnimatedValue)) { postAnimationValue } else { currentValue @@ -317,16 +322,21 @@ public object ReactScrollViewHelper { } @JvmStatic - public fun updateFabricScrollState(scrollView: T) - where T : HasFlingAnimator?, T : HasScrollState?, T : HasStateWrapper?, T : ViewGroup { + public fun updateFabricScrollState(scrollView: T) where + T : HasFlingAnimator?, + T : HasScrollState?, + T : HasStateWrapper?, + T : ViewGroup { updateFabricScrollState(scrollView, scrollView.scrollX, scrollView.scrollY) } /** * Called on any stabilized onScroll change to propagate content offset value to a Shadow Node. */ - public fun updateFabricScrollState(scrollView: T, scrollX: Int, scrollY: Int) - where T : HasScrollState?, T : HasStateWrapper?, T : ViewGroup { + public fun updateFabricScrollState(scrollView: T, scrollX: Int, scrollY: Int) where + T : HasScrollState?, + T : HasStateWrapper?, + T : ViewGroup { if (DEBUG_MODE) { FLog.i( TAG, @@ -354,8 +364,10 @@ public object ReactScrollViewHelper { } @JvmStatic - public fun forceUpdateState(scrollView: T) - where T : HasScrollState?, T : HasStateWrapper?, T : ViewGroup { + public fun forceUpdateState(scrollView: T) where + T : HasScrollState?, + T : HasStateWrapper?, + T : ViewGroup { val scrollState = scrollView.reactScrollViewScrollState val scrollAwayPaddingTop = scrollState.scrollAwayPaddingTop val scrollPos = scrollState.lastStateUpdateScroll @@ -384,13 +396,16 @@ public object ReactScrollViewHelper { } @JvmStatic - public fun updateStateOnScrollChanged(scrollView: T, xVelocity: Float, yVelocity: Float) - where - T : HasFlingAnimator?, - T : HasScrollEventThrottle?, - T : HasScrollState?, - T : HasStateWrapper?, - T : ViewGroup { + public fun updateStateOnScrollChanged( + scrollView: T, + xVelocity: Float, + yVelocity: Float + ) where + T : HasFlingAnimator?, + T : HasScrollEventThrottle?, + T : HasScrollState?, + T : HasStateWrapper?, + T : ViewGroup { // Race an UpdateState with every onScroll. This makes it more likely that, in Fabric, // when JS processes the scroll event, the C++ ShadowNode representation will have a // "more correct" scroll position. It will frequently be /incorrect/ but this decreases @@ -399,8 +414,11 @@ public object ReactScrollViewHelper { emitScrollEvent(scrollView, xVelocity, yVelocity) } - public fun registerFlingAnimator(scrollView: T) - where T : HasFlingAnimator?, T : HasScrollState?, T : HasStateWrapper?, T : ViewGroup { + public fun registerFlingAnimator(scrollView: T) where + T : HasFlingAnimator?, + T : HasScrollState?, + T : HasStateWrapper?, + T : ViewGroup { scrollView .getFlingAnimator() .addListener( @@ -423,13 +441,14 @@ public object ReactScrollViewHelper { } override fun onAnimationRepeat(animator: Animator) = Unit - } - ) + }) } @JvmStatic - public fun dispatchMomentumEndOnAnimationEnd(scrollView: T) - where T : HasFlingAnimator?, T : HasScrollEventThrottle?, T : ViewGroup { + public fun dispatchMomentumEndOnAnimationEnd(scrollView: T) where + T : HasFlingAnimator?, + T : HasScrollEventThrottle?, + T : ViewGroup { scrollView .getFlingAnimator() .addListener( @@ -447,8 +466,7 @@ public object ReactScrollViewHelper { } override fun onAnimationRepeat(animator: Animator) = Unit - } - ) + }) } @JvmStatic diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt index 089d9260e7c..9d087fc1069 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt @@ -289,8 +289,7 @@ constructor(private val fpsListener: FpsListener? = null) : val child = scrollView.getChildAt(0) ?: throw RetryableMountingLayerException( - "scrollToEnd called on ScrollView without child" - ) + "scrollToEnd called on ScrollView without child") // ScrollView always has one child - the scrollable area val bottom = child.height + scrollView.paddingBottom @@ -335,8 +334,7 @@ constructor(private val fpsListener: FpsListener? = null) : if (view.fadingEdgeLengthStart > 0 || view.fadingEdgeLengthEnd > 0) { view.isVerticalFadingEdgeEnabled = true view.setFadingEdgeLength( - Math.round(Math.max(view.fadingEdgeLengthStart, view.fadingEdgeLengthEnd).dpToPx()) - ) + Math.round(Math.max(view.fadingEdgeLengthStart, view.fadingEdgeLengthEnd).dpToPx())) } else { view.isVerticalFadingEdgeEnabled = false view.setFadingEdgeLength(0) @@ -352,8 +350,7 @@ constructor(private val fpsListener: FpsListener? = null) : public fun setMaintainVisibleContentPosition(view: ReactScrollView, value: ReadableMap?) { if (value != null) { view.setMaintainVisibleContentPosition( - MaintainVisibleScrollPositionHelper.Config.fromReadableMap(value) - ) + MaintainVisibleScrollPositionHelper.Config.fromReadableMap(value)) } else { view.setMaintainVisibleContentPosition(null) } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEvent.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEvent.kt index 7b2f7977e9c..2e612c9ae1a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEvent.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEvent.kt @@ -151,8 +151,7 @@ public class ScrollEvent private constructor() : Event() { @Deprecated( "Use the obtain version that explicitly takes surfaceId as an argument", ReplaceWith( - "obtain(surfaceId, viewTag, scrollEventType, scrollX, scrollY, xVelocity, yVelocity, contentWidth, contentHeight, scrollViewWidth, scrollViewHeight)" - ), + "obtain(surfaceId, viewTag, scrollEventType, scrollX, scrollY, xVelocity, yVelocity, contentWidth, contentHeight, scrollViewWidth, scrollViewHeight)"), ) @JvmStatic public fun obtain( diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.kt index 0a6a9e2286e..e0638e03829 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.kt @@ -123,15 +123,13 @@ internal open class SwipeRefreshLayoutManager : mutableMapOf( "DEFAULT" to SwipeRefreshLayout.DEFAULT, "LARGE" to SwipeRefreshLayout.LARGE, - ) - ) + )) override fun getExportedCustomDirectEventTypeConstants(): MutableMap { val baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants() val eventTypeConstants: MutableMap = baseEventTypeConstants ?: HashMap() eventTypeConstants.putAll( - mutableMapOf("topRefresh" to mutableMapOf("registrationName" to "onRefresh")) - ) + mutableMapOf("topRefresh" to mutableMapOf("registrationName" to "onRefresh"))) return eventTypeConstants } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.kt index e9a36bf990f..2337f11ceb9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.kt @@ -141,8 +141,7 @@ internal class ReactSwitchManager : val reactTag = buttonView.id UIManagerHelper.getEventDispatcherForReactTag(reactContext, reactTag) ?.dispatchEvent( - ReactSwitchEvent(UIManagerHelper.getSurfaceId(reactContext), reactTag, isChecked) - ) + ReactSwitchEvent(UIManagerHelper.getSurfaceId(reactContext), reactTag, isChecked)) } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt index 38570086f38..93e93451a4d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt @@ -135,8 +135,7 @@ internal class PreparedLayoutTextView(context: Context) : ViewGroup(context), Re val layout = checkNotNull(preparedLayout).layout if (start < 0 || end > layout.text.length || start >= end) { throw IllegalArgumentException( - "setSelection start and end are not in valid range. start: $start, end: $end, text length: ${layout.text.length}" - ) + "setSelection start and end are not in valid range. start: $start, end: $end, text length: ${layout.text.length}") } val textSelection = selection @@ -211,19 +210,15 @@ internal class PreparedLayoutTextView(context: Context) : ViewGroup(context), Re for (span in spans) { val spanFlags = spanned.getSpanFlags(span) val inclusiveStart = - if ( - (spanFlags and Spanned.SPAN_INCLUSIVE_INCLUSIVE) != 0 || - (spanFlags and Spanned.SPAN_INCLUSIVE_EXCLUSIVE) != 0 - ) { + if ((spanFlags and Spanned.SPAN_INCLUSIVE_INCLUSIVE) != 0 || + (spanFlags and Spanned.SPAN_INCLUSIVE_EXCLUSIVE) != 0) { spanned.getSpanStart(span) } else { spanned.getSpanStart(span) + 1 } val inclusiveEnd = - if ( - (spanFlags and Spanned.SPAN_INCLUSIVE_INCLUSIVE) != 0 || - (spanFlags and Spanned.SPAN_EXCLUSIVE_INCLUSIVE) != 0 - ) { + if ((spanFlags and Spanned.SPAN_INCLUSIVE_INCLUSIVE) != 0 || + (spanFlags and Spanned.SPAN_EXCLUSIVE_INCLUSIVE) != 0) { spanned.getSpanEnd(span) } else { spanned.getSpanEnd(span) - 1 @@ -299,10 +294,8 @@ internal class PreparedLayoutTextView(context: Context) : ViewGroup(context), Re } super.onFocusChanged(gainFocus, direction, previouslyFocusedRect) val accessibilityDelegateCompat = ViewCompat.getAccessibilityDelegate(this) - if ( - accessibilityDelegateCompat != null && - accessibilityDelegateCompat is ReactTextViewAccessibilityDelegate - ) { + if (accessibilityDelegateCompat != null && + accessibilityDelegateCompat is ReactTextViewAccessibilityDelegate) { accessibilityDelegateCompat.onFocusChanged(gainFocus, direction, previouslyFocusedRect) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.kt index f4f0f2396e2..bb7477ac585 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.kt @@ -64,8 +64,7 @@ import com.facebook.yoga.YogaUnit */ @LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR) @Deprecated( - message = "This class is part of Legacy Architecture and will be removed in a future release" -) + message = "This class is part of Legacy Architecture and will be removed in a future release") public abstract class ReactBaseTextShadowNode @JvmOverloads public constructor( @@ -544,8 +543,7 @@ public constructor( sb.length - INLINE_VIEW_PLACEHOLDER.length, sb.length, child.buildInlineImageSpan(), - ) - ) + )) } else if (supportsInlineViews) { val reactTag = child.reactTag val widthValue = child.styleWidth @@ -574,15 +572,13 @@ public constructor( sb.length - INLINE_VIEW_PLACEHOLDER.length, sb.length, TextInlineViewPlaceholderSpan(reactTag, width.toInt(), height.toInt()), - ) - ) + )) // supportsInlineViews is true, so we can assume that inlineViews is not null checkNotNull(inlineViews)[reactTag] = child } else { throw IllegalViewOperationException( - "Unexpected view type nested under a or node: ${child.javaClass}" - ) + "Unexpected view type nested under a or node: ${child.javaClass}") } child.markUpdateSeen() i++ @@ -594,8 +590,8 @@ public constructor( } if (textShadowNode.isBackgroundColorSet) { ops.add( - SetSpanOperation(start, end, ReactBackgroundColorSpan(textShadowNode.backgroundColor)) - ) + SetSpanOperation( + start, end, ReactBackgroundColorSpan(textShadowNode.backgroundColor))) } val roleIsLink = if (textShadowNode.role != null) @@ -605,26 +601,21 @@ public constructor( ops.add(SetSpanOperation(start, end, ReactClickableSpan(textShadowNode.reactTag))) } val effectiveLetterSpacing = textAttributes.effectiveLetterSpacing - if ( - !java.lang.Float.isNaN(effectiveLetterSpacing) && - (parentTextAttributes == null || - parentTextAttributes.effectiveLetterSpacing != effectiveLetterSpacing) - ) { + if (!java.lang.Float.isNaN(effectiveLetterSpacing) && + (parentTextAttributes == null || + parentTextAttributes.effectiveLetterSpacing != effectiveLetterSpacing)) { ops.add(SetSpanOperation(start, end, CustomLetterSpacingSpan(effectiveLetterSpacing))) } val effectiveFontSize = textAttributes.effectiveFontSize if ( // `getEffectiveFontSize` always returns a value so don't need to check for anything - // like `Float.NaN`. - parentTextAttributes == null || - parentTextAttributes.effectiveFontSize != effectiveFontSize - ) { + // like `Float.NaN`. + parentTextAttributes == null || + parentTextAttributes.effectiveFontSize != effectiveFontSize) { ops.add(SetSpanOperation(start, end, ReactAbsoluteSizeSpan(effectiveFontSize))) } - if ( - textShadowNode.fontStyle != ReactConstants.UNSET || - textShadowNode.fontWeight != ReactConstants.UNSET || - textShadowNode.fontFamily != null - ) { + if (textShadowNode.fontStyle != ReactConstants.UNSET || + textShadowNode.fontWeight != ReactConstants.UNSET || + textShadowNode.fontFamily != null) { ops.add( SetSpanOperation( start, @@ -636,8 +627,7 @@ public constructor( textShadowNode.fontFamily, textShadowNode.themedContext.assets, ), - ) - ) + )) } if (textShadowNode.isUnderlineTextDecorationSet) { ops.add(SetSpanOperation(start, end, ReactUnderlineSpan())) @@ -645,12 +635,10 @@ public constructor( if (textShadowNode.isLineThroughTextDecorationSet) { ops.add(SetSpanOperation(start, end, ReactStrikethroughSpan())) } - if ( - (textShadowNode.textShadowOffsetDx != 0f || - textShadowNode.textShadowOffsetDy != 0f || - textShadowNode.textShadowRadius != 0f) && - Color.alpha(textShadowNode.textShadowColor) != 0 - ) { + if ((textShadowNode.textShadowOffsetDx != 0f || + textShadowNode.textShadowOffsetDy != 0f || + textShadowNode.textShadowRadius != 0f) && + Color.alpha(textShadowNode.textShadowColor) != 0) { ops.add( SetSpanOperation( start, @@ -661,15 +649,12 @@ public constructor( textShadowNode.textShadowRadius, textShadowNode.textShadowColor, ), - ) - ) + )) } val effectiveLineHeight = textAttributes.effectiveLineHeight - if ( - !java.lang.Float.isNaN(effectiveLineHeight) && - (parentTextAttributes == null || - parentTextAttributes.effectiveLineHeight != effectiveLineHeight) - ) { + if (!java.lang.Float.isNaN(effectiveLineHeight) && + (parentTextAttributes == null || + parentTextAttributes.effectiveLineHeight != effectiveLineHeight)) { ops.add(SetSpanOperation(start, end, CustomLineHeightSpan(effectiveLineHeight))) } ops.add(SetSpanOperation(start, end, ReactTagSpan(textShadowNode.reactTag))) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.kt index c6936b4ea35..425f015af63 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.kt @@ -15,8 +15,7 @@ import com.facebook.react.common.assets.ReactFontManager as ReactFontAssetManage /** Responsible for loading and caching Typeface objects. */ @Deprecated( message = - "This class is deprecated and will be deleted in the near future. Please use [com.facebook.react.common.assets.ReactFontManager] instead." -) + "This class is deprecated and will be deleted in the near future. Please use [com.facebook.react.common.assets.ReactFontManager] instead.") @Suppress("DEPRECATION") public class ReactFontManager private constructor(private val delegate: ReactFontAssetManager) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.kt index 12f48e5bc97..2ce7dda4d0a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.kt @@ -38,9 +38,7 @@ import com.facebook.react.views.text.DefaultStyleValuesUtil.getDefaultTextColorH */ @UnstableReactNativeAPI public abstract class ReactTextAnchorViewManager< - @Suppress("DEPRECATION") - C : ReactBaseTextShadowNode? -> : BaseViewManager() { + @Suppress("DEPRECATION") C : ReactBaseTextShadowNode?> : BaseViewManager() { @ReactProp(name = "accessible") internal fun setAccessible(view: ReactTextView, accessible: Boolean) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.kt index 53f047be4b9..592ac2652f4 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.kt @@ -6,8 +6,7 @@ */ @file:Suppress( - "DEPRECATION" -) // silents "interface RCTEventEmitter : JavaScriptModule' is deprecated." + "DEPRECATION") // silents "interface RCTEventEmitter : JavaScriptModule' is deprecated." package com.facebook.react.views.text @@ -77,11 +76,9 @@ public constructor(reactTextViewManagerCallback: ReactTextViewManagerCallback? = // Minimum font size is 4pts to match the iOS implementation. val minimumFontSize = max((minimumFontScale * initialFontSize), PixelUtil.toPixelFromDIP(4f)).toInt() - while ( - currentFontSize > minimumFontSize && - ((numberOfLines != ReactConstants.UNSET && layout.lineCount > numberOfLines) || - (heightMode != YogaMeasureMode.UNDEFINED && layout.height > height)) - ) { + while (currentFontSize > minimumFontSize && + ((numberOfLines != ReactConstants.UNSET && layout.lineCount > numberOfLines) || + (heightMode != YogaMeasureMode.UNDEFINED && layout.height > height))) { // TODO: We could probably use a smarter algorithm here. This will require 0(n) // measurements // based on the number of points the font size needs to be reduced by. @@ -92,8 +89,7 @@ public constructor(reactTextViewManagerCallback: ReactTextViewManagerCallback? = for (span in sizeSpans) { text.setSpan( ReactAbsoluteSizeSpan( - max((span.size * ratio).toDouble(), minimumFontSize.toDouble()).toInt() - ), + max((span.size * ratio).toDouble(), minimumFontSize.toDouble()).toInt()), text.getSpanStart(span), text.getSpanEnd(span), text.getSpanFlags(span), @@ -204,11 +200,9 @@ public constructor(reactTextViewManagerCallback: ReactTextViewManagerCallback? = else -> Layout.Alignment.ALIGN_NORMAL } - if ( - boring == null && - (unconstrainedWidth || - (!YogaConstants.isUndefined(desiredWidth) && desiredWidth <= width)) - ) { + if (boring == null && + (unconstrainedWidth || + (!YogaConstants.isUndefined(desiredWidth) && desiredWidth <= width))) { // Is used when the width is not known and the text is not boring, ie. if it contains // unicode characters. val hintWidth = ceil(desiredWidth.toDouble()).toInt() diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewAccessibilityDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewAccessibilityDelegate.kt index 9706c8effdd..104de65f5b7 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewAccessibilityDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewAccessibilityDelegate.kt @@ -36,16 +36,14 @@ internal class ReactTextViewAccessibilityDelegate( fun setDelegate(view: View, originalFocus: Boolean, originalImportantForAccessibility: Int) { // if a view already has an accessibility delegate, replacing it could cause // problems,so leave it alone. - if ( - !ViewCompat.hasAccessibilityDelegate(view) && - (view.getTag(R.id.accessibility_role) != null || - view.getTag(R.id.accessibility_state) != null || - view.getTag(R.id.accessibility_actions) != null || - view.getTag(R.id.react_test_id) != null || - view.getTag(R.id.accessibility_collection_item) != null || - view.getTag(R.id.accessibility_links) != null || - view.getTag(R.id.role) != null) - ) { + if (!ViewCompat.hasAccessibilityDelegate(view) && + (view.getTag(R.id.accessibility_role) != null || + view.getTag(R.id.accessibility_state) != null || + view.getTag(R.id.accessibility_actions) != null || + view.getTag(R.id.react_test_id) != null || + view.getTag(R.id.accessibility_collection_item) != null || + view.getTag(R.id.accessibility_links) != null || + view.getTag(R.id.role) != null)) { ViewCompat.setAccessibilityDelegate( view, ReactTextViewAccessibilityDelegate( @@ -122,10 +120,8 @@ internal class ReactTextViewAccessibilityDelegate( override fun getVirtualViewAt(x: Float, y: Float): Int { val accessibilityLinks = accessibilityLinks ?: return INVALID_ID - if ( - accessibilityLinks.size() == 0 || - (hostView !is TextView && hostView !is PreparedLayoutTextView) - ) { + if (accessibilityLinks.size() == 0 || + (hostView !is TextView && hostView !is PreparedLayoutTextView)) { return INVALID_ID } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt index 180f1059463..46aeb11fa20 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt @@ -151,8 +151,7 @@ public constructor( val textBreakStrategy = TextAttributeProps.getTextBreakStrategy( - paragraphAttributes.getString(TextLayoutManager.PA_KEY_TEXT_BREAK_STRATEGY) - ) + paragraphAttributes.getString(TextLayoutManager.PA_KEY_TEXT_BREAK_STRATEGY)) val currentJustificationMode = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) 0 else view.justificationMode diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt index 433afa5793a..f4ed15541a3 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt @@ -272,15 +272,12 @@ public class TextAttributeProps private constructor() { textShadowOffsetDy = 0f if (offsetMap != null) { - if ( - offsetMap.hasKey(PROP_SHADOW_OFFSET_WIDTH) && !offsetMap.isNull(PROP_SHADOW_OFFSET_WIDTH) - ) { + if (offsetMap.hasKey(PROP_SHADOW_OFFSET_WIDTH) && + !offsetMap.isNull(PROP_SHADOW_OFFSET_WIDTH)) { textShadowOffsetDx = toPixelFromDIP(offsetMap.getDouble(PROP_SHADOW_OFFSET_WIDTH)) } - if ( - offsetMap.hasKey(PROP_SHADOW_OFFSET_HEIGHT) && - !offsetMap.isNull(PROP_SHADOW_OFFSET_HEIGHT) - ) { + if (offsetMap.hasKey(PROP_SHADOW_OFFSET_HEIGHT) && + !offsetMap.isNull(PROP_SHADOW_OFFSET_HEIGHT)) { textShadowOffsetDy = toPixelFromDIP(offsetMap.getDouble(PROP_SHADOW_OFFSET_HEIGHT)) } } @@ -464,8 +461,7 @@ public class TextAttributeProps private constructor() { result.includeFontPadding = getBooleanProp(props, ViewProps.INCLUDE_FONT_PADDING, true) result.setTextDecorationLine(getStringProp(props, ViewProps.TEXT_DECORATION_LINE)) result.setTextShadowOffset( - if (props.hasKey(PROP_SHADOW_OFFSET)) props.getMap(PROP_SHADOW_OFFSET) else null - ) + if (props.hasKey(PROP_SHADOW_OFFSET)) props.getMap(PROP_SHADOW_OFFSET) else null) result.textShadowRadius = getFloatProp(props, PROP_SHADOW_RADIUS, 1f) result.textShadowColor = getIntProp(props, PROP_SHADOW_COLOR, DEFAULT_TEXT_SHADOW_COLOR) result.setTextTransform(getStringProp(props, PROP_TEXT_TRANSFORM)) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.kt index bdbbbfbfcd3..bf437bd8319 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.kt @@ -52,9 +52,9 @@ public class TextAttributes { public var maxFontSizeMultiplier: Float = Float.NaN set(maxFontSizeMultiplier) { - if ( - maxFontSizeMultiplier != 0f && maxFontSizeMultiplier < 1 && !maxFontSizeMultiplier.isNaN() - ) { + if (maxFontSizeMultiplier != 0f && + maxFontSizeMultiplier < 1 && + !maxFontSizeMultiplier.isNaN()) { FLog.w(ReactConstants.TAG, "maxFontSizeMultiplier must be NaN, 0, or >= 1") field = Float.NaN return diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt index 5a893fdd2b5..4fa781b1336 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt @@ -132,8 +132,8 @@ internal object TextLayoutManager { } return TextAttributeProps.getLayoutDirection( - textAttributes.getString(TextAttributeProps.TA_KEY_LAYOUT_DIRECTION.toInt()) - ) == LayoutDirection.RTL + textAttributes.getString(TextAttributeProps.TA_KEY_LAYOUT_DIRECTION.toInt())) == + LayoutDirection.RTL } private fun getTextAlignmentAttr(attributedString: MapBuffer): String? { @@ -231,8 +231,7 @@ internal object TextLayoutManager { TextAttributeProps.fromMapBuffer(fragment.getMapBuffer(FR_KEY_TEXT_ATTRIBUTES)) sb.append( - TextTransform.apply(fragment.getString(FR_KEY_STRING), textAttributes.textTransform) - ) + TextTransform.apply(fragment.getString(FR_KEY_STRING), textAttributes.textTransform)) val end = sb.length val reactTag = @@ -245,8 +244,7 @@ internal object TextLayoutManager { sb.length - 1, sb.length, TextInlineViewPlaceholderSpan(reactTag, width.toInt(), height.toInt()), - ) - ) + )) } else if (end >= start) { val roleIsLink = if (textAttributes.role != null) @@ -278,15 +276,12 @@ internal object TextLayoutManager { } if (!textAttributes.letterSpacing.isNaN()) { ops.add( - SetSpanOperation(start, end, CustomLetterSpacingSpan(textAttributes.letterSpacing)) - ) + SetSpanOperation(start, end, CustomLetterSpacingSpan(textAttributes.letterSpacing))) } ops.add(SetSpanOperation(start, end, ReactAbsoluteSizeSpan(textAttributes.fontSize))) - if ( - textAttributes.fontStyle != ReactConstants.UNSET || - textAttributes.fontWeight != ReactConstants.UNSET || - textAttributes.fontFamily != null - ) { + if (textAttributes.fontStyle != ReactConstants.UNSET || + textAttributes.fontWeight != ReactConstants.UNSET || + textAttributes.fontFamily != null) { ops.add( SetSpanOperation( start, @@ -298,8 +293,7 @@ internal object TextLayoutManager { textAttributes.fontFamily, context.assets, ), - ) - ) + )) } if (textAttributes.isUnderlineTextDecorationSet) { ops.add(SetSpanOperation(start, end, ReactUnderlineSpan())) @@ -307,12 +301,10 @@ internal object TextLayoutManager { if (textAttributes.isLineThroughTextDecorationSet) { ops.add(SetSpanOperation(start, end, ReactStrikethroughSpan())) } - if ( - (textAttributes.textShadowOffsetDx != 0f || - textAttributes.textShadowOffsetDy != 0f || - textAttributes.textShadowRadius != 0f) && - Color.alpha(textAttributes.textShadowColor) != 0 - ) { + if ((textAttributes.textShadowOffsetDx != 0f || + textAttributes.textShadowOffsetDy != 0f || + textAttributes.textShadowRadius != 0f) && + Color.alpha(textAttributes.textShadowColor) != 0) { ops.add( SetSpanOperation( start, @@ -323,8 +315,7 @@ internal object TextLayoutManager { textAttributes.textShadowRadius, textAttributes.textShadowColor, ), - ) - ) + )) } if (!textAttributes.lineHeight.isNaN()) { ops.add(SetSpanOperation(start, end, CustomLineHeightSpan(textAttributes.lineHeight))) @@ -389,8 +380,7 @@ internal object TextLayoutManager { } else { Double.NaN }, - ) - ) + )) } val spannable = SpannableString(text) @@ -461,11 +451,9 @@ internal object TextLayoutManager { spannable.setSpan(ReactAbsoluteSizeSpan(fragment.props.fontSize), start, end, spanFlags) - if ( - fragment.props.fontStyle != ReactConstants.UNSET || - fragment.props.fontWeight != ReactConstants.UNSET || - fragment.props.fontFamily != null - ) { + if (fragment.props.fontStyle != ReactConstants.UNSET || + fragment.props.fontWeight != ReactConstants.UNSET || + fragment.props.fontFamily != null) { spannable.setSpan( CustomStyleSpan( fragment.props.fontStyle, @@ -488,12 +476,10 @@ internal object TextLayoutManager { spannable.setSpan(ReactStrikethroughSpan(), start, end, spanFlags) } - if ( - (fragment.props.textShadowOffsetDx != 0f || - fragment.props.textShadowOffsetDy != 0f || - fragment.props.textShadowRadius != 0f) && - Color.alpha(fragment.props.textShadowColor) != 0 - ) { + if ((fragment.props.textShadowOffsetDx != 0f || + fragment.props.textShadowOffsetDy != 0f || + fragment.props.textShadowRadius != 0f) && + Color.alpha(fragment.props.textShadowColor) != 0) { spannable.setSpan( ShadowStyleSpan( fragment.props.textShadowOffsetDx, @@ -601,10 +587,8 @@ internal object TextLayoutManager { ): Layout { // If our text is boring, and fully fits in the available space, we can represent the text // layout as a BoringLayout - if ( - boring != null && - (widthYogaMeasureMode == YogaMeasureMode.UNDEFINED || boring.width <= floor(width)) - ) { + if (boring != null && + (widthYogaMeasureMode == YogaMeasureMode.UNDEFINED || boring.width <= floor(width))) { val layoutWidth = if (widthYogaMeasureMode == YogaMeasureMode.EXACTLY) floor(width).toInt() else boring.width @@ -665,11 +649,9 @@ internal object TextLayoutManager { paint.textSize = baseTextAttributes.fontSize.toFloat() } - if ( - baseTextAttributes.fontStyle != ReactConstants.UNSET || - baseTextAttributes.fontWeight != ReactConstants.UNSET || - baseTextAttributes.fontFamily != null - ) { + if (baseTextAttributes.fontStyle != ReactConstants.UNSET || + baseTextAttributes.fontWeight != ReactConstants.UNSET || + baseTextAttributes.fontFamily != null) { val typeface = ReactTypefaceUtils.applyStyles( null, @@ -680,10 +662,8 @@ internal object TextLayoutManager { ) paint.setTypeface(typeface) - if ( - baseTextAttributes.fontStyle != ReactConstants.UNSET && - baseTextAttributes.fontStyle != typeface.style - ) { + if (baseTextAttributes.fontStyle != ReactConstants.UNSET && + baseTextAttributes.fontStyle != typeface.style) { // https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/widget/TextView.java;l=2536;drc=d262a68a1e0c3b640274b094a7f1e3a5b75563e9 val missingStyle = baseTextAttributes.fontStyle and typeface.style.inv() paint.isFakeBoldText = missingStyle and Typeface.BOLD != 0 @@ -765,16 +745,14 @@ internal object TextLayoutManager { val textBreakStrategy = TextAttributeProps.getTextBreakStrategy( - paragraphAttributes.getString(PA_KEY_TEXT_BREAK_STRATEGY) - ) + paragraphAttributes.getString(PA_KEY_TEXT_BREAK_STRATEGY)) val includeFontPadding = if (paragraphAttributes.contains(PA_KEY_INCLUDE_FONT_PADDING)) paragraphAttributes.getBoolean(PA_KEY_INCLUDE_FONT_PADDING) else DEFAULT_INCLUDE_FONT_PADDING val hyphenationFrequency = TextAttributeProps.getHyphenationFrequency( - paragraphAttributes.getString(PA_KEY_HYPHENATION_FREQUENCY) - ) + paragraphAttributes.getString(PA_KEY_HYPHENATION_FREQUENCY)) val adjustFontSizeToFit = if (paragraphAttributes.contains(PA_KEY_ADJUST_FONT_SIZE_TO_FIT)) paragraphAttributes.getBoolean(PA_KEY_ADJUST_FONT_SIZE_TO_FIT) @@ -786,8 +764,7 @@ internal object TextLayoutManager { val ellipsizeMode = if (paragraphAttributes.contains(PA_KEY_ELLIPSIZE_MODE)) TextAttributeProps.getEllipsizeMode( - paragraphAttributes.getString(PA_KEY_ELLIPSIZE_MODE) - ) + paragraphAttributes.getString(PA_KEY_ELLIPSIZE_MODE)) else null // T226571629: textAlign should be moved to ParagraphAttributes @@ -930,14 +907,12 @@ internal object TextLayoutManager { } val initialFontSize = currentFontSize - while ( - currentFontSize > minimumFontSize && - ((maximumNumberOfLines != ReactConstants.UNSET && - maximumNumberOfLines != 0 && - layout.lineCount > maximumNumberOfLines) || - (heightYogaMeasureMode != YogaMeasureMode.UNDEFINED && layout.height > height) || - (text.length == 1 && layout.getLineWidth(0) > width)) - ) { + while (currentFontSize > minimumFontSize && + ((maximumNumberOfLines != ReactConstants.UNSET && + maximumNumberOfLines != 0 && + layout.lineCount > maximumNumberOfLines) || + (heightYogaMeasureMode != YogaMeasureMode.UNDEFINED && layout.height > height) || + (text.length == 1 && layout.getLineWidth(0) > width))) { // TODO: We could probably use a smarter algorithm here. This will require 0(n) // measurements based on the number of points the font size needs to be reduced by. currentFontSize -= max(1, 1.dpToPx().toInt()) @@ -1219,15 +1194,12 @@ internal object TextLayoutManager { // There's a bug on Samsung devices where calling getPrimaryHorizontal on // the last offset in the layout will result in an endless loop. Work around // this bug by avoiding getPrimaryHorizontal in that case. - if ( - !ReactNativeFeatureFlags.disableOldAndroidAttachmentMetricsWorkarounds() && - start == text.length - 1 - ) { + if (!ReactNativeFeatureFlags.disableOldAndroidAttachmentMetricsWorkarounds() && + start == text.length - 1) { val endsWithNewLine = text.length > 0 && text[layout.getLineEnd(line) - 1] == '\n' val lineWidth = if (endsWithNewLine) layout.getLineMax(line) else layout.getLineWidth(line) placeholderLeftPosition = - if ( - isRtlParagraph // Equivalent to `layout.getLineLeft(line)` but `getLineLeft` returns + if (isRtlParagraph // Equivalent to `layout.getLineLeft(line)` but `getLineLeft` returns // incorrect // values when the paragraph is RTL and `setSingleLine(true)`. ) @@ -1248,11 +1220,9 @@ internal object TextLayoutManager { placeholderLeftPosition = if (characterAndParagraphDirectionMatch) layout.getPrimaryHorizontal(start) else layout.getSecondaryHorizontal(start) - if ( - !ReactNativeFeatureFlags.disableOldAndroidAttachmentMetricsWorkarounds() && - isRtlParagraph && - !isRtlChar - ) { + if (!ReactNativeFeatureFlags.disableOldAndroidAttachmentMetricsWorkarounds() && + isRtlParagraph && + !isRtlChar) { // Adjust `placeholderLeftPosition` to work around an Android bug. // The bug is when the paragraph is RTL and `setSingleLine(true)`, some layout // methods such as `getPrimaryHorizontal`, `getSecondaryHorizontal`, and diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactClickableSpan.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactClickableSpan.kt index 2ca54a7d4fd..5074f80d530 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactClickableSpan.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactClickableSpan.kt @@ -44,8 +44,7 @@ internal class ReactClickableSpan(val reactTag: Int) : ClickableSpan(), ReactSpa val context = view.context as ReactContext val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, reactTag) eventDispatcher?.dispatchEvent( - ViewGroupClickEvent(UIManagerHelper.getSurfaceId(context), reactTag) - ) + ViewGroupClickEvent(UIManagerHelper.getSurfaceId(context), reactTag)) } override fun updateDrawState(ds: TextPaint) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactLinkSpan.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactLinkSpan.kt index 82cb779ac2f..e25d48f8a97 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactLinkSpan.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactLinkSpan.kt @@ -37,8 +37,7 @@ internal class ReactLinkSpan(val fragmentIndex: Int) : ClickableSpan(), ReactSpa val reactTag = preparedLayout.reactTags[fragmentIndex] val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, reactTag) eventDispatcher?.dispatchEvent( - ViewGroupClickEvent(UIManagerHelper.getSurfaceId(context), reactTag) - ) + ViewGroupClickEvent(UIManagerHelper.getSurfaceId(context), reactTag)) } override fun updateDrawState(ds: TextPaint) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt index a09177ccd73..7dc7582d2ab 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt @@ -217,10 +217,8 @@ public open class ReactEditText public constructor(context: Context) : AppCompat // Turn off hardware acceleration for Oreo (T40484798) // see https://issuetracker.google.com/issues/67102093 - if ( - Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && - Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1 - ) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && + Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1) { setLayerType(LAYER_TYPE_SOFTWARE, null) } @@ -308,12 +306,10 @@ public open class ReactEditText public constructor(context: Context) : AppCompat MotionEvent.ACTION_MOVE -> if (detectScrollMovement) { - if ( - !canScrollVertically(-1) && - !canScrollVertically(1) && - !canScrollHorizontally(-1) && - !canScrollHorizontally(1) - ) { + if (!canScrollVertically(-1) && + !canScrollVertically(1) && + !canScrollHorizontally(-1) && + !canScrollHorizontally(1)) { // We cannot scroll, let parent views take care of these touches. this.parent.requestDisallowInterceptTouchEvent(false) } @@ -369,8 +365,7 @@ public open class ReactEditText public constructor(context: Context) : AppCompat */ override fun onTextContextMenuItem(id: Int): Boolean = super.onTextContextMenuItem( - if (id == android.R.id.paste) android.R.id.pasteAsPlainText else id - ) + if (id == android.R.id.paste) android.R.id.pasteAsPlainText else id) internal fun clearFocusAndMaybeRefocus() { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P || !isInTouchMode) { @@ -612,12 +607,10 @@ public open class ReactEditText public constructor(context: Context) : AppCompat // Match behavior of CustomStyleSpan and enable SUBPIXEL_TEXT_FLAG when setting anything // nonstandard paintFlags = - if ( - fontStyle != ReactConstants.UNSET || - fontWeight != ReactConstants.UNSET || - fontFamily != null || - fontFeatureSettings != null - ) { + if (fontStyle != ReactConstants.UNSET || + fontWeight != ReactConstants.UNSET || + fontFamily != null || + fontFeatureSettings != null) { paintFlags or Paint.SUBPIXEL_TEXT_FLAG } else { paintFlags and (Paint.SUBPIXEL_TEXT_FLAG.inv()) @@ -839,12 +832,10 @@ public open class ReactEditText public constructor(context: Context) : AppCompat ) } - if ( - fontStyle != ReactConstants.UNSET || - fontWeight != ReactConstants.UNSET || - fontFamily != null || - fontFeatureSettings != null - ) { + if (fontStyle != ReactConstants.UNSET || + fontWeight != ReactConstants.UNSET || + fontFamily != null || + fontFeatureSettings != null) { workingText.setSpan( CustomStyleSpan(fontStyle, fontWeight, fontFeatureSettings, fontFamily, context.assets), 0, @@ -963,10 +954,8 @@ public open class ReactEditText public constructor(context: Context) : AppCompat public override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) - if ( - ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && - ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout() - ) { + if (ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture() && + ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout()) { applyTextAttributes() } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.kt index c80c9d58d95..54b06a86cc0 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.kt @@ -82,9 +82,8 @@ internal class ReactEditTextInputConnectionWrapper( currentSelectionStart < previousSelectionStart || currentSelectionStart <= 0 val inputKey = - if ( - cursorMovedBackwardsOrAtBeginningOfInput || (!noPreviousSelection && cursorDidNotMove) - ) { + if (cursorMovedBackwardsOrAtBeginningOfInput || + (!noPreviousSelection && cursorDidNotMove)) { BACKSPACE_KEY_VALUE } else { editText.text?.get(currentSelectionStart - 1).toString() diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextContentSizeWatcher.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextContentSizeWatcher.kt index 3f654f79869..bc4764e26d1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextContentSizeWatcher.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextContentSizeWatcher.kt @@ -46,8 +46,7 @@ internal class ReactTextContentSizeWatcher(private val editText: ReactEditText) editText.id, toDIPFromPixel(contentWidth.toFloat()), toDIPFromPixel(contentHeight.toFloat()), - ) - ) + )) } } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt index 21244cd0b19..d025919f349 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt @@ -121,20 +121,16 @@ public open class ReactTextInputManager public constructor() : mapOf( "bubbled" to "onSubmitEditing", "captured" to "onSubmitEditingCapture", - ) - ), + )), "topEndEditing" to mapOf( "phasedRegistrationNames" to - mapOf("bubbled" to "onEndEditing", "captured" to "onEndEditingCapture") - ), + mapOf("bubbled" to "onEndEditing", "captured" to "onEndEditingCapture")), "topKeyPress" to mapOf( "phasedRegistrationNames" to - mapOf("bubbled" to "onKeyPress", "captured" to "onKeyPressCapture") - ), - ) - ) + mapOf("bubbled" to "onKeyPress", "captured" to "onKeyPressCapture")), + )) return eventTypeConstants } @@ -142,8 +138,7 @@ public open class ReactTextInputManager public constructor() : val baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants() val eventTypeConstants = baseEventTypeConstants ?: mutableMapOf() eventTypeConstants.putAll( - mapOf(getJSEventName(ScrollEventType.SCROLL) to mapOf("registrationName" to "onScroll")) - ) + mapOf(getJSEventName(ScrollEventType.SCROLL) to mapOf("registrationName" to "onScroll"))) return eventTypeConstants } @@ -213,12 +208,10 @@ public open class ReactTextInputManager public constructor() : val paddingTop = extraData.paddingTop.toInt() val paddingRight = extraData.paddingRight.toInt() val paddingBottom = extraData.paddingBottom.toInt() - if ( - paddingLeft != UNSET || - paddingTop != UNSET || - paddingRight != UNSET || - paddingBottom != UNSET - ) { + if (paddingLeft != UNSET || + paddingTop != UNSET || + paddingRight != UNSET || + paddingBottom != UNSET) { view.setPadding( if (paddingLeft != UNSET) paddingLeft else view.paddingLeft, if (paddingTop != UNSET) paddingTop else view.paddingTop, @@ -506,10 +499,8 @@ public open class ReactTextInputManager public constructor() : @ReactProp(name = "caretHidden", defaultBoolean = false) public fun setCaretHidden(view: ReactEditText, caretHidden: Boolean) { - if ( - view.stagedInputType == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS && - shouldHideCursorForEmailTextInput() - ) { + if (view.stagedInputType == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS && + shouldHideCursorForEmailTextInput()) { return } view.isCursorVisible = !caretHidden @@ -538,8 +529,7 @@ public open class ReactTextInputManager public constructor() : TAG, IllegalStateException( "Could not get default text color from View Context: " + - (if (c != null) c.javaClass.canonicalName else "null") - ), + (if (c != null) c.javaClass.canonicalName else "null")), ) } } else { @@ -932,8 +922,7 @@ public open class ReactTextInputManager public constructor() : } else { eventDispatcher?.dispatchEvent(BlurEvent(surfaceId, editText.id)) eventDispatcher?.dispatchEvent( - ReactTextInputEndEditingEvent(surfaceId, editText.id, editText.text.toString()) - ) + ReactTextInputEndEditingEvent(surfaceId, editText.id, editText.text.toString())) } } @@ -958,8 +947,7 @@ public open class ReactTextInputManager public constructor() : reactContext.surfaceId, editText.id, editText.text.toString(), - ) - ) + )) } if (shouldBlur) { @@ -994,8 +982,7 @@ public open class ReactTextInputManager public constructor() : "characters" to InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS, "words" to InputType.TYPE_TEXT_FLAG_CAP_WORDS, "sentences" to InputType.TYPE_TEXT_FLAG_CAP_SENTENCES, - ) - ) + )) override fun setPadding(view: ReactEditText, left: Int, top: Int, right: Int, bottom: Int) { view.setPadding(left, top, right, bottom) @@ -1052,8 +1039,7 @@ public open class ReactTextInputManager public constructor() : val textBreakStrategy = TextAttributeProps.getTextBreakStrategy( - paragraphAttributes.getString(TextLayoutManager.PA_KEY_TEXT_BREAK_STRATEGY.toInt()) - ) + paragraphAttributes.getString(TextLayoutManager.PA_KEY_TEXT_BREAK_STRATEGY.toInt())) val currentJustificationMode = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { 0 @@ -1164,10 +1150,8 @@ public open class ReactTextInputManager public constructor() : // Sets the correct password type, since numeric and text passwords have different types private fun checkPasswordType(view: ReactEditText) { - if ( - (view.stagedInputType and INPUT_TYPE_KEYBOARD_NUMBERED) != 0 && - (view.stagedInputType and InputType.TYPE_TEXT_VARIATION_PASSWORD) != 0 - ) { + if ((view.stagedInputType and INPUT_TYPE_KEYBOARD_NUMBERED) != 0 && + (view.stagedInputType and InputType.TYPE_TEXT_VARIATION_PASSWORD) != 0) { // Text input type is numbered password, remove text password variation, add numeric one updateStagedInputTypeFlag( view, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputTextWatcher.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputTextWatcher.kt index 887251ccbbc..c55bfea9e54 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputTextWatcher.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputTextWatcher.kt @@ -63,8 +63,7 @@ internal class ReactTextInputTextWatcher( editText.id, s.toString(), editText.incrementAndGetEventCounter(), - ) - ) + )) } override fun afterTextChanged(s: Editable) = Unit diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextSelectionWatcher.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextSelectionWatcher.kt index a799906c03f..f12a2ab1025 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextSelectionWatcher.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextSelectionWatcher.kt @@ -36,8 +36,7 @@ internal class ReactTextSelectionWatcher(private val editText: ReactEditText) : if (previousSelectionStart != realStart || previousSelectionEnd != realEnd) { eventDispatcher?.dispatchEvent( - ReactTextInputSelectionEvent(surfaceId, editText.id, realStart, realEnd) - ) + ReactTextInputSelectionEvent(surfaceId, editText.id, realStart, realEnd)) previousSelectionStart = realStart previousSelectionEnd = realEnd diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.kt index 3b0cb0d8f82..d6a3d52d825 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.kt @@ -38,13 +38,11 @@ public object ReactDrawableHelper { val attr = drawableDescriptionDict.getString("attribute") ?: throw JSApplicationIllegalArgumentException( - "JS description missing 'attribute' field" - ) + "JS description missing 'attribute' field") val attrId = getAttrId(context, attr) if (!context.theme.resolveAttribute(attrId, resolveOutValue, true)) { throw JSApplicationIllegalArgumentException( - "Attribute $attr with id $attrId couldn't be resolved into a drawable" - ) + "Attribute $attr with id $attrId couldn't be resolved into a drawable") } val drawable = getDefaultThemeDrawable(context) return setRadius(drawableDescriptionDict, drawable) @@ -89,33 +87,26 @@ public object ReactDrawableHelper { } private fun getColor(context: Context, drawableDescriptionDict: ReadableMap): Int = - if ( - drawableDescriptionDict.hasKey(ViewProps.COLOR) && - !drawableDescriptionDict.isNull(ViewProps.COLOR) - ) { + if (drawableDescriptionDict.hasKey(ViewProps.COLOR) && + !drawableDescriptionDict.isNull(ViewProps.COLOR)) { drawableDescriptionDict.getInt(ViewProps.COLOR) } else { - if ( - context.theme.resolveAttribute( - android.R.attr.colorControlHighlight, - resolveOutValue, - true, - ) - ) { + if (context.theme.resolveAttribute( + android.R.attr.colorControlHighlight, + resolveOutValue, + true, + )) { context.resources.getColor(resolveOutValue.resourceId, context.theme) } else { throw JSApplicationIllegalArgumentException( - "Attribute colorControlHighlight couldn't be resolved into a drawable" - ) + "Attribute colorControlHighlight couldn't be resolved into a drawable") } } private fun getMask(drawableDescriptionDict: ReadableMap): Drawable? { - if ( - !drawableDescriptionDict.hasKey("borderless") || - drawableDescriptionDict.isNull("borderless") || - !drawableDescriptionDict.getBoolean("borderless") - ) { + if (!drawableDescriptionDict.hasKey("borderless") || + drawableDescriptionDict.isNull("borderless") || + !drawableDescriptionDict.getBoolean("borderless")) { return ColorDrawable(Color.WHITE) } return null diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt index d987635b424..b8eac62de30 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt @@ -256,8 +256,7 @@ public open class ReactViewGroup public constructor(context: Context?) : } @Deprecated( - "setTranslucentBackgroundDrawable is deprecated since React Native 0.76.0 and will be removed in a future version" - ) + "setTranslucentBackgroundDrawable is deprecated since React Native 0.76.0 and will be removed in a future version") public fun setTranslucentBackgroundDrawable(background: Drawable?) { setFeedbackUnderlay(this, background) } @@ -458,8 +457,7 @@ public open class ReactViewGroup public constructor(context: Context?) : } if (i - clippedSoFar > childCount) { throw IllegalStateException( - "Invalid clipping state. i=$i clippedSoFar=$clippedSoFar count=$childCount allChildrenCount=$allChildrenCount recycleCount=$recycleCount excludedViews=${excludedViewsSet?.size ?: 0}" - ) + "Invalid clipping state. i=$i clippedSoFar=$clippedSoFar count=$childCount allChildrenCount=$allChildrenCount recycleCount=$recycleCount excludedViews=${excludedViewsSet?.size ?: 0}") } } inSubviewClippingLoop = false @@ -490,13 +488,11 @@ public open class ReactViewGroup public constructor(context: Context?) : needUpdateClippingRecursive = true } // We don't want to clip a view that is currently focused at that might break focus navigation - if ( - !intersects && - !isViewClipped(child, idx) && - !isAnimating && - child !== focusedChild && - !shouldSkipView - ) { + if (!intersects && + !isViewClipped(child, idx) && + !isAnimating && + child !== focusedChild && + !shouldSkipView) { setViewClipped(child, true) // We can try saving on invalidate call here as the view that we remove is out of visible area // therefore invalidation is not necessary. @@ -696,13 +692,11 @@ public open class ReactViewGroup public constructor(context: Context?) : logSoftException( ReactSoftExceptionLogger.Categories.CLIPPING_PROHIBITED_VIEW, ReactNoCrashSoftException( - "Child view has been added to Parent view in which it is clipped and not visible. This is not legal for this particular child view. Child: [${child.id}] $child Parent: [$id] ${toString()}" - ), + "Child view has been added to Parent view in which it is clipped and not visible. This is not legal for this particular child view. Child: [${child.id}] $child Parent: [$id] ${toString()}"), ) } } - } - ) + }) } } @@ -753,8 +747,7 @@ public open class ReactViewGroup public constructor(context: Context?) : logSoftException( ReactSoftExceptionLogger.Categories.RVG_IS_VIEW_CLIPPED, ReactNoCrashSoftException( - "View missing clipping tag: index=$index parentNull=${parent == null} parentThis=${parent === this} transitioning=$transitioning" - ), + "View missing clipping tag: index=$index parentNull=${parent == null} parentThis=${parent === this} transitioning=$transitioning"), ) } // fallback - should be transitioning or have no parent if the view was removed @@ -839,13 +832,11 @@ public open class ReactViewGroup public constructor(context: Context?) : } override fun setOverflowInset(left: Int, top: Int, right: Int, bottom: Int) { - if ( - needsIsolatedLayer(this) && - (overflowInset.left != left || - overflowInset.top != top || - overflowInset.right != right || - overflowInset.bottom != bottom) - ) { + if (needsIsolatedLayer(this) && + (overflowInset.left != left || + overflowInset.top != top || + overflowInset.right != right || + overflowInset.bottom != bottom)) { invalidate() } overflowInset[left, top, right] = bottom @@ -861,11 +852,9 @@ public open class ReactViewGroup public constructor(context: Context?) : } override fun draw(canvas: Canvas) { - if ( - Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && - getUIManagerType(this) == UIManagerType.FABRIC && - needsIsolatedLayer(this) - ) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && + getUIManagerType(this) == UIManagerType.FABRIC && + needsIsolatedLayer(this)) { // Check if the view is a stacking context and has children, if it does, do the rendering // offscreen and then composite back. This follows the idea of group isolation on blending // https://www.w3.org/TR/compositing-1/#isolationblending @@ -900,11 +889,9 @@ public open class ReactViewGroup public constructor(context: Context?) : } var mixBlendMode: BlendMode? = null - if ( - Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && - getUIManagerType(this) == UIManagerType.FABRIC && - needsIsolatedLayer(this) - ) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && + getUIManagerType(this) == UIManagerType.FABRIC && + needsIsolatedLayer(this)) { mixBlendMode = child.getTag(R.id.mix_blend_mode) as? BlendMode if (mixBlendMode != null) { val p = Paint() diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt index 6c2d3bd52dc..6f8298187fa 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt @@ -190,18 +190,15 @@ public open class ReactViewManager : ReactClippingViewManager() ViewProps.BORDER_END_START_RADIUS, ViewProps.BORDER_START_END_RADIUS, ViewProps.BORDER_START_START_RADIUS, - ] - ) + ]) public open fun setBorderRadius(view: ReactViewGroup, index: Int, rawBorderRadius: Dynamic) { var borderRadius = LengthPercentage.setFromDynamic(rawBorderRadius) // We do not support percentage border radii on Paper in order to be consistent with iOS (to // avoid developer surprise if it works on one platform but not another). - if ( - ViewUtil.getUIManagerType(view) != UIManagerType.FABRIC && - borderRadius != null && - borderRadius.type == LengthPercentageType.PERCENT - ) { + if (ViewUtil.getUIManagerType(view) != UIManagerType.FABRIC && + borderRadius != null && + borderRadius.type == LengthPercentageType.PERCENT) { borderRadius = null } @@ -342,8 +339,7 @@ public open class ReactViewManager : ReactClippingViewManager() val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag((view.context as ReactContext), view.id) eventDispatcher?.dispatchEvent( - ViewGroupClickEvent(UIManagerHelper.getSurfaceId(view.context), view.id) - ) + ViewGroupClickEvent(UIManagerHelper.getSurfaceId(view.context), view.id)) } // Clickable elements are focusable. On API 26, this is taken care by setClickable. @@ -411,8 +407,7 @@ public open class ReactViewManager : ReactClippingViewManager() private fun handleSetPressed(root: ReactViewGroup, args: ReadableArray?) { if (args == null || args.size() != 1) { throw JSApplicationIllegalArgumentException( - "Illegal number of arguments for 'setPressed' command" - ) + "Illegal number of arguments for 'setPressed' command") } root.isPressed = args.getBoolean(0) } @@ -420,8 +415,7 @@ public open class ReactViewManager : ReactClippingViewManager() private fun handleHotspotUpdate(root: ReactViewGroup, args: ReadableArray?) { if (args == null || args.size() != 2) { throw JSApplicationIllegalArgumentException( - "Illegal number of arguments for 'updateHotspot' command" - ) + "Illegal number of arguments for 'updateHotspot' command") } val x = args.getDouble(0).dpToPx() diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualView.kt index f34cfb6338e..c5190221a68 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualView.kt @@ -186,10 +186,8 @@ public class ReactVirtualView(context: Context) : } // If no ScrollView, or ScrollView has disabled removeClippedSubviews, use default behavior - if ( - parentScrollView == null || - !((parentScrollView as ReactClippingViewGroup)?.removeClippedSubviews ?: false) - ) { + if (parentScrollView == null || + !((parentScrollView as ReactClippingViewGroup)?.removeClippedSubviews ?: false)) { super.updateClippingRect(excludedViews) return } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualViewManager.kt index da9e8aa4223..b3c1eecb1bb 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualViewManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualViewManager.kt @@ -101,7 +101,6 @@ public class VirtualViewEventEmitter( targetRect, thresholdRect, synchronous, - ) - ) + )) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimentalManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimentalManager.kt index 248bac97551..ac194d860bc 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimentalManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimentalManager.kt @@ -104,7 +104,6 @@ public class VirtualViewEventEmitter( targetRect, thresholdRect, synchronous, - ) - ) + )) } } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.kt index 820e184b2df..fd92a4bd393 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.kt @@ -132,8 +132,7 @@ class RootViewTest { 0.0, "targetSurface", -1, - ) - ) + )) // Test ACTION_UP event reset(eventEmitterModuleMock, eventDispatcher) @@ -166,15 +165,13 @@ class RootViewTest { 0.0, "targetSurface", -1, - ) - ) + )) // Test other action reset(eventDispatcher) rootView.onTouchEvent( - MotionEvent.obtain(50, Date().time, MotionEvent.ACTION_HOVER_MOVE, 0f, 0f, 0) - ) + MotionEvent.obtain(50, Date().time, MotionEvent.ACTION_HOVER_MOVE, 0f, 0f, 0)) verifyNoMoreInteractions(eventDispatcher) } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedInterpolationTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedInterpolationTest.kt index 96558a36ee0..7d48203548b 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedInterpolationTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedInterpolationTest.kt @@ -76,8 +76,7 @@ class NativeAnimatedInterpolationTest { output, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_CLAMP, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_CLAMP, - ) - ) + )) .isEqualTo(1.0) assertThat( InterpolationAnimatedNode.interpolate( @@ -86,8 +85,7 @@ class NativeAnimatedInterpolationTest { output, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_CLAMP, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_CLAMP, - ) - ) + )) .isEqualTo(0.0) } @@ -102,8 +100,7 @@ class NativeAnimatedInterpolationTest { output, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_IDENTITY, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_IDENTITY, - ) - ) + )) .isEqualTo(30.0) assertThat( InterpolationAnimatedNode.interpolate( @@ -112,8 +109,7 @@ class NativeAnimatedInterpolationTest { output, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_IDENTITY, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_IDENTITY, - ) - ) + )) .isEqualTo(5.0) } @@ -144,8 +140,7 @@ class NativeAnimatedInterpolationTest { output, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_IDENTITY, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_IDENTITY, - ) - ) + )) .isEqualTo("M20,20L20,80L80,80L80,20Z") assertThat( InterpolationAnimatedNode.interpolateString( @@ -155,8 +150,7 @@ class NativeAnimatedInterpolationTest { output, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_IDENTITY, InterpolationAnimatedNode.EXTRAPOLATE_TYPE_IDENTITY, - ) - ) + )) .isEqualTo("M30,30L26.5,70L70,70L72.5,30Z") } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.kt index dfb2afefec9..730c36e0cb1 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.kt @@ -437,11 +437,9 @@ class NativeAnimatedNodeTraversalTest { wasGreaterThanOne = true } // Test to see if it reset after coming to rest - if ( - didComeToRest && - currentValue == 0.0 && - abs(abs(currentValue - previousValue) - 1.0) < 0.001 - ) { + if (didComeToRest && + currentValue == 0.0 && + abs(abs(currentValue - previousValue) - 1.0) < 0.001) { numberOfResets++ } @@ -1046,8 +1044,7 @@ class NativeAnimatedNodeTraversalTest { whenever(uiManagerMock.constants).thenAnswer { mapOf( - "customDirectEventTypes" to mapOf("onScroll" to mapOf("registrationName" to "onScroll")) - ) + "customDirectEventTypes" to mapOf("onScroll" to mapOf("registrationName" to "onScroll"))) } nativeAnimatedNodesManager = NativeAnimatedNodesManager(reactApplicationContextMock) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.kt index f3d64235274..27978192493 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.kt @@ -68,8 +68,7 @@ object ReactTestHelper { Task.Companion.IMMEDIATE_EXECUTOR, false /* allowPackagerServerAccess */, false /* useDevSupport */, - ) - ) + )) return BridgelessReactContext(application, reactHost) } } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReadableArrayBuilderTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReadableArrayBuilderTest.kt index 7307742ec72..5d8887e409e 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReadableArrayBuilderTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReadableArrayBuilderTest.kt @@ -35,8 +35,7 @@ import org.robolectric.annotation.Config ShadowWritableNativeArray::class, ShadowReadableNativeMap::class, ShadowReadableNativeArray::class, - ] -) + ]) class ReadableArrayBuilderTest { @Test diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReadableMapBuilderTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReadableMapBuilderTest.kt index 4537e29856b..c36461c2736 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReadableMapBuilderTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReadableMapBuilderTest.kt @@ -35,8 +35,7 @@ import org.robolectric.annotation.Config ShadowWritableNativeArray::class, ShadowReadableNativeMap::class, ShadowReadableNativeArray::class, - ] -) + ]) class ReadableMapBuilderTest { @Test diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/interop/InteropModuleRegistryTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/interop/InteropModuleRegistryTest.kt index a8c289297a0..1681fc3ee4f 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/interop/InteropModuleRegistryTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/interop/InteropModuleRegistryTest.kt @@ -6,8 +6,7 @@ */ @file:Suppress( - "DEPRECATION" -) // Suppressing as we want to test specifically with RCTEventEmitter here + "DEPRECATION") // Suppressing as we want to test specifically with RCTEventEmitter here package com.facebook.react.bridge.interop @@ -72,7 +71,6 @@ class InteropModuleRegistryTest { override fun useFabricInterop(): Boolean = useFabricInterop override fun enableFabricRenderer(): Boolean = enableFabricRenderer - } - ) + }) } } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt index 68a1d720572..d7dcf05140a 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt @@ -67,8 +67,7 @@ class DefaultNewArchitectureEntryPointTest { assertThat(isValid).isFalse() assertThat(errorMessage) .isEqualTo( - "fabricEnabled=true requires turboModulesEnabled=true (is now false) - Please update your DefaultNewArchitectureEntryPoint.load() parameters." - ) + "fabricEnabled=true requires turboModulesEnabled=true (is now false) - Please update your DefaultNewArchitectureEntryPoint.load() parameters.") } @Test @@ -82,8 +81,7 @@ class DefaultNewArchitectureEntryPointTest { assertThat(isValid).isFalse() assertThat(errorMessage) .isEqualTo( - "fabricEnabled=true requires turboModulesEnabled=true (is now false) - Please update your DefaultNewArchitectureEntryPoint.load() parameters." - ) + "fabricEnabled=true requires turboModulesEnabled=true (is now false) - Please update your DefaultNewArchitectureEntryPoint.load() parameters.") } @Test @@ -97,7 +95,6 @@ class DefaultNewArchitectureEntryPointTest { assertThat(isValid).isFalse() assertThat(errorMessage) .isEqualTo( - "bridgelessEnabled=true requires (turboModulesEnabled=true AND fabricEnabled=true) - Please update your DefaultNewArchitectureEntryPoint.load() parameters." - ) + "bridgelessEnabled=true requires (turboModulesEnabled=true AND fabricEnabled=true) - Please update your DefaultNewArchitectureEntryPoint.load() parameters.") } } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.kt index c0753a45ca0..a33df294ff6 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.kt @@ -24,8 +24,7 @@ class MultipartStreamReaderTest { "Content-Length: 2\r\n\r\n" + "{}\r\n" + "--sample_boundary--\r\n" + - "epilogue, should be ignored" - ) + "epilogue, should be ignored") val source = Buffer() source.write(response) @@ -60,8 +59,7 @@ class MultipartStreamReaderTest { "--sample_boundary\r\n" + "3\r\n" + "--sample_boundary--\r\n" + - "epilogue, should be ignored" - ) + "epilogue, should be ignored") val source = Buffer() source.write(response) @@ -109,8 +107,7 @@ class MultipartStreamReaderTest { "Content-Length: 2\r\n\r\n" + "{}\r\n" + "--sample_boundary\r\n" + - "incomplete message..." - ) + "incomplete message...") val source = Buffer() source.write(response) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkEventUtilTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkEventUtilTest.kt index 4a061a40aa2..767f3eeafc5 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkEventUtilTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkEventUtilTest.kt @@ -46,8 +46,7 @@ class NetworkEventUtilTest { ReactNativeFeatureFlags.override( object : ReactNativeFeatureFlagsDefaults() { override fun enableNetworkEventReporting(): Boolean = false - } - ) + }) } @After diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkingModuleTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkingModuleTest.kt index f180a4b05da..61cb6ad70b7 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkingModuleTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkingModuleTest.kt @@ -79,8 +79,7 @@ class NetworkingModuleTest { ReactNativeFeatureFlags.override( object : ReactNativeFeatureFlagsDefaults() { override fun enableNetworkEventReporting(): Boolean = false - } - ) + }) networkingModule = NetworkingModule(context, "", httpClient, null) @@ -456,8 +455,7 @@ class NetworkingModuleTest { "content-disposition", "filename=\"测试photo.jpg\"; filename*=utf-8''%E6%B5%8B%E8%AF%95photo.jpg", ), - ) - ), + )), ) formData.pushMap(imageBodyPart) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.kt index 89f43788f84..99d8e41b812 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.kt @@ -118,8 +118,7 @@ class TimingModuleTest { reactChoreographerMock.postFrameCallback( MockCompat.eq(CallbackType.TIMERS_EVENTS), MockCompat.any(), - ) - ) + )) .thenAnswer { return@thenAnswer postFrameCallbackHandler.answer(it) } @@ -127,8 +126,7 @@ class TimingModuleTest { reactChoreographerMock.postFrameCallback( MockCompat.eq(CallbackType.IDLE_EVENT), MockCompat.any(), - ) - ) + )) .thenAnswer { return@thenAnswer idlePostFrameCallbackHandler.answer(it) } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/JSPackagerClientTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/JSPackagerClientTest.kt index 89af42f5507..7ff6eb42580 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/JSPackagerClientTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/JSPackagerClientTest.kt @@ -52,8 +52,7 @@ class JSPackagerClientTest { val client = getClient(createRequestHandler("methodValue", handler)) client.onMessage( - """{"version": 2, "id": "idValue", "method": "methodValue", "params": "paramsValue"}""" - ) + """{"version": 2, "id": "idValue", "method": "methodValue", "params": "paramsValue"}""") verify(handler, never()).onNotification(any()) verify(handler).onRequest(eq("paramsValue"), any()) } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/runtime/BridgelessReactContextTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/runtime/BridgelessReactContextTest.kt index 34cd7f6ff57..9c1c29ca42a 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/runtime/BridgelessReactContextTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/runtime/BridgelessReactContextTest.kt @@ -46,8 +46,7 @@ import org.robolectric.annotation.Config ShadowNativeLoader::class, ShadowArguments::class, ShadowWritableNativeArray::class, - ] -) + ]) @OptIn(FrameworkAPI::class) class BridgelessReactContextTest { private lateinit var context: Context diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/runtime/ReactHostTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/runtime/ReactHostTest.kt index 75d0e0ee6d6..181a04f8f33 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/runtime/ReactHostTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/runtime/ReactHostTest.kt @@ -76,8 +76,7 @@ class ReactHostTest { Task.IMMEDIATE_EXECUTOR, false /* allowPackagerServerAccess */, false /* useDevSupport */, - ) - ) + )) doReturn(null).whenever(reactHost).getOrCreateReactHostInspectorTarget() doNothing().whenever(reactHost).unregisterInstanceFromInspector(any()) } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/DisplayMetricsHolderTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/DisplayMetricsHolderTest.kt index 042613d98da..d9c3ea02325 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/DisplayMetricsHolderTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/DisplayMetricsHolderTest.kt @@ -41,8 +41,7 @@ import org.robolectric.annotation.Config ShadowNativeMap::class, ShadowWritableNativeMap::class, ShadowReadableNativeMap::class, - ] -) + ]) class DisplayMetricsHolderTest { private lateinit var context: Context diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.kt index bee7ae8b9ad..a95159c51fa 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.kt @@ -123,8 +123,7 @@ class ReactPropConstantsTest { "customIntProp" to "date", "customBoxedIntGroupPropFirst" to "color", "customBoxedIntGroupPropSecond" to "color", - ) - ) + )) } companion object { diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSpecTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSpecTest.kt index b307c284523..02aa89b65a2 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSpecTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSpecTest.kt @@ -64,8 +64,7 @@ class ReactPropForShadowNodeSpecTest { @ReactProp(name = "prop") fun setterWithIncorrectNumberOfArgs(value: Boolean, anotherValue: Int) = Unit } - .javaClass - ) + .javaClass) .nativeProps } @@ -75,8 +74,7 @@ class ReactPropForShadowNodeSpecTest { object : ReactShadowNodeImpl() { @ReactProp(name = "prop") fun setterWithNoArgs() = Unit } - .javaClass - ) + .javaClass) .nativeProps } @@ -88,8 +86,7 @@ class ReactPropForShadowNodeSpecTest { @ReactProp(name = "prop") fun setterWithMap(value: Map<*, *>) = Unit } - .javaClass - ) + .javaClass) .nativeProps } @@ -101,8 +98,7 @@ class ReactPropForShadowNodeSpecTest { @ReactPropGroup(names = ["prop1", "prop2"]) fun setterWithTooManyParams(index: Int, value: Float, boolean: Boolean) = Unit } - .javaClass - ) + .javaClass) .nativeProps } @@ -114,8 +110,7 @@ class ReactPropForShadowNodeSpecTest { @ReactPropGroup(names = ["props1", "prop2"]) fun setterWithTooFewParams(index: Int) = Unit } - .javaClass - ) + .javaClass) .nativeProps } @@ -127,8 +122,7 @@ class ReactPropForShadowNodeSpecTest { @ReactPropGroup(names = ["prop1", "prop2"]) fun setterWithNoIndexParam(value: Float, boolean: Boolean) = Unit } - .javaClass - ) + .javaClass) .nativeProps } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelperTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelperTest.kt index 3b317285027..793cf117a75 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelperTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelperTest.kt @@ -51,16 +51,13 @@ class UIManagerModuleConstantsHelperTest { mutableMapOf( "bubbled" to "onColorChanged", "captured" to "onColorChangedCapture", - ) - ) - ) + ))) val result = checkNotNull( UIManagerModuleConstantsHelper.normalizeEventTypes(nestedObjects) - as Map>> - ) { - "returned map was null" - } + as Map>>) { + "returned map was null" + } verifyNestedObjects(result, "topColorChanged") verifyNestedObjects(result, "onColorChanged") } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsTest.kt index f7b02fd746c..b7a09dd7d92 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsTest.kt @@ -48,8 +48,7 @@ class UIManagerModuleConstantsTest { mutableMapOf( "Small" to 1, "Large" to 2, - ) - ) + )) override fun getNativeProps(): MutableMap = mutableMapOf("fooProp" to "number") } @@ -126,8 +125,7 @@ class UIManagerModuleConstantsTest { Assertions.assertThat(constants!![VIEW_MANAGER_NAME] as Map) .containsKey("Constants") Assertions.assertThat( - valueAtPath(constants, VIEW_MANAGER_NAME, "Constants") as Map? - ) + valueAtPath(constants, VIEW_MANAGER_NAME, "Constants") as Map?) .containsKey("PhotoSizeType") } @@ -140,8 +138,7 @@ class UIManagerModuleConstantsTest { val uiManagerModule = UIManagerModule(reactContext, viewManagers, 0) val constants = uiManagerModule.constants.orEmpty() Assertions.assertThat( - valueAtPath(constants, VIEW_MANAGER_NAME, "NativeProps", "fooProp") as String? - ) + valueAtPath(constants, VIEW_MANAGER_NAME, "NativeProps", "fooProp") as String?) .isEqualTo("number") } @@ -160,8 +157,7 @@ class UIManagerModuleConstantsTest { "keyToOverride" to "innerValueX", "anotherKey" to "valueX", ), - ) - ) + )) val managerY = ConcreteViewManager("ManagerY") managerY.exportedCustomDirectEventTypeConstants = @@ -175,8 +171,7 @@ class UIManagerModuleConstantsTest { "keyToOverride" to "innerValueY", "extraKey" to "valueY", ), - ) - ) + )) val viewManagers = listOf(managerX, managerY) val uiManagerModule = UIManagerModule(reactContext, viewManagers, 0) @@ -208,8 +203,7 @@ class UIManagerModuleConstantsTest { mapOf( "bubbled" to "onTwirl", "captured" to "onTwirlCaptured", - ) - ) + )) private val TWIRL_DIRECT_EVENT_MAP: Map = mapOf("registrationName" to "onTwirl") diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/util/JSStackTraceTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/util/JSStackTraceTest.kt index b837e81924a..38d6bae02a6 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/util/JSStackTraceTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/util/JSStackTraceTest.kt @@ -103,7 +103,6 @@ class JSStackTraceTest { method_from_ram_segment_with_address@seg-3_198.js:10:20 """ - .trimIndent() - ) + .trimIndent()) } } diff --git a/packages/rn-tester/android/app/build.gradle.kts b/packages/rn-tester/android/app/build.gradle.kts index d717f641a80..35fcb8ac82c 100644 --- a/packages/rn-tester/android/app/build.gradle.kts +++ b/packages/rn-tester/android/app/build.gradle.kts @@ -102,9 +102,7 @@ android { versionName = "1.0" testBuildType = System.getProperty( - "testBuildType", - "debug", - ) // This will later be used to control the test apk build type + "testBuildType", "debug") // This will later be used to control the test apk build type testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" buildConfigField("String", "JS_MAIN_MODULE_NAME", "\"js/RNTesterApp.android\"") buildConfigField("String", "BUNDLE_ASSET_NAME", "\"RNTesterApp.android.bundle\"") @@ -135,8 +133,7 @@ android { listOf( "src/main/res", "src/main/public_res", - ) - ) + )) } } @@ -178,10 +175,8 @@ tasks.withType().configureEach { } afterEvaluate { - if ( - project.findProperty("react.internal.useHermesNightly") == null || - project.findProperty("react.internal.useHermesNightly").toString() == "false" - ) { + if (project.findProperty("react.internal.useHermesNightly") == null || + project.findProperty("react.internal.useHermesNightly").toString() == "false") { // As we're consuming Hermes from source, we want to make sure // `hermesc` is built before we actually invoke the `emit*HermesResource` task tasks diff --git a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.kt b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.kt index 66ce14c2fc5..507a08ad4a9 100644 --- a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.kt +++ b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.kt @@ -87,8 +87,7 @@ internal class RNTesterApplication : Application(), ReactApplication { ), ) } - } - ) + }) add( object : ReactPackage, ViewManagerOnDemandReactPackage { override fun getViewManagerNames(reactContext: ReactApplicationContext) = @@ -117,8 +116,7 @@ internal class RNTesterApplication : Application(), ReactApplication { "RNTReportFullyDrawnView" -> ReportFullyDrawnViewManager() else -> null } - } - ) + }) } override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED diff --git a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/component/MyLegacyViewManager.kt b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/component/MyLegacyViewManager.kt index 9b3e5332522..c9edd763efe 100644 --- a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/component/MyLegacyViewManager.kt +++ b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/component/MyLegacyViewManager.kt @@ -55,9 +55,7 @@ internal class MyLegacyViewManager(reactContext: ReactApplicationContext) : mapOf( "bubbled" to "onColorChanged", "captured" to "onColorChangedCapture", - ) - ) - ) + ))) } override fun receiveCommand(view: MyNativeView, commandId: String, args: ReadableArray?) { diff --git a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/component/MyNativeViewManager.kt b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/component/MyNativeViewManager.kt index 0ba01029abb..cd7cc615780 100644 --- a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/component/MyNativeViewManager.kt +++ b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/component/MyNativeViewManager.kt @@ -77,7 +77,5 @@ internal class MyNativeViewManager : mapOf( "bubbled" to "onIntArrayChanged", "captured" to "onIntArrayChangedCapture", - ) - ) - ) + ))) } diff --git a/private/react-native-fantom/build.gradle.kts b/private/react-native-fantom/build.gradle.kts index d40e66f97c2..b935a282eb8 100644 --- a/private/react-native-fantom/build.gradle.kts +++ b/private/react-native-fantom/build.gradle.kts @@ -119,8 +119,7 @@ val prepareNlohmannJson by include( "json-${NLOHMANNJSON_VERSION}/src/**/*", "json-${NLOHMANNJSON_VERSION}/include/**/*", - "CMakeLists.txt", - ) + "CMakeLists.txt") eachFile { path = path.substringAfter("/") } includeEmptyDirs = false into("$thirdParty/nlohmann_json") @@ -187,8 +186,7 @@ val configureFantomTester by "-DREACT_ANDROID_DIR=$reactAndroidDir", "-DREACT_COMMON_DIR=$reactNativeDir/ReactCommon", "-DREACT_CXX_PLATFORM_DIR=$reactNativeDir/ReactCxxPlatform", - "-DREACT_THIRD_PARTY_NDK_DIR=$reactAndroidBuildDir/third-party-ndk", - ) + "-DREACT_THIRD_PARTY_NDK_DIR=$reactAndroidBuildDir/third-party-ndk") commandLine(cmdArgs) standardOutputFile.set(project.file("$buildDir/reports/configure-fantom_tester.log")) errorOutputFile.set(project.file("$buildDir/reports/configure-fantom_tester.error.log")) diff --git a/settings.gradle.kts b/settings.gradle.kts index 093b67a812a..a30c2d9e1d6 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -40,7 +40,5 @@ plugins { configure { autolinkLibrariesFromCommand( - workingDirectory = file("packages/rn-tester/"), - lockFiles = files("yarn.lock"), - ) + workingDirectory = file("packages/rn-tester/"), lockFiles = files("yarn.lock")) }