Skip to content

Commit

Permalink
Add RN patch for RCTShadowView.m to prevent crash in nested group blo…
Browse files Browse the repository at this point in the history
…ck (wordpress-mobile#13310)

* test patch

* update podfile.lock
  • Loading branch information
dratwas authored and pull[bot] committed Jan 29, 2020
1 parent 0668d0e commit 0b911c7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ target 'WordPress' do


post_install do
puts 'Patching RCTShadowView to fix nested group block - it could be removed after upgrade to 0.62'
%x(patch Pods/React-Core/React/Views/RCTShadowView.m < patches/react-native+0.61.5.patch)


## Convert the 3rd-party license acknowledgements markdown into html for use in the app
require 'commonmarker'
Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,6 @@ SPEC CHECKSUMS:
ZendeskSDK: 99679d8420a6d862773e2ddef0ebcc51b282317d
ZIPFoundation: 89df685c971926b0323087952320bdfee9f0b6ef

PODFILE CHECKSUM: 157e2314e6458ae8d3b542db61fe84aa898b7a1a
PODFILE CHECKSUM: 2013bfbcd92e0ee78c4034af02ed2039eac15058

COCOAPODS: 1.8.4
32 changes: 32 additions & 0 deletions patches/react-native+0.61.5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/node_modules/react-native/React/Views/RCTShadowView.m b/node_modules/react-native/React/Views/RCTShadowView.m
index 40c0cda..646f137 100644
--- a/node_modules/react-native/React/Views/RCTShadowView.m
+++ b/node_modules/react-native/React/Views/RCTShadowView.m
@@ -156,13 +156,11 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT],
- (CGRect)measureLayoutRelativeToAncestor:(RCTShadowView *)ancestor
{
CGPoint offset = CGPointZero;
- NSInteger depth = 30; // max depth to search
RCTShadowView *shadowView = self;
- while (depth && shadowView && shadowView != ancestor) {
+ while (shadowView && shadowView != ancestor) {
offset.x += shadowView.layoutMetrics.frame.origin.x;
offset.y += shadowView.layoutMetrics.frame.origin.y;
shadowView = shadowView->_superview;
- depth--;
}
if (ancestor != shadowView) {
return CGRectNull;
@@ -172,11 +170,9 @@ - (CGRect)measureLayoutRelativeToAncestor:(RCTShadowView *)ancestor

- (BOOL)viewIsDescendantOf:(RCTShadowView *)ancestor
{
- NSInteger depth = 30; // max depth to search
RCTShadowView *shadowView = self;
- while (depth && shadowView && shadowView != ancestor) {
+ while (shadowView && shadowView != ancestor) {
shadowView = shadowView->_superview;
- depth--;
}
return ancestor == shadowView;
}

0 comments on commit 0b911c7

Please sign in to comment.