mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
isolate mapbuffer only to components that use it (#44521)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44521 changelog: [internal] mapbuffer leaks into every component even though it is only used by 2: Paragraph and TextInput. Let's isolate it only to those two. To do that, I added a new template prop: usesMapBufferForStateData. It is false by default and only Paragraph and TextInput set it to true. Reviewed By: christophpurrer Differential Revision: D56636011 fbshipit-source-id: 4a99e6e68caaf40111b6b7b205854a71f33c5864
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5c798fa2df
commit
3f17c8b5f0
@@ -35,8 +35,6 @@ const FileTemplate = ({
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -57,9 +55,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
`.trim();
|
||||
|
||||
-148
@@ -14,8 +14,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -29,9 +27,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -53,8 +48,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -68,9 +61,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -92,8 +82,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -107,9 +95,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -131,8 +116,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -146,9 +129,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -170,8 +150,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -185,9 +163,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -209,8 +184,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -224,9 +197,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -248,8 +218,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -263,9 +231,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -287,8 +252,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -302,9 +265,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -326,8 +286,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -341,9 +299,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -365,8 +320,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -380,9 +333,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -404,8 +354,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -430,8 +378,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -445,9 +391,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -469,8 +412,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -484,9 +425,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -508,8 +446,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -523,9 +459,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -538,9 +471,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -562,8 +492,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -577,9 +505,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -601,8 +526,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -616,9 +539,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -640,8 +560,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -655,9 +573,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -679,8 +594,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -694,9 +607,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -718,8 +628,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -733,9 +641,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -757,8 +662,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -783,8 +686,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -798,9 +699,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -822,8 +720,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -837,9 +733,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -861,8 +754,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -876,9 +767,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -900,8 +788,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -915,9 +801,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -939,8 +822,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -954,9 +835,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -978,8 +856,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -993,9 +869,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1017,8 +890,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -1032,9 +903,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1056,8 +924,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -1071,9 +937,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1086,9 +949,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1110,8 +970,6 @@ Map {
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -1125,9 +983,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1140,9 +995,6 @@ public:
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <jni.h>
|
||||
#include <jsi/jsi.h>
|
||||
#include <jsireact/JSIExecutor.h>
|
||||
#include <react/common/mapbuffer/JReadableMapBuffer.h>
|
||||
#include <react/jni/JRuntimeExecutor.h>
|
||||
#include <react/jni/JSLogging.h>
|
||||
#include <react/runtime/BridgelessJSCallInvoker.h>
|
||||
|
||||
@@ -54,10 +54,6 @@ class ImageState final {
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
@@ -29,7 +29,6 @@ target_link_libraries(rrc_modal
|
||||
react_render_debug
|
||||
react_render_graphics
|
||||
react_render_imagemanager
|
||||
react_render_mapbuffer
|
||||
react_render_uimanager
|
||||
rrc_image
|
||||
rrc_view
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -41,10 +39,6 @@ class ModalHostViewState final {
|
||||
|
||||
#ifdef ANDROID
|
||||
folly::dynamic getDynamic() const;
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#pragma mark - Getters
|
||||
|
||||
-5
@@ -14,8 +14,6 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
@@ -53,9 +51,6 @@ class ScrollViewState final {
|
||||
"contentOffsetTop", contentOffset.y)(
|
||||
"scrollAwayPaddingTop", scrollAwayPaddingTop);
|
||||
};
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+2
-1
@@ -29,7 +29,8 @@ class ParagraphShadowNode final : public ConcreteViewShadowNode<
|
||||
ParagraphComponentName,
|
||||
ParagraphProps,
|
||||
ParagraphEventEmitter,
|
||||
ParagraphState>,
|
||||
ParagraphState,
|
||||
/* usesMapBufferForStateData */ true>,
|
||||
public BaseTextShadowNode {
|
||||
public:
|
||||
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
||||
|
||||
+7
-5
@@ -23,11 +23,13 @@ extern const char AndroidTextInputComponentName[];
|
||||
/*
|
||||
* `ShadowNode` for <AndroidTextInput> component.
|
||||
*/
|
||||
class AndroidTextInputShadowNode final : public ConcreteViewShadowNode<
|
||||
AndroidTextInputComponentName,
|
||||
AndroidTextInputProps,
|
||||
AndroidTextInputEventEmitter,
|
||||
AndroidTextInputState> {
|
||||
class AndroidTextInputShadowNode final
|
||||
: public ConcreteViewShadowNode<
|
||||
AndroidTextInputComponentName,
|
||||
AndroidTextInputProps,
|
||||
AndroidTextInputEventEmitter,
|
||||
AndroidTextInputState,
|
||||
/* usesMapBufferForStateData */ true> {
|
||||
public:
|
||||
static ShadowNodeTraits BaseTraits() {
|
||||
auto traits = ConcreteViewShadowNode::BaseTraits();
|
||||
|
||||
+6
-3
@@ -27,13 +27,15 @@ template <
|
||||
const char* concreteComponentName,
|
||||
typename ViewPropsT = ViewProps,
|
||||
typename ViewEventEmitterT = ViewEventEmitter,
|
||||
typename... Ts>
|
||||
typename StateDataT = StateData,
|
||||
bool usesMapBufferForStateData = false>
|
||||
class ConcreteViewShadowNode : public ConcreteShadowNode<
|
||||
concreteComponentName,
|
||||
YogaLayoutableShadowNode,
|
||||
ViewPropsT,
|
||||
ViewEventEmitterT,
|
||||
Ts...> {
|
||||
StateDataT,
|
||||
usesMapBufferForStateData> {
|
||||
static_assert(
|
||||
std::is_base_of<ViewProps, ViewPropsT>::value,
|
||||
"ViewPropsT must be a descendant of ViewProps");
|
||||
@@ -50,7 +52,8 @@ class ConcreteViewShadowNode : public ConcreteShadowNode<
|
||||
YogaLayoutableShadowNode,
|
||||
ViewPropsT,
|
||||
ViewEventEmitterT,
|
||||
Ts...>;
|
||||
StateDataT,
|
||||
usesMapBufferForStateData>;
|
||||
|
||||
ConcreteViewShadowNode(
|
||||
const ShadowNodeFragment& fragment,
|
||||
|
||||
@@ -29,7 +29,8 @@ template <
|
||||
typename BaseShadowNodeT,
|
||||
typename PropsT,
|
||||
typename EventEmitterT = EventEmitter,
|
||||
typename StateDataT = StateData>
|
||||
typename StateDataT = StateData,
|
||||
bool usesMapBufferForStateData = false>
|
||||
class ConcreteShadowNode : public BaseShadowNodeT {
|
||||
static_assert(
|
||||
std::is_base_of<ShadowNode, BaseShadowNodeT>::value,
|
||||
@@ -51,7 +52,7 @@ class ConcreteShadowNode : public BaseShadowNodeT {
|
||||
using ConcreteEventEmitter = EventEmitterT;
|
||||
using SharedConcreteEventEmitter = std::shared_ptr<const EventEmitterT>;
|
||||
using SharedConcreteShadowNode = std::shared_ptr<const ConcreteShadowNode>;
|
||||
using ConcreteState = ConcreteState<StateDataT>;
|
||||
using ConcreteState = ConcreteState<StateDataT, usesMapBufferForStateData>;
|
||||
using ConcreteStateData = StateDataT;
|
||||
|
||||
static ComponentName Name() {
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/renderer/core/State.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
/*
|
||||
@@ -21,7 +26,7 @@ namespace facebook::react {
|
||||
* state update transaction. A data object does not need to be copyable but
|
||||
* needs to be moveable.
|
||||
*/
|
||||
template <typename DataT>
|
||||
template <typename DataT, bool usesMapBufferForStateData = false>
|
||||
class ConcreteState : public State {
|
||||
public:
|
||||
using Shared = std::shared_ptr<const ConcreteState>;
|
||||
@@ -101,7 +106,11 @@ class ConcreteState : public State {
|
||||
}
|
||||
|
||||
MapBuffer getMapBuffer() const override {
|
||||
return getData().getMapBuffer();
|
||||
if constexpr (usesMapBufferForStateData) {
|
||||
return getData().getMapBuffer();
|
||||
} else {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
#include <react/renderer/core/ShadowNodeFamily.h>
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -40,10 +38,6 @@ struct TestState {
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
MapBuffer getMapBuffer() const {
|
||||
return MapBufferBuilder::EMPTY();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user