mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
RN_SERIALIZABLE_STATE (#51185)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51185 Was running into issues with split Android ParagraphState, because a lot of code is tied to `#ifdef ANDROID`, which also builds for react-native-cxx. This does that spliitting, and also introduces `RN_SERIALIZABLE_STATE` to replace previous ANDROID checks related to state serialization, so we can cofine that to just the Android platform. These changes are dependent on each other. Changelog: [Internal] Reviewed By: joevilches Differential Revision: D74374376 fbshipit-source-id: ffb246ea2e16773f85de12209f2d88a95f8bb792
This commit is contained in:
1 parent
09832198cc
commit
88de631d05
23 files changed
+262
-146
No files matched your search
@@ -33,7 +33,7 @@ const FileTemplate = ({
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -50,7 +50,7 @@ class ${stateName}State {
|
||||
public:
|
||||
${stateName}State() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
${stateName}State(${stateName}State const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
|
||||
+59
-59
@@ -12,7 +12,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@ class ArrayPropsNativeComponentState {
|
||||
public:
|
||||
ArrayPropsNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ArrayPropsNativeComponentState(ArrayPropsNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -46,7 +46,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -56,7 +56,7 @@ class ArrayPropsNativeComponentState {
|
||||
public:
|
||||
ArrayPropsNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ArrayPropsNativeComponentState(ArrayPropsNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -80,7 +80,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -90,7 +90,7 @@ class BooleanPropNativeComponentState {
|
||||
public:
|
||||
BooleanPropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
BooleanPropNativeComponentState(BooleanPropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -114,7 +114,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -124,7 +124,7 @@ class ColorPropNativeComponentState {
|
||||
public:
|
||||
ColorPropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ColorPropNativeComponentState(ColorPropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -148,7 +148,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -158,7 +158,7 @@ class CommandNativeComponentState {
|
||||
public:
|
||||
CommandNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
CommandNativeComponentState(CommandNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -182,7 +182,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -192,7 +192,7 @@ class CommandNativeComponentState {
|
||||
public:
|
||||
CommandNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
CommandNativeComponentState(CommandNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -216,7 +216,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -226,7 +226,7 @@ class DimensionPropNativeComponentState {
|
||||
public:
|
||||
DimensionPropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
DimensionPropNativeComponentState(DimensionPropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -250,7 +250,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -260,7 +260,7 @@ class DoublePropNativeComponentState {
|
||||
public:
|
||||
DoublePropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
DoublePropNativeComponentState(DoublePropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -284,7 +284,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -294,7 +294,7 @@ class EventsNestedObjectNativeComponentState {
|
||||
public:
|
||||
EventsNestedObjectNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
EventsNestedObjectNativeComponentState(EventsNestedObjectNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -318,7 +318,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -328,7 +328,7 @@ class EventsNativeComponentState {
|
||||
public:
|
||||
EventsNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
EventsNativeComponentState(EventsNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -352,7 +352,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -376,7 +376,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -386,7 +386,7 @@ class ExcludedAndroidComponentState {
|
||||
public:
|
||||
ExcludedAndroidComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ExcludedAndroidComponentState(ExcludedAndroidComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -410,7 +410,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -420,7 +420,7 @@ class ExcludedAndroidIosComponentState {
|
||||
public:
|
||||
ExcludedAndroidIosComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ExcludedAndroidIosComponentState(ExcludedAndroidIosComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -444,7 +444,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -454,7 +454,7 @@ class ExcludedIosComponentState {
|
||||
public:
|
||||
ExcludedIosComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ExcludedIosComponentState(ExcludedIosComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -466,7 +466,7 @@ class MultiFileIncludedNativeComponentState {
|
||||
public:
|
||||
MultiFileIncludedNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
MultiFileIncludedNativeComponentState(MultiFileIncludedNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -490,7 +490,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -500,7 +500,7 @@ class FloatPropNativeComponentState {
|
||||
public:
|
||||
FloatPropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
FloatPropNativeComponentState(FloatPropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -524,7 +524,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -534,7 +534,7 @@ class ImagePropNativeComponentState {
|
||||
public:
|
||||
ImagePropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ImagePropNativeComponentState(ImagePropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -558,7 +558,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -568,7 +568,7 @@ class InsetsPropNativeComponentState {
|
||||
public:
|
||||
InsetsPropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
InsetsPropNativeComponentState(InsetsPropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -592,7 +592,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -602,7 +602,7 @@ class Int32EnumPropsNativeComponentState {
|
||||
public:
|
||||
Int32EnumPropsNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
Int32EnumPropsNativeComponentState(Int32EnumPropsNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -626,7 +626,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -636,7 +636,7 @@ class IntegerPropNativeComponentState {
|
||||
public:
|
||||
IntegerPropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
IntegerPropNativeComponentState(IntegerPropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -660,7 +660,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -684,7 +684,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -694,7 +694,7 @@ class MixedPropNativeComponentState {
|
||||
public:
|
||||
MixedPropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
MixedPropNativeComponentState(MixedPropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -718,7 +718,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -728,7 +728,7 @@ class ImageColorPropNativeComponentState {
|
||||
public:
|
||||
ImageColorPropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ImageColorPropNativeComponentState(ImageColorPropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -752,7 +752,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -762,7 +762,7 @@ class NoPropsNoEventsComponentState {
|
||||
public:
|
||||
NoPropsNoEventsComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
NoPropsNoEventsComponentState(NoPropsNoEventsComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -786,7 +786,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -796,7 +796,7 @@ class ObjectPropsState {
|
||||
public:
|
||||
ObjectPropsState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ObjectPropsState(ObjectPropsState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -820,7 +820,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -830,7 +830,7 @@ class PointPropNativeComponentState {
|
||||
public:
|
||||
PointPropNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
PointPropNativeComponentState(PointPropNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -854,7 +854,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -864,7 +864,7 @@ class StringEnumPropsNativeComponentState {
|
||||
public:
|
||||
StringEnumPropsNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
StringEnumPropsNativeComponentState(StringEnumPropsNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -888,7 +888,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -898,7 +898,7 @@ class StringPropComponentState {
|
||||
public:
|
||||
StringPropComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
StringPropComponentState(StringPropComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -922,7 +922,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -932,7 +932,7 @@ class MultiFile1NativeComponentState {
|
||||
public:
|
||||
MultiFile1NativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
MultiFile1NativeComponentState(MultiFile1NativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -944,7 +944,7 @@ class MultiFile2NativeComponentState {
|
||||
public:
|
||||
MultiFile2NativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
MultiFile2NativeComponentState(MultiFile2NativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -968,7 +968,7 @@ Map {
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -978,7 +978,7 @@ class MultiComponent1NativeComponentState {
|
||||
public:
|
||||
MultiComponent1NativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
MultiComponent1NativeComponentState(MultiComponent1NativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -990,7 +990,7 @@ class MultiComponent2NativeComponentState {
|
||||
public:
|
||||
MultiComponent2NativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
MultiComponent2NativeComponentState(MultiComponent2NativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
@@ -20,7 +20,7 @@ class AndroidPopupMenuState {
|
||||
public:
|
||||
AndroidPopupMenuState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
AndroidPopupMenuState(AndroidPopupMenuState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -31,4 +31,4 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
} // namespace facebook::react
|
||||
+3
-3
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@ class SampleNativeComponentState {
|
||||
public:
|
||||
SampleNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
SampleNativeComponentState(SampleNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -26,4 +26,4 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
} // namespace facebook::react
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@ class SampleNativeComponentState {
|
||||
public:
|
||||
SampleNativeComponentState() = default;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
SampleNativeComponentState(SampleNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
@@ -26,4 +26,4 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
} // namespace facebook::react
|
||||
@@ -332,6 +332,81 @@ target_include_directories(reactnative
|
||||
$<TARGET_PROPERTY:yoga,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
target_compile_definitions(reactnative
|
||||
PUBLIC
|
||||
$<TARGET_PROPERTY:bridgeless,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:bridgelessnativeviewconfig,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:callinvokerholder,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:fabricjni,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:glog_init,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:jserrorhandler,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:jsinspector,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:jsinspector_cdp,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:jsinspector_network,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:jsinspector_tracing,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:jsireact,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:mapbufferjni,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_bridging,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_codegen_rncore,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_cxxreact,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_debug,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_devsupportjni,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_featureflags,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_featureflagsjni,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_nativemodule_core,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_nativemodule_defaults,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_nativemodule_dom,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_nativemodule_featureflags,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_nativemodule_idlecallbacks,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_nativemodule_microtasks,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_newarchdefaults,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_performance_timeline,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_animations,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_attributedstring,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_componentregistry,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_componentregistry,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_consistency,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_core,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_css,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_debug,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_dom,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_element,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_graphics,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_imagemanager,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_leakchecker,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_mapbuffer,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_mounting,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_observers_events,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_runtimescheduler,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_scheduler,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_telemetry,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_textlayoutmanager,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_uimanager,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_renderer_uimanager_consistency,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:react_utils,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:reactnativeblob,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:reactnativejni,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:reactnativejni_common,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:reactperflogger,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rninstance,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_image,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_legacyviewmanagerinterop,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_modal,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_native,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_progressbar,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_root,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_safeareaview,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_scrollview,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_switch,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_text,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_textinput,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:rrc_view,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:runtimeexecutor,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:turbomodulejsijni,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:uimanagerjni,INTERFACE_COMPILE_DEFINITIONS>
|
||||
$<TARGET_PROPERTY:yoga,INTERFACE_COMPILE_DEFINITIONS>
|
||||
)
|
||||
|
||||
# GTest dependencies
|
||||
add_executable(reactnative_unittest
|
||||
${REACT_COMMON_DIR}/cxxreact/tests/jsarg_helpers.cpp
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <cmath>
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
@@ -1003,7 +1003,7 @@ inline std::string toString(const AttributedString::Range& range) {
|
||||
", length: " + std::to_string(range.length) + "}";
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
|
||||
// constants for AttributedString serialization
|
||||
constexpr static MapBuffer::Key AS_KEY_HASH = 0;
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
folly::dynamic ModalHostViewState::getDynamic() const {
|
||||
return folly::dynamic::object("screenWidth", screenSize.width)(
|
||||
"screenHeight", screenSize.height);
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@
|
||||
#include <react/renderer/core/graphicsConversions.h>
|
||||
#include <react/renderer/graphics/Float.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -35,7 +35,7 @@ class ModalHostViewState final {
|
||||
};
|
||||
ModalHostViewState(Size screenSize_) : screenSize(screenSize_){};
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ModalHostViewState(
|
||||
const ModalHostViewState& previousState,
|
||||
folly::dynamic data)
|
||||
@@ -46,7 +46,7 @@ class ModalHostViewState final {
|
||||
|
||||
const Size screenSize{};
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
folly::dynamic getDynamic() const;
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
inline folly::dynamic toDynamic(const AndroidProgressBarProps& props) {
|
||||
folly::dynamic serializedProps = folly::dynamic::object();
|
||||
serializedProps["styleAttr"] = props.styleAttr;
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
#include <react/renderer/graphics/Rect.h>
|
||||
#include <react/renderer/graphics/Size.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,7 @@ class ScrollViewState final {
|
||||
*/
|
||||
Size getContentSize() const;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
ScrollViewState(const ScrollViewState& previousState, folly::dynamic data)
|
||||
: contentOffset(
|
||||
{(Float)data["contentOffsetLeft"].getDouble(),
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/attributedstring/conversions.h>
|
||||
#include <react/renderer/components/text/ParagraphState.h>
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
inline MapBuffer toMapBuffer(const ParagraphState& paragraphState) {
|
||||
auto builder = MapBufferBuilder();
|
||||
auto attStringMapBuffer = toMapBuffer(paragraphState.attributedString);
|
||||
|
||||
+1
@@ -12,6 +12,7 @@
|
||||
#include <react/renderer/attributedstring/ParagraphAttributes.h>
|
||||
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
||||
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
|
||||
|
||||
+5
-22
@@ -11,11 +11,6 @@
|
||||
#include <react/renderer/attributedstring/ParagraphAttributes.h>
|
||||
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
/*
|
||||
@@ -29,15 +24,11 @@ class TextInputState final {
|
||||
AttributedStringBox attributedStringBox,
|
||||
AttributedString reactTreeAttributedString,
|
||||
ParagraphAttributes paragraphAttributes,
|
||||
int64_t mostRecentEventCount);
|
||||
|
||||
#ifdef ANDROID
|
||||
TextInputState(
|
||||
const TextInputState& previousState,
|
||||
const folly::dynamic& data);
|
||||
folly::dynamic getDynamic() const;
|
||||
MapBuffer getMapBuffer() const;
|
||||
#endif
|
||||
int64_t mostRecentEventCount)
|
||||
: attributedStringBox(std::move(attributedStringBox)),
|
||||
reactTreeAttributedString(std::move(reactTreeAttributedString)),
|
||||
paragraphAttributes(std::move(paragraphAttributes)),
|
||||
mostRecentEventCount(mostRecentEventCount) {}
|
||||
|
||||
/*
|
||||
* All content of <TextInput> component.
|
||||
@@ -60,14 +51,6 @@ class TextInputState final {
|
||||
ParagraphAttributes paragraphAttributes;
|
||||
|
||||
int64_t mostRecentEventCount{0};
|
||||
|
||||
#ifdef ANDROID
|
||||
/**
|
||||
* Stores an opaque cache ID used on the Java side to refer to a specific
|
||||
* AttributedString for measurement purposes only.
|
||||
*/
|
||||
int64_t cachedAttributedStringId{0};
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
+3
-1
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "AndroidTextInputShadowNode.h"
|
||||
#include "AndroidTextInputState.h"
|
||||
|
||||
#include <fbjni/fbjni.h>
|
||||
|
||||
@@ -68,7 +69,8 @@ class AndroidTextInputComponentDescriptor final
|
||||
}
|
||||
|
||||
return std::make_shared<AndroidTextInputShadowNode::ConcreteState>(
|
||||
std::make_shared<const TextInputState>(TextInputState({}, {}, {}, 0)),
|
||||
std::make_shared<const AndroidTextInputState>(
|
||||
AndroidTextInputState({}, {}, {}, 0)),
|
||||
family);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ void AndroidTextInputShadowNode::updateStateIfNeeded(
|
||||
: props.mostRecentEventCount;
|
||||
auto newAttributedString = getMostRecentAttributedString(layoutContext);
|
||||
|
||||
setStateData(TextInputState{
|
||||
setStateData(AndroidTextInputState{
|
||||
AttributedStringBox(newAttributedString),
|
||||
reactTreeAttributedString,
|
||||
props.paragraphAttributes,
|
||||
|
||||
+2
-2
@@ -9,9 +9,9 @@
|
||||
|
||||
#include "AndroidTextInputEventEmitter.h"
|
||||
#include "AndroidTextInputProps.h"
|
||||
#include "AndroidTextInputState.h"
|
||||
|
||||
#include <react/renderer/attributedstring/AttributedString.h>
|
||||
#include <react/renderer/components/textinput/TextInputState.h>
|
||||
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
||||
#include <react/utils/ContextContainer.h>
|
||||
|
||||
@@ -26,7 +26,7 @@ class AndroidTextInputShadowNode final : public ConcreteViewShadowNode<
|
||||
AndroidTextInputComponentName,
|
||||
AndroidTextInputProps,
|
||||
AndroidTextInputEventEmitter,
|
||||
TextInputState> {
|
||||
AndroidTextInputState> {
|
||||
public:
|
||||
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
||||
|
||||
|
||||
+3
-32
@@ -5,46 +5,18 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "TextInputState.h"
|
||||
#include "AndroidTextInputState.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <react/renderer/attributedstring/conversions.h>
|
||||
#include <react/renderer/components/text/ParagraphState.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
TextInputState::TextInputState(
|
||||
AttributedStringBox attributedStringBox,
|
||||
AttributedString reactTreeAttributedString,
|
||||
ParagraphAttributes paragraphAttributes,
|
||||
int64_t mostRecentEventCount)
|
||||
: attributedStringBox(std::move(attributedStringBox)),
|
||||
reactTreeAttributedString(std::move(reactTreeAttributedString)),
|
||||
paragraphAttributes(std::move(paragraphAttributes)),
|
||||
mostRecentEventCount(mostRecentEventCount) {}
|
||||
|
||||
#ifdef ANDROID
|
||||
TextInputState::TextInputState(
|
||||
const TextInputState& previousState,
|
||||
const folly::dynamic& data)
|
||||
: attributedStringBox(previousState.attributedStringBox),
|
||||
reactTreeAttributedString(previousState.reactTreeAttributedString),
|
||||
paragraphAttributes(previousState.paragraphAttributes),
|
||||
mostRecentEventCount(data.getDefault(
|
||||
"mostRecentEventCount",
|
||||
previousState.mostRecentEventCount)
|
||||
.getInt()),
|
||||
cachedAttributedStringId(data.getDefault(
|
||||
"opaqueCacheId",
|
||||
previousState.cachedAttributedStringId)
|
||||
.getInt()){};
|
||||
|
||||
folly::dynamic TextInputState::getDynamic() const {
|
||||
folly::dynamic AndroidTextInputState::getDynamic() const {
|
||||
LOG(FATAL) << "TextInputState state should only be read using MapBuffer";
|
||||
}
|
||||
|
||||
MapBuffer TextInputState::getMapBuffer() const {
|
||||
MapBuffer AndroidTextInputState::getMapBuffer() const {
|
||||
auto builder = MapBufferBuilder();
|
||||
// If we have a `cachedAttributedStringId` we know that we're (1) not trying
|
||||
// to set a new string, so we don't need to pass it along; (2) setState was
|
||||
@@ -66,6 +38,5 @@ MapBuffer TextInputState::getMapBuffer() const {
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace facebook::react
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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 <react/renderer/attributedstring/AttributedStringBox.h>
|
||||
#include <react/renderer/attributedstring/ParagraphAttributes.h>
|
||||
#include <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
||||
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
/*
|
||||
* State for <TextInput> component.
|
||||
*/
|
||||
class AndroidTextInputState final {
|
||||
public:
|
||||
AndroidTextInputState() = default;
|
||||
|
||||
AndroidTextInputState(
|
||||
AttributedStringBox attributedStringBox,
|
||||
AttributedString reactTreeAttributedString,
|
||||
ParagraphAttributes paragraphAttributes,
|
||||
int64_t mostRecentEventCount)
|
||||
: attributedStringBox(std::move(attributedStringBox)),
|
||||
reactTreeAttributedString(std::move(reactTreeAttributedString)),
|
||||
paragraphAttributes(std::move(paragraphAttributes)),
|
||||
mostRecentEventCount(mostRecentEventCount) {}
|
||||
|
||||
AndroidTextInputState(
|
||||
const AndroidTextInputState& previousState,
|
||||
const folly::dynamic& data)
|
||||
: attributedStringBox(previousState.attributedStringBox),
|
||||
reactTreeAttributedString(previousState.reactTreeAttributedString),
|
||||
paragraphAttributes(previousState.paragraphAttributes),
|
||||
mostRecentEventCount(data.getDefault(
|
||||
"mostRecentEventCount",
|
||||
previousState.mostRecentEventCount)
|
||||
.getInt()),
|
||||
cachedAttributedStringId(data.getDefault(
|
||||
"opaqueCacheId",
|
||||
previousState.cachedAttributedStringId)
|
||||
.getInt()) {}
|
||||
|
||||
folly::dynamic getDynamic() const;
|
||||
MapBuffer getMapBuffer() const;
|
||||
|
||||
/*
|
||||
* All content of <TextInput> component.
|
||||
*/
|
||||
AttributedStringBox attributedStringBox;
|
||||
|
||||
/*
|
||||
* All content of <TextInput> component represented as an `AttributedString`.
|
||||
* This stores the previous computed *from the React tree*. This usually
|
||||
* doesn't change as the TextInput contents are being updated. If it does
|
||||
* change, we need to wipe out current contents of the TextInput and replace
|
||||
* with the new value from the tree.
|
||||
*/
|
||||
AttributedString reactTreeAttributedString{};
|
||||
|
||||
/*
|
||||
* Represents all visual attributes of a paragraph of text represented as
|
||||
* a ParagraphAttributes.
|
||||
*/
|
||||
ParagraphAttributes paragraphAttributes;
|
||||
|
||||
int64_t mostRecentEventCount{0};
|
||||
|
||||
/**
|
||||
* Stores an opaque cache ID used on the Java side to refer to a specific
|
||||
* AttributedString for measurement purposes only.
|
||||
*/
|
||||
int64_t cachedAttributedStringId{0};
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -26,4 +26,5 @@ target_link_libraries(react_renderer_core
|
||||
react_utils
|
||||
runtimeexecutor)
|
||||
target_compile_reactnative_options(react_renderer_core PRIVATE "Fabric")
|
||||
target_compile_definitions(react_renderer_core PUBLIC RN_SERIALIZABLE_STATE)
|
||||
target_compile_options(react_renderer_core PRIVATE -Wpedantic)
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <react/debug/react_native_assert.h>
|
||||
#include <react/renderer/core/State.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
template <typename StateDataT>
|
||||
concept StateDataWithMapBuffer = requires(StateDataT stateData) {
|
||||
{ stateData.getMapBuffer() } -> std::same_as<MapBuffer>;
|
||||
@@ -107,7 +107,7 @@ class ConcreteState : public State {
|
||||
family->dispatchRawState(std::move(stateUpdate));
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#if defined(RN_SERIALIZABLE_STATE)
|
||||
folly::dynamic getDynamic() const override {
|
||||
return getData().getDynamic();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <fbjni/fbjni.h>
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
@@ -62,7 +62,7 @@ class State {
|
||||
*/
|
||||
size_t getRevision() const;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
virtual folly::dynamic getDynamic() const = 0;
|
||||
virtual MapBuffer getMapBuffer() const = 0;
|
||||
virtual jni::local_ref<jobject> getJNIReference() const = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
@@ -24,7 +24,7 @@ namespace facebook::react {
|
||||
struct StateData final {
|
||||
using Shared = std::shared_ptr<const void>;
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
StateData() = default;
|
||||
StateData(const StateData& previousState, folly::dynamic data) {}
|
||||
folly::dynamic getDynamic() const;
|
||||
|
||||
Reference in new issue
Block a user