-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the iOS skeleton code for exposing native KlarnaStandaloneWebView…
… as a React Native component.
- Loading branch information
1 parent
ee78d35
commit c5dbfe4
Showing
7 changed files
with
141 additions
and
0 deletions.
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,5 @@ | ||
#import <React/RCTViewManager.h> | ||
|
||
@interface KlarnaStandaloneWebViewManager : RCTViewComponentView | ||
|
||
@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,22 @@ | ||
#import "KlarnaStandaloneWebViewManager.h" | ||
|
||
#import <React/RCTUIManager.h> | ||
#import <React/RCTLog.h> | ||
|
||
|
||
#ifdef RCT_NEW_ARCH_ENABLED | ||
#import "view/newarch/KlarnaStandaloneWebView.h" | ||
#else | ||
#import "view/oldarch/KlarnaStandaloneWebView.h" | ||
#endif | ||
|
||
@implementation KlarnaStandaloneWebViewManager | ||
|
||
RCT_EXPORT_MODULE(RNKlarnaStandaloneWebView) | ||
|
||
#pragma mark - View | ||
|
||
RCT_EXPORT_VIEW_PROPERTY(returnUrl, NSString) | ||
|
||
@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,18 @@ | ||
#if RCT_NEW_ARCH_ENABLED | ||
|
||
#import <React/RCTUIManager.h> | ||
#import <React/RCTViewComponentView.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface KlarnaStandaloneWebView : RCTViewComponentView | ||
|
||
@property (nonatomic, weak) RCTUIManager* uiManager; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END | ||
|
||
#endif | ||
|
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,25 @@ | ||
#if RCT_NEW_ARCH_ENABLED | ||
|
||
#import "KlarnaStandaloneWebView.h" | ||
|
||
#import <AVFoundation/AVFoundation.h> | ||
#import <KlarnaMobileSDK/KlarnaMobileSDK-Swift.h> | ||
#import <React/RCTLog.h> | ||
|
||
#import <react/renderer/components/RNKlarnaMobileSDK/ComponentDescriptors.h> | ||
#import <react/renderer/components/RNKlarnaMobileSDK/EventEmitters.h> | ||
#import <react/renderer/components/RNKlarnaMobileSDK/Props.h> | ||
#import <react/renderer/components/RNKlarnaMobileSDK/RCTComponentViewHelpers.h> | ||
|
||
#import "RCTFabricComponentsPlugins.h" | ||
|
||
using namespace facebook::react; | ||
|
||
@interface KlarnaStandaloneWebView () | ||
|
||
@end | ||
|
||
@implementation KlarnaStandaloneWebView | ||
|
||
#endif | ||
|
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,25 @@ | ||
#if !RCT_NEW_ARCH_ENABLED | ||
|
||
#import <React/RCTUIManager.h> | ||
|
||
#import <AVFoundation/AVFoundation.h> | ||
#import <UIKit/UIKit.h> | ||
#import <React/RCTView.h> | ||
#import <React/RCTUIManager.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface KlarnaStandaloneWebView : UIView | ||
|
||
@property (nonatomic, strong) NSString* returnUrl; | ||
|
||
#pragma mark - React Native Overrides | ||
- (void) setReturnUrl:(NSString *)returnUrl; | ||
|
||
@property (nonatomic, weak) RCTUIManager* uiManager; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END | ||
|
||
#endif |
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,28 @@ | ||
#if !RCT_NEW_ARCH_ENABLED | ||
|
||
#import "KlarnaStandaloneWebView.h" | ||
|
||
#import <KlarnaMobileSDK/KlarnaMobileSDK-Swift.h> | ||
#import <React/RCTLog.h> | ||
|
||
@interface KlarnaStandaloneWebView () | ||
|
||
@property (nonatomic, strong) KlarnaStandaloneWebView* klarnaStandaloneWebView; | ||
|
||
@end | ||
|
||
@implementation KlarnaStandaloneWebView | ||
|
||
#pragma mark - React Native Overrides | ||
|
||
- (void) setReturnUrl:(NSString *)returnUrl { | ||
_returnUrl = returnUrl; | ||
if (returnUrl.length > 0) { | ||
self.klarnaStandaloneWebView.returnUrl = [NSURL URLWithString:self.returnUrl]; | ||
} | ||
} | ||
|
||
@end | ||
|
||
#endif | ||
|