Skip to content

Commit

Permalink
⭐️ Impl: RNIModalData
Browse files Browse the repository at this point in the history
Related:
* TODO:2023-03-04-06-34-28 - Library Native Cleanup

Summary:
* Impl. `RNIModalData`.
* Impl. `RNIModalIdentity.synthesizedModalData`.
* Impl. `RNIModalIdentity.synthesizedModalDataDict`.
  • Loading branch information
dominicstop committed Mar 26, 2023
1 parent 06b2ecc commit 9e18139
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ios/src_library/React Native/RNIModal/RNIModal+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,23 @@ extension RNIModalIdentity where Self: RNIModalPresentation {
return -1;
};
};

extension RNIModalIdentity where Self: RNIModal {

var synthesizedModalData: RNIModalData {
RNIModalData(
modalNativeID: self.modalNativeID,
modalIndex: self.modalIndex,
currentModalIndex: RNIModalManagerShared.currentModalIndex,
isModalPresented: self.isModalPresented,
isModalInFocus: self.isModalInFocus,
synthesizedIsModalInFocus: self.synthesizedIsModalInFocus,
synthesizedIsModalPresented: self.synthesizedIsModalPresented,
synthesizedModalIndex: self.synthesizedModalIndex
);
};

var synthesizedModalDataDict: Dictionary<String, Any> {
self.synthesizedModalData.synthesizedDictionary;
};
};
22 changes: 22 additions & 0 deletions ios/src_library/React Native/RNIModal/RNIModalData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// RNIModalData.swift
// react-native-ios-modal
//
// Created by Dominic Go on 3/26/23.
//

import Foundation

public struct RNIModalData: RNIDictionarySynthesizable {
let modalNativeID: String;

let modalIndex: Int;
let currentModalIndex: Int;

let isModalPresented: Bool;
let isModalInFocus: Bool;

let synthesizedIsModalInFocus: Bool;
let synthesizedIsModalPresented: Bool;
let synthesizedModalIndex: Int;
};

0 comments on commit 9e18139

Please sign in to comment.