-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5322de9
commit ce1abce
Showing
5 changed files
with
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// ModalSheetState+Helpers.swift | ||
// react-native-ios-modal | ||
// | ||
// Created by Dominic Go on 9/29/24. | ||
// | ||
|
||
import Foundation | ||
import DGSwiftUtilities | ||
|
||
|
||
// MARK: - DictionaryRepresentable+Helpers | ||
// --------------------------------------- | ||
|
||
public extension ModalSheetState { | ||
|
||
var asMetrics: RNIModalSheetStateMetrics { | ||
.init(fromModalSheetState: self); | ||
}; | ||
|
||
var asDictionary: [String : Any] { | ||
self.asMetrics.synthesizedDictionary; | ||
}; | ||
}; |
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,45 @@ | ||
// | ||
// RNIModalSheetStateMetrics.swift | ||
// react-native-ios-modal | ||
// | ||
// Created by Dominic Go on 9/29/24. | ||
// | ||
|
||
import Foundation | ||
|
||
|
||
public struct RNIModalSheetStateMetrics: DictionaryRepresentationSynthesizing { | ||
|
||
public var state: ModalSheetState; | ||
public var simplified: ModalSheetState; | ||
|
||
public var isPresenting: Bool; | ||
public var isPresented: Bool; | ||
public var isDismissing: Bool; | ||
public var isDismissed: Bool; | ||
|
||
public init( | ||
state: ModalSheetState, | ||
simplified: ModalSheetState, | ||
isPresenting: Bool, | ||
isPresented: Bool, | ||
isDismissing: Bool, | ||
isDismissed: Bool | ||
) { | ||
self.state = state; | ||
self.simplified = simplified; | ||
self.isPresenting = isPresenting; | ||
self.isPresented = isPresented; | ||
self.isDismissing = isDismissing; | ||
self.isDismissed = isDismissed; | ||
}; | ||
|
||
public init(fromModalSheetState state: ModalSheetState){ | ||
self.state = state; | ||
self.simplified = state.simplified; | ||
self.isPresenting = state.isPresenting; | ||
self.isPresented = state.isPresented; | ||
self.isDismissing = state.isDismissing; | ||
self.isDismissed = state.isDismissed; | ||
}; | ||
}; |
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,13 @@ | ||
|
||
|
||
export type ModalSheetState = | ||
| 'presenting' | ||
| 'dismissViaGestureCancelling' | ||
| 'presented' | ||
| 'dismissViaGestureCancelled' | ||
| 'dismissing' | ||
| 'dismissingViaGesture' | ||
| 'presentingViaGestureCanceling' | ||
| 'dismissed' | ||
| 'dismissedViaGesture' | ||
| 'presentingViaGestureCancelled'; |
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,12 @@ | ||
import type { ModalSheetState } from "./ModalSheetState"; | ||
|
||
|
||
export type RNIModalSheetStateMetrics = { | ||
state: ModalSheetState; | ||
simplified: ModalSheetState; | ||
|
||
isPresenting: boolean; | ||
isPresented: boolean; | ||
isDismissing: boolean; | ||
isDismissed: boolean; | ||
}; |