Skip to content

Commit

Permalink
🛠 Refactor: Remove RNIModalView.DefaultValues
Browse files Browse the repository at this point in the history
Related:
* TODO:2023-03-16-15-16-09 - Remove RNIModalView.DefaultValues
* TODO:2023-03-04-06-34-28 - Library Native Cleanup

Summary: Remove `RNIModalView.DefaultValues` struct + usage.
  • Loading branch information
dominicstop committed Mar 17, 2023
1 parent 0035a8c commit ef06d39
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions ios/src_library/React Native/RNIModalView/RNIModalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,6 @@ class RNIModalView: UIView {

typealias CompletionHandler = (_ isSuccess: Bool, _ error: RNIModalViewError?) -> Void

struct DefaultValues {
static let presentationStyle: UIModalPresentationStyle = {
guard #available(iOS 13.0, *) else { return .overFullScreen };
return .automatic;
}();

static let presentationStyleString =
Self.presentationStyle.stringDescription() as NSString;

static let modalBGBlurEffectStyle: UIBlurEffect.Style = {
guard #available(iOS 13.0, *) else { return .light };
return .systemThinMaterial;
}();

static let modalBGBlurEffectStyleString =
Self.modalBGBlurEffectStyle.stringDescription() as NSString;
};

// ----------------
// MARK: Properties
// ----------------
Expand Down Expand Up @@ -94,7 +76,14 @@ class RNIModalView: UIView {
}
};

@objc var modalBGBlurEffectStyle: NSString = DefaultValues.modalBGBlurEffectStyleString {
@objc var modalBGBlurEffectStyle: NSString = {
let defaultBlurEffectStyle: UIBlurEffect.Style = {
guard #available(iOS 13.0, *) else { return .light };
return .systemThinMaterial;
}();

return defaultBlurEffectStyle.stringDescription() as NSString;
}() {
didSet {
guard oldValue != self.modalBGBlurEffectStyle
else { return };
Expand All @@ -112,9 +101,19 @@ class RNIModalView: UIView {
}
};

private var _modalPresentationStyle = DefaultValues.presentationStyle;
private var _modalPresentationStyle: UIModalPresentationStyle = {
guard #available(iOS 13.0, *) else { return .overFullScreen };
return .automatic;
}();

@objc var modalPresentationStyle: NSString = DefaultValues.presentationStyleString {
@objc var modalPresentationStyle: NSString = {
let defaultModalPresentationStyle: UIModalPresentationStyle = {
guard #available(iOS 13.0, *) else { return .overFullScreen };
return .automatic;
}();

return defaultModalPresentationStyle.stringDescription() as NSString;
}() {
didSet {
guard oldValue != self.modalPresentationStyle
else { return };
Expand Down

0 comments on commit ef06d39

Please sign in to comment.