mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: changelog: [internal] This is experimental implementation of `setNativeProps` in Fabric. This diff brings `setNativeProps` to Fabric to make migration easier. I tried to stay as close as possible to Paper's behaviour, with all of its flaws (ready CAUTION section on https://reactnative.dev/docs/direct-manipulation) State can't be stored in views because on iOS, eventually on Android, views are not the source of truth, shadow tree is. Fabric's implementation keeps state from setNativeProps in shadow node family in very inefficient data structure folly::dynamic. It is always reconciled with new prop updates. The performance cost is only paid in case node has used `setNativeProps` before. Reviewed By: mdvacca Differential Revision: D41875413 fbshipit-source-id: 453a5f7612a6f86a4cece269b13bd2ffd0c0e2d1
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
/*
|
|
* 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 <memory>
|
|
|
|
#include <react/renderer/core/ReactPrimitives.h>
|
|
#include <react/renderer/mounting/MountingCoordinator.h>
|
|
#include <react/renderer/mounting/ShadowView.h>
|
|
|
|
namespace facebook::react {
|
|
|
|
/*
|
|
* Abstract class for Scheduler's delegate.
|
|
*/
|
|
class SchedulerDelegate {
|
|
public:
|
|
/*
|
|
* Called right after Scheduler computed (and laid out) a new updated version
|
|
* of the tree and calculated a set of mutations which are sufficient
|
|
* to construct a new one.
|
|
*/
|
|
virtual void schedulerDidFinishTransaction(
|
|
MountingCoordinator::Shared const &mountingCoordinator) = 0;
|
|
|
|
/*
|
|
* Called right after a new ShadowNode was created.
|
|
*/
|
|
virtual void schedulerDidRequestPreliminaryViewAllocation(
|
|
SurfaceId surfaceId,
|
|
const ShadowNode &shadowView) = 0;
|
|
|
|
virtual void schedulerDidDispatchCommand(
|
|
const ShadowView &shadowView,
|
|
std::string const &commandName,
|
|
folly::dynamic const &args) = 0;
|
|
|
|
virtual void schedulerDidSendAccessibilityEvent(
|
|
const ShadowView &shadowView,
|
|
std::string const &eventType) = 0;
|
|
|
|
/*
|
|
* Set JS responder for a view
|
|
*/
|
|
virtual void schedulerDidSetIsJSResponder(
|
|
ShadowView const &shadowView,
|
|
bool isJSResponder,
|
|
bool blockNativeResponder) = 0;
|
|
|
|
virtual ~SchedulerDelegate() noexcept = default;
|
|
};
|
|
|
|
} // namespace facebook::react
|