mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make dependency on mapbuffer:jni and mapbuffer:mapbuffer explicit (#37598)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37598 changelog: [internal] This diff does three things: - Makes dependency on `mapbuffer:jni` explicit for modules that were accessing it through `react:utils` module. - `renderer:core` now depends on `mapbuffer:mapbuffer`. - Moved `PropsMapBuffer` inside of `Props`. Reviewed By: rubennorte Differential Revision: D46223390 fbshipit-source-id: 2dca1a034f991afd3e9531c4c7fcc7b99239dabe
This commit is contained in:
committed by
Facebook GitHub Bot
parent
20e66db0be
commit
db121c845d
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "Props.h"
|
||||
#include "PropsMapBuffer.h"
|
||||
|
||||
#include <folly/dynamic.h>
|
||||
#include <react/renderer/core/CoreFeatures.h>
|
||||
@@ -48,4 +47,27 @@ void Props::setProp(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
constexpr MapBuffer::Key PROPS_NATIVE_ID = 1;
|
||||
|
||||
void Props::propsDiffMapBuffer(
|
||||
Props const *oldPropsPtr,
|
||||
MapBufferBuilder &builder) const {
|
||||
// Call with default props if necessary
|
||||
if (oldPropsPtr == nullptr) {
|
||||
Props defaultProps{};
|
||||
propsDiffMapBuffer(&defaultProps, builder);
|
||||
return;
|
||||
}
|
||||
|
||||
Props const &oldProps = *oldPropsPtr;
|
||||
Props const &newProps = *this;
|
||||
|
||||
if (oldProps.nativeId != newProps.nativeId) {
|
||||
builder.putString(PROPS_NATIVE_ID, nativeId);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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 "PropsMapBuffer.h"
|
||||
#include "Props.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
void Props::propsDiffMapBuffer(
|
||||
Props const *oldPropsPtr,
|
||||
MapBufferBuilder &builder) const {
|
||||
// Call with default props if necessary
|
||||
if (oldPropsPtr == nullptr) {
|
||||
Props defaultProps{};
|
||||
propsDiffMapBuffer(&defaultProps, builder);
|
||||
return;
|
||||
}
|
||||
|
||||
Props const &oldProps = *oldPropsPtr;
|
||||
Props const &newProps = *this;
|
||||
|
||||
if (oldProps.nativeId != newProps.nativeId) {
|
||||
builder.putString(PROPS_NATIVE_ID, nativeId);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
#endif
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
#include <react/renderer/mapbuffer/MapBuffer.h>
|
||||
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
constexpr MapBuffer::Key PROPS_MAX = 1;
|
||||
constexpr MapBuffer::Key PROPS_NATIVE_ID = 1;
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user