diff --git a/packages/react-native-gesture-handler/shared/shadowNodes/react/renderer/components/rngesturehandler_codegen/RNGestureHandlerDetectorShadowNode.cpp b/packages/react-native-gesture-handler/shared/shadowNodes/react/renderer/components/rngesturehandler_codegen/RNGestureHandlerDetectorShadowNode.cpp index 92bb180e5a..5096a9b4fc 100644 --- a/packages/react-native-gesture-handler/shared/shadowNodes/react/renderer/components/rngesturehandler_codegen/RNGestureHandlerDetectorShadowNode.cpp +++ b/packages/react-native-gesture-handler/shared/shadowNodes/react/renderer/components/rngesturehandler_codegen/RNGestureHandlerDetectorShadowNode.cpp @@ -13,6 +13,7 @@ #include +#include #include namespace facebook::react { @@ -155,6 +156,15 @@ RNGestureHandlerDetectorShadowNode::unflattenNode( std::static_pointer_cast(clonedNode); clonedNodeWithProtectedAccess->traits_.set(ShadowNodeTraits::FormsView); + +#ifdef ANDROID + // Android TextView is not a ViewGroup, so a Paragraph must not form a + // stacking context or its inline views get mounted into it and crash + if (std::strcmp(node->getComponentName(), "Paragraph") == 0) { + return clonedNode; + } +#endif + clonedNodeWithProtectedAccess->traits_.set( ShadowNodeTraits::FormsStackingContext);