Skip to content

Commit

Permalink
Fix: new arch support for 0.74 (#888)
Browse files Browse the repository at this point in the history
* Fix: new arch support for 0.74

* fix formatting
  • Loading branch information
alanjhughes committed Apr 23, 2024
1 parent d75913f commit 950cea9
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,15 @@ class RNDateTimePickerComponentDescriptor final : public ConcreteComponentDescri
public:
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;

void adopt(ShadowNode::Unshared const &shadowNode) const override {
react_native_assert(std::dynamic_pointer_cast<RNDateTimePickerShadowNode>(shadowNode));
auto pickerShadowNode = std::static_pointer_cast<RNDateTimePickerShadowNode>(shadowNode);
void adopt(ShadowNode& shadowNode) const override {
auto& pickerShadowNode = static_cast<RNDateTimePickerShadowNode&>(shadowNode);
auto& layoutableShadowNode = static_cast<YogaLayoutableShadowNode&>(pickerShadowNode);

react_native_assert(
std::dynamic_pointer_cast<YogaLayoutableShadowNode>(pickerShadowNode));
auto layoutableShadowNode =
std::static_pointer_cast<YogaLayoutableShadowNode>(pickerShadowNode);

auto state = std::static_pointer_cast<const RNDateTimePickerShadowNode::ConcreteState>(shadowNode->getState());
auto state = std::static_pointer_cast<const RNDateTimePickerShadowNode::ConcreteState>(shadowNode.getState());
auto stateData = state->getData();

if(stateData.frameSize.width != 0 && stateData.frameSize.height != 0) {
layoutableShadowNode->setSize(Size{stateData.frameSize.width, stateData.frameSize.height});
layoutableShadowNode.setSize(Size{stateData.frameSize.width, stateData.frameSize.height});
}

ConcreteComponentDescriptor::adopt(shadowNode);
Expand Down

0 comments on commit 950cea9

Please sign in to comment.