mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
7e47df0a41
Summary: This adds: 1. `CSSValueVariant`: A union-y type, mapping to a collection of CSS basic data types, and a set of allowed keywords. The aim here is to more closely model the data types after the CSS spec, to allow RN to store them correctly, while not taking up too much space. These types will form the foundation of Yoga prop storage (and probably some other props down the line), so compactness is a priority. 2. `parseCSSValue()`: This uses the previously added Tokenizer, along with parsing rules, to be able to parse a single component value, into a literal keyword, `<length>`, `<length-percentage>`, `<percentage>`, or `<number>`. This will be wired to the props parsing infrastructure. See D53461299 for an example of what this will look like in props storage. Changelog: [Internal] Reviewed By: rozele Differential Revision: D53342595 fbshipit-source-id: 3f00dfd7c0ead3dbef4605a61e9859cf69945fe5
23 lines
507 B
C++
23 lines
507 B
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 <type_traits>
|
|
|
|
namespace facebook::react {
|
|
|
|
/**
|
|
* Polyfill of C++ 23 to_underlying()
|
|
* https://en.cppreference.com/w/cpp/utility/to_underlying
|
|
*/
|
|
constexpr auto to_underlying(auto e) noexcept {
|
|
return static_cast<std::underlying_type_t<decltype(e)>>(e);
|
|
}
|
|
|
|
} // namespace facebook::react
|