Fabric: Fixed parsing of `backfaceVisibility` prop
Summary: I have noticed that `backfaceVisibility` example crashes (because actual value is a string/enum, not a boolean), so I fixed it. Reviewed By: JoshuaGross, mdvacca Differential Revision: D15219261 fbshipit-source-id: 27f76cd10903794d597adacb9da7300a42813f8e
This commit is contained in:
Родитель
a6d4bceca4
Коммит
b5d0b6fc2a
|
@ -159,7 +159,7 @@ using namespace facebook::react;
|
|||
|
||||
// `backfaceVisibility`
|
||||
if (oldViewProps.backfaceVisibility != newViewProps.backfaceVisibility) {
|
||||
self.layer.doubleSided = newViewProps.backfaceVisibility;
|
||||
self.layer.doubleSided = newViewProps.backfaceVisibility == BackfaceVisibility::Visible;
|
||||
}
|
||||
|
||||
// `shouldRasterize`
|
||||
|
|
|
@ -51,7 +51,7 @@ class ViewProps : public Props,
|
|||
|
||||
// Transform
|
||||
Transform transform{};
|
||||
bool const backfaceVisibility{};
|
||||
BackfaceVisibility const backfaceVisibility{};
|
||||
bool const shouldRasterize{};
|
||||
int const zIndex{};
|
||||
|
||||
|
|
|
@ -475,6 +475,24 @@ inline void fromRawValue(const RawValue &value, PointerEventsMode &result) {
|
|||
LOG(FATAL) << "Could not parse PointerEventsMode:" << stringValue;
|
||||
}
|
||||
|
||||
inline void fromRawValue(const RawValue &value, BackfaceVisibility &result) {
|
||||
assert(value.hasType<std::string>());
|
||||
auto stringValue = (std::string)value;
|
||||
if (stringValue == "auto") {
|
||||
result = BackfaceVisibility::Auto;
|
||||
return;
|
||||
}
|
||||
if (stringValue == "visible") {
|
||||
result = BackfaceVisibility::Visible;
|
||||
return;
|
||||
}
|
||||
if (stringValue == "hidden") {
|
||||
result = BackfaceVisibility::Hidden;
|
||||
return;
|
||||
}
|
||||
LOG(FATAL) << "Could not parse BackfaceVisibility:" << stringValue;
|
||||
}
|
||||
|
||||
inline void fromRawValue(const RawValue &value, BorderStyle &result) {
|
||||
assert(value.hasType<std::string>());
|
||||
auto stringValue = (std::string)value;
|
||||
|
|
|
@ -18,6 +18,8 @@ namespace react {
|
|||
|
||||
enum class PointerEventsMode { Auto, None, BoxNone, BoxOnly };
|
||||
|
||||
enum class BackfaceVisibility { Auto, Visible, Hidden };
|
||||
|
||||
enum class BorderStyle { Solid, Dotted, Dashed };
|
||||
|
||||
template <typename T>
|
||||
|
|
Загрузка…
Ссылка в новой задаче