Skip to content

Commit

Permalink
🛠 Refactor: Remove Deprecated Native Events
Browse files Browse the repository at this point in the history
Related:
* `TODO:2023-03-04-13-15-11` - Refactor: Update Modal Events
* `TODO:2023-03-30-15-53-13` - Remove deprecated native events.
  • Loading branch information
dominicstop committed Apr 14, 2023
1 parent c8681a6 commit a4efb8c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 58 deletions.
49 changes: 1 addition & 48 deletions ios/src_library/React Native/RNIModalView/RNIModalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,6 @@ public class RNIModalView:
// MARK: - Properties: React Props - Events
// ----------------------------------------

/// RN event callbacks for whenever a modal is presented/dismissed
/// via functions or from swipe to dismiss gestures
@objc var onModalShow: RCTDirectEventBlock?;
@objc var onModalDismiss: RCTDirectEventBlock?;

/// RN event callbacks for: UIAdaptivePresentationControllerDelegate
/// Note: that these are only invoked in response to dismiss gestures
@objc var onModalDidDismiss: RCTDirectEventBlock?;
@objc var onModalWillDismiss: RCTDirectEventBlock?;
@objc var onModalAttemptDismiss: RCTDirectEventBlock?;

/// RN event callbacks whenever a modal is focused/blurred
/// note: is not called when the modal is topmost to prevent duplication
/// of the onModalShow/onModalDismiss events
@objc var onModalBlur: RCTDirectEventBlock?;
@objc var onModalFocus: RCTDirectEventBlock?;


// MARK: - Properties: React Props - Value
// ---------------------------------------
Expand Down Expand Up @@ -697,10 +680,7 @@ extension RNIModalView: UIAdaptivePresentationControllerDelegate {
public func presentationControllerDidAttemptToDismiss(
_ presentationController: UIPresentationController
) {
self.onModalAttemptDismiss?(
self.synthesizedBaseEventData.synthesizedJSDictionary
);


#if DEBUG
print(
"Log - RNIModalView+UIAdaptivePresentationControllerDelegate"
Expand Down Expand Up @@ -753,11 +733,6 @@ extension RNIModalView: RNIViewControllerLifeCycleNotifiable {
self.modalPresentationNotificationDelegate
.notifyOnModalDidShow(sender: self);

if !self.modalPresentationState.wasCancelledDismissViaGesture {
self.onModalShow?(
self.synthesizedBaseEventData.synthesizedJSDictionary
);
};
};

public func viewWillDisappear(sender: UIViewController, animated: Bool) {
Expand All @@ -767,11 +742,6 @@ extension RNIModalView: RNIViewControllerLifeCycleNotifiable {
self.modalPresentationNotificationDelegate
.notifyOnModalWillHide(sender: self);

if self.modalPresentationState.state.isDismissingViaGesture {
self.onModalWillDismiss?(
self.synthesizedBaseEventData.synthesizedJSDictionary
);
};
};

public func viewDidDisappear(sender: UIViewController, animated: Bool) {
Expand All @@ -781,17 +751,6 @@ extension RNIModalView: RNIViewControllerLifeCycleNotifiable {
self.modalPresentationNotificationDelegate
.notifyOnModalDidHide(sender: self);

if self.modalPresentationState.statePrev.isDismissingViaGesture {
self.onModalDidDismiss?(
self.synthesizedBaseEventData.synthesizedJSDictionary
);

} else {
self.onModalDismiss?(
self.synthesizedBaseEventData.synthesizedJSDictionary
);
};

self.deinitControllers();
};
};
Expand Down Expand Up @@ -895,9 +854,6 @@ extension RNIModalView: RNIModalFocusNotifiable {
);
#endif

self.onModalFocus?(
eventData.synthesizedJSDictionary
);
};

public func onModalWillBlurNotification(sender: any RNIModal) {
Expand All @@ -921,8 +877,5 @@ extension RNIModalView: RNIModalFocusNotifiable {
);
#endif

self.onModalBlur?(
eventData.synthesizedJSDictionary
);
};
};
10 changes: 0 additions & 10 deletions ios/src_library/React Native/RNIModalView/RNIModalViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ @interface RCT_EXTERN_MODULE(RNIModalViewManager, RCTViewManager)
// MARK: Props - Callbacks/Events
// ------------------------------

RCT_EXPORT_VIEW_PROPERTY(onModalShow , RCTDirectEventBlock);
RCT_EXPORT_VIEW_PROPERTY(onModalDismiss , RCTDirectEventBlock);

RCT_EXPORT_VIEW_PROPERTY(onModalBlur , RCTDirectEventBlock);
RCT_EXPORT_VIEW_PROPERTY(onModalFocus, RCTDirectEventBlock);

RCT_EXPORT_VIEW_PROPERTY(onModalDidDismiss , RCTDirectEventBlock);
RCT_EXPORT_VIEW_PROPERTY(onModalWillDismiss , RCTDirectEventBlock);
RCT_EXPORT_VIEW_PROPERTY(onModalAttemptDismiss, RCTDirectEventBlock);

// --------------------------------
// MARK: Props - RN Component Props
// --------------------------------
Expand Down

0 comments on commit a4efb8c

Please sign in to comment.