forked from acaziasoftcom/react-native-sweet-alert
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade SweetAlert to Swift 4.2 compatible
- Loading branch information
1 parent
e16e153
commit 5612a9d
Showing
6 changed files
with
707 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// RNSweetAlert-Bridging-Header.h | ||
// RNSweetAlert | ||
// | ||
// Created by Quan Pham on 10/13/18. | ||
// Copyright © 2018 Facebook. All rights reserved. | ||
// | ||
|
||
#ifndef RNSweetAlert_Bridging_Header_h | ||
#define RNSweetAlert_Bridging_Header_h | ||
|
||
#import <React/RCTBridgeModule.h> | ||
#import <React/RCTEventEmitter.h> | ||
#import <React/RCTViewManager.h> | ||
#import <React/RCTConvert.h> | ||
#import <React/RCTUtils.h> | ||
|
||
#endif /* RNSweetAlert_Bridging_Header_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <React/RCTEventEmitter.h> | ||
#import <React/RCTBridgeModule.h> | ||
|
||
@interface RCT_EXTERN_MODULE(SweetAlertManager, NSObject); | ||
|
||
- (dispatch_queue_t)methodQueue { | ||
return dispatch_get_main_queue(); | ||
} | ||
|
||
RCT_EXTERN_METHOD(showAlert: (NSString *)title callback:(RCTResponseSenderBlock)); | ||
|
||
RCT_EXTERN_METHOD(showAlertWithSubtitle: (NSString *)title subTitle:(NSString *) subTitle); | ||
|
||
RCT_EXTERN_METHOD(hideSweetAlert); | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Foundation | ||
|
||
@objc(SweetAlertManager) | ||
class SweetAlertManager: RCTViewManager { | ||
|
||
var alert = SweetAlert(); | ||
|
||
@objc | ||
func showAlert(_ title: String, callback: RCTResponseSenderBlock) -> Void { | ||
_ = alert.showAlert(title) | ||
} | ||
|
||
@objc | ||
func showAlertWithSubtitle(_ title: String, subTitle: String?) -> Void { | ||
_ = alert.showAlert(title, subTitle: subTitle, style: AlertStyle.none) | ||
} | ||
|
||
@objc | ||
func hideSweetAlert() -> Void { | ||
_ = alert.closeAlert(0) | ||
} | ||
|
||
override static func requiresMainQueueSetup() -> Bool { | ||
return true | ||
} | ||
} |
Oops, something went wrong.