Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/actions/diff-js-api-breaking-changes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ runs:
env:
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
run: |
# Check if the file was changed in this PR, if not, exit early without saving to the output.json
git diff --name-status
git diff --name-status | awk '{print $2}'
git diff --name-status | awk '{print $2}' | grep 'packages/react-native/ReactNativeApi.d.ts' || echo "ReactNativeApi.d.ts not found, exiting" && exit 0

node ./scripts/js-api/diff-api-snapshot \
${{ github.workspace }}/packages/react-native/ReactNativeApi.d.ts \
$SCRATCH_DIR/ReactNativeApi-after.d.ts \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/danger-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:
jobs:
danger:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native'
if: github.repository == 'coado/react-native'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.animated
import com.facebook.jni.HybridData
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.runtime.cxxreactpackage.CxxReactPackage
import com.facebook.soloader.SoLoader

public class AnimatedCxxReactPackage(public val context: ReactApplicationContext) : CxxReactPackage(null) {
init {
mHybridData = initHybrid()
}

private external fun initHybrid(): HybridData

public companion object {
init {
SoLoader.loadLibrary("react_animatedjni")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import android.content.Context
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.animated.AnimatedCxxReactPackage
import com.facebook.react.bridge.JSBundleLoader
import com.facebook.react.bridge.ReactContext
import com.facebook.react.common.annotations.UnstableReactNativeAPI
Expand Down Expand Up @@ -85,6 +86,7 @@ public object DefaultReactHost {
}
val defaultTmmDelegateBuilder = DefaultTurboModuleManagerDelegate.Builder()
cxxReactPackageProviders.forEach { defaultTmmDelegateBuilder.addCxxReactPackage(it) }
defaultTmmDelegateBuilder.addCxxReactPackage { context -> AnimatedCxxReactPackage(context) }
val defaultReactHostDelegate =
DefaultReactHostDelegate(
jsMainModulePath = jsMainModulePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun cdpInteractionMetricsEnabled(): Boolean = false

override fun cxxNativeAnimatedEnabled(): Boolean = false
override fun cxxNativeAnimatedEnabled(): Boolean = true

override fun cxxNativeAnimatedRemoveJsSync(): Boolean = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public object OpenSourceMergedSoMapping : ExternalSoMapping {
"jsinspector",
"mapbufferjni",
"react_devsupportjni",
"react_animatedjni",
"react_featureflagsjni",
"react_newarchdefaults",
"reactnativeblob",
Expand Down Expand Up @@ -55,6 +56,7 @@ public object OpenSourceMergedSoMapping : ExternalSoMapping {
"jsinspector" -> libjsinspector_so()
"mapbufferjni" -> libmapbufferjni_so()
"react_devsupportjni" -> libreact_devsupportjni_so()
"react_animatedjni" -> libreact_animatedjni_so()
"react_featureflagsjni" -> libreact_featureflagsjni_so()
"react_newarchdefaults" -> libreact_newarchdefaults_so()
"reactnative" -> libreactnative_so()
Expand Down Expand Up @@ -84,6 +86,8 @@ public object OpenSourceMergedSoMapping : ExternalSoMapping {

public external fun libreact_devsupportjni_so(): Int

public external fun libreact_animatedjni_so(): Int

public external fun libreact_featureflagsjni_so(): Int

public external fun libreact_newarchdefaults_so(): Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ add_react_common_subdir(react/featureflags)
add_react_common_subdir(react/performance/cdpmetrics)
add_react_common_subdir(react/performance/timeline)
add_react_common_subdir(react/renderer/animations)
add_react_common_subdir(react/renderer/animated)
add_react_common_subdir(react/renderer/animationbackend)
add_react_common_subdir(react/renderer/attributedstring)
add_react_common_subdir(react/renderer/componentregistry)
add_react_common_subdir(react/renderer/mounting)
Expand Down Expand Up @@ -153,6 +155,7 @@ add_react_android_subdir(src/main/jni/react/runtime/cxxreactpackage)
add_react_android_subdir(src/main/jni/react/runtime/jni)
add_react_android_subdir(src/main/jni/react/runtime/hermes/jni)
add_react_android_subdir(src/main/jni/react/devsupport)
add_react_android_subdir(src/main/jni/react/animated)

# SoMerging Utils
include(${REACT_ANDROID_DIR}/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake)
Expand Down Expand Up @@ -198,6 +201,9 @@ add_library(reactnative
$<TARGET_OBJECTS:react_performance_cdpmetrics>
$<TARGET_OBJECTS:react_performance_timeline>
$<TARGET_OBJECTS:react_renderer_animations>
$<TARGET_OBJECTS:react_renderer_animationbackend>
$<TARGET_OBJECTS:react_renderer_animated>
$<TARGET_OBJECTS:react_animatedjni>
$<TARGET_OBJECTS:react_renderer_attributedstring>
$<TARGET_OBJECTS:react_renderer_componentregistry>
$<TARGET_OBJECTS:react_renderer_consistency>
Expand Down Expand Up @@ -289,6 +295,9 @@ target_include_directories(reactnative
$<TARGET_PROPERTY:react_performance_cdpmetrics,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_performance_timeline,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_renderer_animations,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_renderer_animationbackend,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_renderer_animated,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_animatedjni,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_renderer_attributedstring,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_renderer_componentregistry,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_renderer_componentregistry,INTERFACE_INCLUDE_DIRECTORIES>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "AnimatedCxxReactPackage.h"
#include <react/jni/JWeakRefUtils.h>
#include <react/renderer/animated/AnimatedModule.h>

namespace facebook::react {

AnimatedCxxReactPackage::AnimatedCxxReactPackage(
jni::alias_ref<AnimatedCxxReactPackage::javaobject> jobj) {}

jni::local_ref<AnimatedCxxReactPackage::jhybriddata>
AnimatedCxxReactPackage::initHybrid(
jni::alias_ref<AnimatedCxxReactPackage::javaobject> jobj) {
return makeCxxInstance(jobj);
}

void AnimatedCxxReactPackage::registerNatives() {
registerHybrid({
makeNativeMethod("initHybrid", AnimatedCxxReactPackage::initHybrid),
});
}

std::shared_ptr<TurboModule> AnimatedCxxReactPackage::getModule(
const std::string& moduleName,
const std::shared_ptr<CallInvoker>& jsInvoker) {
if (moduleName == "NativeAnimatedModule") {
return std::make_shared<AnimatedModule>(
jsInvoker, getNativeAnimatedNodesManagerProvider());
}

return nullptr;
}

std::shared_ptr<NativeAnimatedNodesManagerProvider>
AnimatedCxxReactPackage::getNativeAnimatedNodesManagerProvider() {
if (auto provider = nativeAnimatedNodesManagerProvider_.lock()) {
return provider;
}

auto nativeAnimatedNodesManagerProvider =
std::make_shared<NativeAnimatedNodesManagerProvider>(nullptr, nullptr);

nativeAnimatedNodesManagerProvider_ = nativeAnimatedNodesManagerProvider;
return nativeAnimatedNodesManagerProvider;
}

} // namespace facebook::react
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#pragma once

#include <ReactCommon/CxxReactPackage.h>
#include <fbjni/fbjni.h>
#include <react/renderer/animated/NativeAnimatedNodesManagerProvider.h>

namespace facebook::react {
class AnimatedCxxReactPackage
: public jni::HybridClass<AnimatedCxxReactPackage, CxxReactPackage> {
public:
static constexpr auto kJavaDescriptor =
"Lcom/facebook/react/animated/AnimatedCxxReactPackage;";

static jni::local_ref<jhybriddata> initHybrid(
jni::alias_ref<facebook::react::AnimatedCxxReactPackage::javaobject>
jobj);

static void registerNatives();

AnimatedCxxReactPackage(
jni::alias_ref<AnimatedCxxReactPackage::javaobject> jobj);

std::shared_ptr<TurboModule> getModule(
const std::string& moduleName,
const std::shared_ptr<CallInvoker>& jsInvoker) override;

private:
std::weak_ptr<NativeAnimatedNodesManagerProvider>
nativeAnimatedNodesManagerProvider_;

std::shared_ptr<NativeAnimatedNodesManagerProvider>
getNativeAnimatedNodesManagerProvider();

friend HybridBase;
using HybridBase::HybridBase;
};
} // namespace facebook::react
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

# include(${REACT_ANDROID_DIR}/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake)
include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)

file(GLOB react_animatedjni_SRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

add_library(react_animatedjni OBJECT ${react_animatedjni_SRC})

target_include_directories(react_animatedjni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# target_merge_so(react_animatedjni)

target_link_libraries(react_animatedjni
fbjni
react_codegen_rncore
react_debug
react_renderer_core
react_renderer_graphics
react_renderer_mounting
react_renderer_uimanager
react_renderer_scheduler
react_renderer_animationbackend
react_cxxreactpackage
glog
folly_runtime)

target_compile_reactnative_options(react_animatedjni PRIVATE)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#include <fbjni/fbjni.h>

#include "AnimatedCxxReactPackage.h"

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* /*reserved*/) {
return facebook::jni::initialize(
vm, [] { facebook::react::AnimatedCxxReactPackage::registerNatives(); });
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

require "json"

package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
version = package['version']

source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
else
source[:tag] = "v#{version}"
end

header_search_paths = [
"\"$(PODS_TARGET_SRCROOT)/../../ReactCommon\"",
"\"$(PODS_ROOT)/Headers/Public/React-Core\"",
"\"$(PODS_ROOT)/Headers/Private/Yoga\""
]

Pod::Spec.new do |s|
s.name = "React-RCTAnimatedModuleProvider"
s.version = version
s.summary = "Animated TurboModule provider for iOS (bridgeless)"
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Meta Platforms, Inc. and its affiliates"
s.platforms = min_supported_versions
s.source = source
s.source_files = podspec_sources("*.{m,mm}", "**/*.h")
s.public_header_files = "*.h"
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
s.header_dir = "RCTAnimatedModuleProvider"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
# "HEADER_SEARCH_PATHS" => '$(inherited) "$(PODS_ROOT)/Headers/Public/Yoga" "$(PODS_ROOT)/Headers/Private/Yoga"'
"HEADER_SEARCH_PATHS" => header_search_paths.join(' ')
}

# resolve_use_frameworks(s, header_mappings_dir: "./", module_name: "React_RCTAnimatedModuleProvider")
resolve_use_frameworks(s, header_mappings_dir: "./")


# Dependencies needed for TurboModule types and feature flags access
s.dependency "React-Core"
s.dependency "React-jsi"
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core")
add_dependency(s, "React-callinvoker")
add_dependency(s, "React-featureflags")
add_dependency(s, "React-Fabric", :subspec => "animated", :additional_framework_paths => ["react/renderer/animated"])
add_dependency(s, "Yoga")

add_rn_third_party_dependencies(s)
add_rncore_dependency(s)
end


3 changes: 3 additions & 0 deletions packages/react-native/ReactCommon/React-Fabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ Pod::Spec.new do |s|
ss.source_files = podspec_sources("react/renderer/animated/**/*.{m,mm,cpp,h}", "react/renderer/animated/**/*.{h}")
ss.exclude_files = "react/renderer/animated/tests"
ss.header_dir = "react/renderer/animated"
ss.pod_target_xcconfig = {
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) RN_USE_ANIMATION_BACKEND=1",
}
end

s.subspec "animations" do |ss|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
}

bool cxxNativeAnimatedEnabled() override {
return false;
return true;
}

bool cxxNativeAnimatedRemoveJsSync() override {
Expand Down
Loading
Loading