Skip to content

Commit 33608c8

Browse files
authored
Merge pull request #20 from sujameslin/master
RN47 android build fail fix - #19
2 parents 760bf34 + f86c48b commit 33608c8

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

android/app/src/main/java/io/rnkit/actionsheetpicker/ASPickerViewPackage.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ public List<NativeModule> createNativeModules(ReactApplicationContext reactConte
2121
return Arrays.<NativeModule>asList(new ASDatePickerViewModule(reactContext), new ASDataPickerViewModule(reactContext));
2222
}
2323

24-
@Override
25-
public List<Class<? extends JavaScriptModule>> createJSModules() {
26-
return Collections.emptyList();
27-
}
28-
2924
@Override
3025
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
3126
return Collections.emptyList();

ios/Pickers/AbstractActionSheetPicker.m

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ - (void)showActionSheetPicker {
246246
[masterView addSubview:self.toolbar];
247247

248248
//ios7 picker draws a darkened alpha-only region on the first and last 8 pixels horizontally, but blurs the rest of its background. To make the whole popup appear to be edge-to-edge, we have to add blurring to the remaining left and right edges.
249-
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
249+
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1 && !(IS_IPAD)) {
250250
CGRect rect = CGRectMake(0, self.toolbar.frame.origin.y, _borderWidth, masterView.frame.size.height - self.toolbar.frame.origin.y);
251251
UIToolbar *leftEdge = [[UIToolbar alloc] initWithFrame:rect];
252252
rect.origin.x = masterView.frame.size.width - _borderWidth;
@@ -314,14 +314,18 @@ - (IBAction)actionPickerCancel:(id)sender {
314314
}
315315

316316
- (void)dismissPicker {
317+
bool animated = YES;
318+
if (IS_IPAD) {
319+
animated = NO;
320+
}
317321
#if __IPHONE_4_1 <= __IPHONE_OS_VERSION_MAX_ALLOWED
318322
if (self.actionSheet)
319323
#else
320324
if (self.actionSheet && [self.actionSheet isVisible])
321325
#endif
322-
[_actionSheet dismissWithClickedButtonIndex:0 animated:YES];
326+
[_actionSheet dismissWithClickedButtonIndex:0 animated:animated];
323327
else if (self.popOverController && self.popOverController.popoverVisible)
324-
[_popOverController dismissPopoverAnimated:YES];
328+
[_popOverController dismissPopoverAnimated:animated];
325329
self.actionSheet = nil;
326330
self.popOverController = nil;
327331
self.selfReference = nil;
@@ -474,8 +478,13 @@ - (UIToolbar *)createPickerToolbarWithTitle:(NSString *)title {
474478

475479
pickerToolbar.barTintColor = self.toolbarBackgroundColor;
476480
pickerToolbar.tintColor = self.toolbarButtonsColor;
477-
pickerToolbar.layer.borderWidth = 1;
478-
pickerToolbar.layer.borderColor = [[UIColor colorWithRed:0.812 green:0.839 blue:0.859 alpha:1] CGColor];
481+
if (IS_IPAD) {
482+
pickerToolbar.layer.borderWidth = 0;
483+
pickerToolbar.layer.borderColor = [[UIColor colorWithWhite:1 alpha:0] CGColor];
484+
} else {
485+
pickerToolbar.layer.borderWidth = 1;
486+
pickerToolbar.layer.borderColor = [[UIColor colorWithRed:0.812 green:0.839 blue:0.859 alpha:1] CGColor];
487+
}
479488

480489
NSMutableArray *barItems = [[NSMutableArray alloc] init];
481490

@@ -748,8 +757,16 @@ - (void)presentPopover:(UIPopoverController *)popover {
748757
}
749758
else if ((self.containerView)) {
750759
dispatch_async(dispatch_get_main_queue(), ^{
751-
[popover presentPopoverFromRect:_containerView.bounds inView:_containerView
752-
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
760+
if (IS_IPAD) {
761+
CGRect cotainerViewframe = _containerView.bounds;
762+
CGFloat popoverPointX = (cotainerViewframe.size.width) / 2;
763+
CGFloat popoverPointY = (cotainerViewframe.size.height) / 2;
764+
[popover presentPopoverFromRect:CGRectMake(popoverPointX, popoverPointY, 0, 0) inView:_containerView
765+
permittedArrowDirections:0 animated:YES];
766+
} else {
767+
[popover presentPopoverFromRect:_containerView.bounds inView:_containerView
768+
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
769+
}
753770

754771
});
755772
return;
@@ -801,4 +818,3 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
801818
}
802819

803820
@end
804-

0 commit comments

Comments
 (0)