Skip to content

Commit

Permalink
Fix build on RN 0.74 (#3024)
Browse files Browse the repository at this point in the history
## Description

Changes made in #2966 were necessary for Gesture Handler to work with React Native 0.75. Unfortunately, they also broke builds on versions below 0.75. This PR fixes those builds.

Fixes #3023

## Test plan

I've tested following scenarios:

1. New React Native 0.74.3 app without these changes - build fails 🔴 
2. New React Native 0.74.3 app with this PR applied - builds properly 🟢 
3. New React Native 0.75.0-rc.6 app with this PR applies - builds properly 🟢
  • Loading branch information
m-bert committed Aug 1, 2024
1 parent ff5e23c commit c4039a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions android/src/main/jni/cpp-adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ void decorateRuntime(jsi::Runtime &runtime) {
return jsi::Value::null();
}

auto shadowNodeWrapper = arguments[0]
.asObject(runtime).getNativeState<ShadowNodeWrapper>(runtime);
bool isFormsStackingContext = shadowNodeWrapper->shadowNode->getTraits()
.check(ShadowNodeTraits::FormsStackingContext);
auto shadowNode = shadowNodeFromValue(runtime, arguments[0]);
bool isFormsStackingContext = shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);

return jsi::Value(isFormsStackingContext);
});
Expand Down
6 changes: 2 additions & 4 deletions apple/RNGestureHandlerModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ void decorateRuntime(jsi::Runtime &runtime)
if (!arguments[0].isObject()) {
return jsi::Value::null();
}

auto shadowNodeWrapper = arguments[0].asObject(runtime).getNativeState<ShadowNodeWrapper>(runtime);
bool isFormsStackingContext =
shadowNodeWrapper->shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);
auto shadowNode = shadowNodeFromValue(runtime, arguments[0]);
bool isFormsStackingContext = shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);
return jsi::Value(isFormsStackingContext);
});
runtime.global().setProperty(runtime, "isFormsStackingContext", std::move(isFormsStackingContext));
Expand Down

0 comments on commit c4039a1

Please sign in to comment.