From 0adc68cfd455686bf0b3830ea9dc9f526e44c063 Mon Sep 17 00:00:00 2001 From: lukewalczak Date: Wed, 6 May 2020 12:46:52 +0200 Subject: [PATCH 1/2] Patch RN to have a possibility to disable buttons in action sheet --- Podfile | 4 +++- Podfile.lock | 2 +- patches/react-native+0.61.5.patch | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Podfile b/Podfile index ebbf6f12a969..1d635dbbcc2a 100644 --- a/Podfile +++ b/Podfile @@ -209,7 +209,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) - + puts 'Patching RCTActionSheet to add possibility to disable action sheet buttons - + it could be removed once PR with that functionality will be merged into RN' + %x(patch Pods/React-RCTActionSheet/RCTActionSheetManager.m < patches/react-native+0.61.5.patch) ## Convert the 3rd-party license acknowledgements markdown into html for use in the app require 'commonmarker' diff --git a/Podfile.lock b/Podfile.lock index 9329667bfc07..1695dbb4f117 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -714,6 +714,6 @@ SPEC CHECKSUMS: ZendeskSupportSDK: a87ab1e4badace92c75eb11dc77ede1e995b2adc ZIPFoundation: 249fa8890597086cd536bb2df5c9804d84e122b0 -PODFILE CHECKSUM: 7a04c07ffa23154204dfe4e49c8c7a1c471cbf2f +PODFILE CHECKSUM: e04f98b8a03f59a11627b892eb9339f57d37710b COCOAPODS: 1.8.4 diff --git a/patches/react-native+0.61.5.patch b/patches/react-native+0.61.5.patch index 8e7bf6d52836..b3c8c8ff3d25 100644 --- a/patches/react-native+0.61.5.patch +++ b/patches/react-native+0.61.5.patch @@ -1,3 +1,26 @@ +diff --git a/node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheetManager.m b/node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheetManager.m +index 65fa2bb..c5f265b 100644 +--- a/node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheetManager.m ++++ b/node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheetManager.m +@@ -66,6 +66,7 @@ - (void)presentViewController:(UIViewController *)alertController + NSArray *buttons = [RCTConvert NSStringArray:options[@"options"]]; + NSInteger cancelButtonIndex = options[@"cancelButtonIndex"] ? [RCTConvert NSInteger:options[@"cancelButtonIndex"]] : -1; + NSArray *destructiveButtonIndices; ++ NSArray *disabledButtonIndices = [RCTConvert NSArray:options[@"disabledButtonIndices"]]; + if ([options[@"destructiveButtonIndex"] isKindOfClass:[NSArray class]]) { + destructiveButtonIndices = [RCTConvert NSArray:options[@"destructiveButtonIndex"]]; + } else { +@@ -108,6 +109,10 @@ - (void)presentViewController:(UIViewController *)alertController + callback(@[@(localIndex)]); + }]]; + ++ if ([disabledButtonIndices containsObject:@(localIndex)]) { ++ [alertController.actions[localIndex] setEnabled:false]; ++ } ++ + index++; + } + 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 From 01eb7b6b41bdcda1752abe35d1eaf44c24967661 Mon Sep 17 00:00:00 2001 From: lukewalczak Date: Wed, 6 May 2020 19:49:36 +0200 Subject: [PATCH 2/2] Fix podfile.lock --- Podfile.lock | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 3544bdaf09d6..51b58a309303 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -490,12 +490,14 @@ DEPENDENCIES: - ZIPFoundation (~> 0.9.8) SPEC REPOS: - https://cdn.cocoapods.org/: + trunk: - 1PasswordExtension + - Alamofire - AlamofireImage - AlamofireNetworkActivityIndicator - AppCenter - Automattic-Tracks-iOS + - boost-for-react-native - Charts - CocoaLumberjack - DoubleConversion @@ -504,14 +506,18 @@ SPEC REPOS: - Gifu - GoogleSignIn - GoogleToolboxForMac + - Gridicons - GTMSessionFetcher - JTAppleCalendar - lottie-ios - MediaEditor - MRProgress - Nimble + - NSObject-SafeExpectations + - "NSURL+IDN" - OCMock - OHHTTPStubs + - Reachability - Sentry - SimulatorStatusMagic - Sodium @@ -519,6 +525,7 @@ SPEC REPOS: - SVProgressHUD - TOCropViewController - UIDeviceIdentifier + - WordPress-Aztec-iOS - WordPress-Editor-iOS - WordPressAuthenticator - WordPressKit @@ -535,16 +542,6 @@ SPEC REPOS: - ZendeskSupportProvidersSDK - ZendeskSupportSDK - ZIPFoundation - https://github.com/CocoaPods/Specs.git: - - Alamofire - - boost-for-react-native - - CocoaLumberjack - - GoogleToolboxForMac - - Gridicons - - NSObject-SafeExpectations - - "NSURL+IDN" - - Reachability - - WordPress-Aztec-iOS EXTERNAL SOURCES: FBLazyVector: @@ -717,6 +714,6 @@ SPEC CHECKSUMS: ZendeskSupportSDK: a87ab1e4badace92c75eb11dc77ede1e995b2adc ZIPFoundation: 249fa8890597086cd536bb2df5c9804d84e122b0 -PODFILE CHECKSUM: e86847c081f449709d83c99ad5791c70774197c3 +PODFILE CHECKSUM: 886cb7b0f71d3ac74c5cb674a8df7684868a7cd9 -COCOAPODS: 1.9.1 +COCOAPODS: 1.8.4