Files
react-native/ReactCommon/react/renderer/components/view/YogaStylableProps.h
T
Ruslan Shestopalyuk 110b191b14 Refactor ViewPropsMapBuffer -> general MapBuffer props mechanism
Summary:
Previously, ViewPropsMapBuffer conversions were hardcoded deep in Android infrastructrue. I've generalized this into a different mechanism to allow any Props struct to support MapBuffer props.

There are still some things that need to be cleaned up and this should be treated as experimental. One thing we likely want to do is remove the hardcoded IDs (fine for codegen'd code; less so for handwritten) and use compile-time-hashed IDs instead with human-readable string names.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D38708719

fbshipit-source-id: 64603dee7f21828be31346c555d99862dab304ea
2022-10-03 04:11:02 -07:00

54 lines
1.2 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 <yoga/YGStyle.h>
#include <react/renderer/core/Props.h>
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/debug/DebugStringConvertible.h>
namespace facebook {
namespace react {
class YogaStylableProps : public Props {
public:
YogaStylableProps() = default;
YogaStylableProps(
const PropsParserContext &context,
YogaStylableProps const &sourceProps,
RawProps const &rawProps,
bool shouldSetRawProps = true);
void setProp(
const PropsParserContext &context,
RawPropsPropNameHash hash,
const char *propName,
RawValue const &value);
#ifdef ANDROID
void propsDiffMapBuffer(Props const *oldProps, MapBufferBuilder &builder)
const override;
#endif
#pragma mark - Props
YGStyle yogaStyle{};
#if RN_DEBUG_STRING_CONVERTIBLE
#pragma mark - DebugStringConvertible (Partial)
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};
} // namespace react
} // namespace facebook