Skip to content

Commit

Permalink
Check for text on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
m-bert committed Jan 16, 2025
1 parent c2c0f58 commit 9426805
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion apple/RNGestureHandlerModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#import <ReactCommon/CallInvoker.h>
#import <ReactCommon/RCTTurboModule.h>

#import <react/renderer/components/text/ParagraphShadowNode.h>
#import <react/renderer/components/text/TextShadowNode.h>
#import <react/renderer/uimanager/primitives.h>
#endif // RCT_NEW_ARCH_ENABLED

Expand All @@ -27,6 +29,8 @@

#import <React/RCTJSThread.h>

#import <cstring>

#ifdef RCT_NEW_ARCH_ENABLED
using namespace facebook;
using namespace react;
Expand Down Expand Up @@ -101,7 +105,18 @@ void decorateRuntime(jsi::Runtime &runtime)
}
auto shadowNode = shadowNodeFromValue(runtime, arguments[0]);
bool isFormsStackingContext = shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext);
return jsi::Value(isFormsStackingContext);

bool isTextComponent = false;

if (auto v = dynamic_pointer_cast<const ParagraphShadowNode>(shadowNode); v != nullptr) {
isTextComponent = true;
}

if (auto v = dynamic_pointer_cast<const TextShadowNode>(shadowNode); v != nullptr) {
isTextComponent = true;
}

return jsi::Value(isFormsStackingContext || isTextComponent);
});
runtime.global().setProperty(runtime, "isFormsStackingContext", std::move(isFormsStackingContext));
}
Expand Down

0 comments on commit 9426805

Please sign in to comment.