Skip to content

Commit

Permalink
fix: build error with rn 0.73-rc.4 (#1972)
Browse files Browse the repository at this point in the history
## Description

Fixes building against react-native 0.73.0-rc4 in fabric mode on android

## Changes

Updated
common/cpp/react/renderer/components/rnscreens/RNSScreenComponentDescriptor.h
to build with fabric on 0.73-rc4.

## Screenshots / GIFs

### Before

### After

## Test code and steps to reproduce

```sh
npx [email protected] init rnscreenstest
yarn add react-native-screens
cd android
# change newArchEnabled to true in `gradle.properties`
gradlew build
```



## Checklist

- [ ] Included code example that can be used to test this change
- [ ] Updated TS types
- [ ] Updated documentation: <!-- For adding new props to native-stack
-->
- [ ]
https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md
- [ ]
https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md
- [ ]
https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx
- [ ]
https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx
- [ ] Ensured that CI passes
  • Loading branch information
mfazekas authored Nov 27, 2023
1 parent d8e2a9b commit 3849e2c
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ class RNSScreenComponentDescriptor final
public:
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;

void adopt(ShadowNode::Unshared const &shadowNode) const override {
void adopt(ShadowNode& shadowNode) const override {
react_native_assert(
std::dynamic_pointer_cast<RNSScreenShadowNode>(shadowNode));
auto screenShadowNode =
std::static_pointer_cast<RNSScreenShadowNode>(shadowNode);
dynamic_cast<RNSScreenShadowNode*>(&shadowNode));
auto& screenShadowNode =
static_cast<RNSScreenShadowNode&>(shadowNode);

react_native_assert(
std::dynamic_pointer_cast<YogaLayoutableShadowNode>(screenShadowNode));
auto layoutableShadowNode =
std::static_pointer_cast<YogaLayoutableShadowNode>(screenShadowNode);
dynamic_cast<YogaLayoutableShadowNode*>(&screenShadowNode));
auto& layoutableShadowNode =
dynamic_cast<YogaLayoutableShadowNode&>(screenShadowNode);

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

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

Expand Down

0 comments on commit 3849e2c

Please sign in to comment.