mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
fbios BottomSheet implementation
Summary: Several things need to ironed out: 1) LocalState in Fabric C++, 2) setting dimensions of BottomSheet component to 0,0 for parent. Reviewed By: shergin Differential Revision: D14426167 fbshipit-source-id: 45a90a7971c87672872108a9e360926b4a6095f0
This commit is contained in:
committed by
Facebook Github Bot
parent
ac482cfc64
commit
34499002f2
@@ -1,3 +1,4 @@
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
|
||||
@@ -101,6 +101,20 @@ void YogaLayoutableShadowNode::setProps(const YogaStylableProps &props) {
|
||||
yogaNode_.setStyle(props.yogaStyle);
|
||||
}
|
||||
|
||||
void YogaLayoutableShadowNode::setSize(Size size) const {
|
||||
auto style = yogaNode_.getStyle();
|
||||
style.dimensions[YGDimensionWidth] = yogaStyleValueFromFloat(size.width);
|
||||
style.dimensions[YGDimensionHeight] = yogaStyleValueFromFloat(size.height);
|
||||
yogaNode_.setStyle(style);
|
||||
}
|
||||
|
||||
void YogaLayoutableShadowNode::setPositionType(
|
||||
YGPositionType positionType) const {
|
||||
auto style = yogaNode_.getStyle();
|
||||
style.positionType = positionType;
|
||||
yogaNode_.setStyle(style);
|
||||
}
|
||||
|
||||
void YogaLayoutableShadowNode::layout(LayoutContext layoutContext) {
|
||||
if (!getIsLayoutClean()) {
|
||||
ensureUnsealed();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <react/core/Sealable.h>
|
||||
#include <react/core/ShadowNode.h>
|
||||
#include <react/debug/DebugStringConvertible.h>
|
||||
#include <react/graphics/Geometry.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
@@ -63,6 +64,16 @@ class YogaLayoutableShadowNode : public LayoutableShadowNode,
|
||||
*/
|
||||
void setProps(const YogaStylableProps &props);
|
||||
|
||||
/**
|
||||
* Sets layoutable size of node.
|
||||
*/
|
||||
void setSize(Size size) const;
|
||||
|
||||
/**
|
||||
* Sets position type of Yoga node (relative, absolute).
|
||||
*/
|
||||
void setPositionType(YGPositionType positionType) const;
|
||||
|
||||
#pragma mark - LayoutableShadowNode
|
||||
|
||||
void cleanLayout() override;
|
||||
|
||||
@@ -75,7 +75,7 @@ class RawProps {
|
||||
|
||||
/*
|
||||
* Returns a const unowning pointer to `RawValue` of a prop with a given name.
|
||||
* Returns `nullptr`, it a prop with the given name does not exist.
|
||||
* Returns `nullptr` if a prop with the given name does not exist.
|
||||
*/
|
||||
const RawValue *at(const std::string &name) const noexcept {
|
||||
auto iterator = map_.find(name);
|
||||
|
||||
@@ -57,8 +57,8 @@ T convertRawProp(
|
||||
return sourceValue;
|
||||
}
|
||||
|
||||
// Special case: `null` always means `the prop was removed, use default
|
||||
// value`.
|
||||
// Special case: `null` always means "the prop was removed, use default
|
||||
// value".
|
||||
if (!rawValue->hasValue()) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user