Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ target_link_libraries(react_renderer_animated
)
target_compile_reactnative_options(react_renderer_animated PRIVATE)
target_compile_options(react_renderer_animated PRIVATE -Wpedantic)
target_compile_definitions(react_renderer_animated PRIVATE RN_USE_ANIMATION_BACKEND)
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,9 @@ void NativeAnimatedNodesManager::handleAnimatedEvent(
// proactivelly trigger the animation loop to avoid showing stale
// frames.
if (ReactNativeFeatureFlags::useSharedAnimatedBackend()) {
#ifdef RN_USE_ANIMATION_BACKEND
if (auto animationBackend = animationBackend_.lock()) {
animationBackend->trigger();
}
#endif
} else {
onRender();
}
Expand Down Expand Up @@ -553,14 +551,12 @@ void NativeAnimatedNodesManager::startRenderCallbackIfNeeded(bool isAsync) {
}

if (ReactNativeFeatureFlags::useSharedAnimatedBackend()) {
#ifdef RN_USE_ANIMATION_BACKEND
if (auto animationBackend = animationBackend_.lock()) {
animationBackendCallbackId_ =
animationBackend->start([this](AnimationTimestamp timestamp) {
return pullAnimationMutations(timestamp);
});
}
#endif

return;
}
Expand All @@ -579,13 +575,11 @@ void NativeAnimatedNodesManager::stopRenderCallbackIfNeeded(
auto isRenderCallbackStarted = isRenderCallbackStarted_.exchange(false);

if (ReactNativeFeatureFlags::useSharedAnimatedBackend()) {
#ifdef RN_USE_ANIMATION_BACKEND
if (isRenderCallbackStarted) {
if (auto animationBackend = animationBackend_.lock()) {
animationBackend->stop(animationBackendCallbackId_);
}
}
#endif
return;
}

Expand Down Expand Up @@ -947,8 +941,6 @@ void NativeAnimatedNodesManager::schedulePropsCommit(
}
}

#ifdef RN_USE_ANIMATION_BACKEND

void NativeAnimatedNodesManager::insertMutations(
std::unordered_map<Tag, std::pair<ShadowNodeFamily::Weak, folly::dynamic>>&
updates,
Expand Down Expand Up @@ -1089,7 +1081,6 @@ AnimationMutations NativeAnimatedNodesManager::pullAnimationMutations(
shouldRequestAsyncFlush_.clear();
return mutations;
}
#endif

void NativeAnimatedNodesManager::onRender() {
if (ReactNativeFeatureFlags::useSharedAnimatedBackend()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
#include <react/debug/flags.h>
#include <react/renderer/animated/EventEmitterListener.h>
#include <react/renderer/animated/event_drivers/EventAnimationDriver.h>
#ifdef RN_USE_ANIMATION_BACKEND
#include <react/renderer/animationbackend/AnimatedPropsBuilder.h>
#include <react/renderer/animationbackend/AnimationBackend.h>
#endif
#include <react/renderer/core/ReactPrimitives.h>
#include <react/renderer/core/ShadowNode.h>
#include <react/renderer/uimanager/UIManagerAnimationBackend.h>
Expand Down Expand Up @@ -121,15 +119,13 @@ class NativeAnimatedNodesManager {

void setAnimatedNodeOffset(Tag tag, double offset);

#ifdef RN_USE_ANIMATION_BACKEND
void insertMutations(
std::unordered_map<Tag, std::pair<ShadowNodeFamily::Weak, folly::dynamic>> &updates,
AnimationMutations &mutations,
AnimatedPropsBuilder &propsBuilder,
bool hasLayoutUpdates = false);
AnimationMutations onAnimationFrameForBackend(AnimatedPropsBuilder &propsBuilder, AnimationTimestamp timestamp);
AnimationMutations pullAnimationMutations(AnimationTimestamp timestamp);
#endif

#pragma mark - Drivers

Expand Down Expand Up @@ -286,9 +282,7 @@ class NativeAnimatedNodesManager {
bool warnedAboutGraphTraversal_ = false;
#endif

#ifdef RN_USE_ANIMATION_BACKEND
CallbackId animationBackendCallbackId_{0};
#endif

friend class ColorAnimatedNode;
friend class AnimationDriver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/animated/MergedValueDispatcher.h>
#include <react/renderer/animated/internal/AnimatedMountingOverrideDelegate.h>
#ifdef RN_USE_ANIMATION_BACKEND
#include <react/renderer/animationbackend/AnimationBackend.h>
#endif
#include <react/renderer/animated/internal/primitives.h>
#include <react/renderer/animationbackend/AnimationBackend.h>
#include <react/renderer/components/view/conversions.h>
#include <react/renderer/scheduler/Scheduler.h>
#include <react/renderer/uimanager/UIManagerBinding.h>
Expand Down Expand Up @@ -87,15 +85,13 @@ NativeAnimatedNodesManagerProvider::getOrCreate(
};

if (ReactNativeFeatureFlags::useSharedAnimatedBackend()) {
#ifdef RN_USE_ANIMATION_BACKEND
auto animationBackend = uiManager->unstable_getAnimationBackend().lock();
react_native_assert(
animationBackend != nullptr && "animationBackend is nullptr");
animationBackend->registerJSInvoker(jsInvoker);

nativeAnimatedNodesManager_ =
std::make_shared<NativeAnimatedNodesManager>(animationBackend);
#endif
} else {
nativeAnimatedNodesManager_ =
std::make_shared<NativeAnimatedNodesManager>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ target_link_libraries(react_renderer_scheduler
)
target_compile_reactnative_options(react_renderer_scheduler PRIVATE)
target_compile_options(react_renderer_scheduler PRIVATE -Wpedantic)
target_compile_definitions(react_renderer_scheduler PRIVATE RN_USE_ANIMATION_BACKEND)
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <cxxreact/TraceSection.h>
#include <react/debug/react_native_assert.h>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/animationbackend/AnimationBackend.h>
#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
#include <react/renderer/core/EventQueueProcessor.h>
#include <react/renderer/core/LayoutContext.h>
Expand All @@ -21,9 +22,6 @@
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
#include <react/renderer/uimanager/UIManager.h>
#include <react/renderer/uimanager/UIManagerBinding.h>
#ifdef RN_USE_ANIMATION_BACKEND
#include <react/renderer/animationbackend/AnimationBackend.h>
#endif

namespace facebook::react {

Expand Down Expand Up @@ -59,15 +57,13 @@ Scheduler::Scheduler(
std::make_shared<UIManager>(runtimeExecutor_, contextContainer_);

if (ReactNativeFeatureFlags::useSharedAnimatedBackend()) {
#ifdef RN_USE_ANIMATION_BACKEND
auto animationBackend = std::make_shared<AnimationBackend>(
schedulerToolbox.animationChoreographer, uiManager);

schedulerToolbox.animationChoreographer->setAnimationBackend(
animationBackend);

uiManager->unstable_setAnimationBackend(animationBackend);
#endif
}

auto eventOwnerBox = std::make_shared<EventBeat::OwnerBox>();
Expand Down
3 changes: 0 additions & 3 deletions private/react-native-fantom/runner/executables/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {NATIVE_BUILD_OUTPUT_PATH} from '../paths';
import {
getBuckModesForPlatform,
getBuckOptionsForHermes,
getConfigForAnimationBackend,
getDebugInfoFromCommandResult,
runBuck2,
runBuck2Sync,
Expand Down Expand Up @@ -55,7 +54,6 @@ export function build(options: TesterOptions): void {
'build',
...getBuckModesForPlatform(options.isOptimizedMode),
...getBuckOptionsForHermes(options.hermesVariant),
...getConfigForAnimationBackend(),
FANTOM_TESTER_BUCK_TARGET,
'--out',
tmpPath,
Expand Down Expand Up @@ -96,7 +94,6 @@ export function run(
'run',
...getBuckModesForPlatform(options.isOptimizedMode),
...getBuckOptionsForHermes(options.hermesVariant),
...getConfigForAnimationBackend(),
FANTOM_TESTER_BUCK_TARGET,
'--',
...args,
Expand Down
5 changes: 0 additions & 5 deletions private/react-native-fantom/runner/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ export function getBuckModesForPlatform(
return modes;
}

// TODO: T240293839 Remove when we get rid of RN_USE_ANIMATION_BACKEND preprocessor flag
export function getConfigForAnimationBackend(): ReadonlyArray<string> {
return ['-c rn.use_animationbackend=true'];
}

export type AsyncCommandResult = {
originalCommand: string,
childProcess: ReturnType<typeof spawn>,
Expand Down
Loading