Skip to content

Commit

Permalink
🛠 Refactor: Remove RNIModalView.onRequestResult
Browse files Browse the repository at this point in the history
TODO:2023-03-04-05-20-26 - Library Native Cleanup

Summary: Native + JS Change - Cleanup - Remove `onRequestResult` event usage for keeping track of whether an async request has been fulfilled.
  • Loading branch information
dominicstop committed Mar 3, 2023
1 parent 45861b6 commit 76cc559
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 37 deletions.
15 changes: 0 additions & 15 deletions ios/src_library/React Native/RNIModalView/RNIModalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ class RNIModalView: UIView {
// MARK: Properties: React Props - Events/Callbacks
// ------------------------------------------------

// RN event callback for when a RNIModalViewManager "command"
// has been completed via dispatchViewManagerCommand from js.
// Used in js/rn-side for wrapping UIManager commands inside
// promises so they can be resolved/rejected.
@objc var onRequestResult: RCTDirectEventBlock?;

// RN event callbacks for whenever a modal is presented/dismissed
// via functions or from swipe to dismiss gestures
@objc var onModalShow : RCTDirectEventBlock?;
Expand Down Expand Up @@ -463,15 +457,6 @@ extension RNIModalView {
completion?(success, error);
};
};

public func requestModalInfo(
completion: CompletionHandler? = nil
){
let params = self.createModalNativeEventDict();

completion?(true, nil);
self.onRequestResult?(params);
};
};

// MARK: - Internal Functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ @interface RCT_EXTERN_MODULE(RNIModalViewManager, RCTViewManager)

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

RCT_EXPORT_VIEW_PROPERTY(onModalBlur , RCTDirectEventBlock);
RCT_EXPORT_VIEW_PROPERTY(onModalFocus, RCTDirectEventBlock);
Expand Down
8 changes: 0 additions & 8 deletions src/components/ModalView/ModalView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
OnModalDismissEvent,
OnModalFocusEvent,
OnModalShowEvent,
OnRequestResultEvent,
RNIModalView,
} from '../../native_components/RNIModalView';

Expand Down Expand Up @@ -97,7 +96,6 @@ export class ModalView extends
// native props - events
onModalShow,
onModalDismiss,
onRequestResult,
onModalBlur,
onModalFocus,
onModalDidDismiss,
Expand Down Expand Up @@ -154,7 +152,6 @@ export class ModalView extends
modalBGBlurEffectStyle,
onModalShow,
onModalDismiss,
onRequestResult,
onModalBlur,
onModalFocus,
onModalDidDismiss,
Expand Down Expand Up @@ -266,10 +263,6 @@ export class ModalView extends
// Native Event Handlers
// ---------------------

_handleOnRequestResult: OnRequestResultEvent = ({ nativeEvent }) => {
this.props.onRequestResult?.({ nativeEvent });
};

_handleOnModalBlur: OnModalBlurEvent = (event) => {
this.props.onModalBlur?.(event);

Expand Down Expand Up @@ -366,7 +359,6 @@ export class ModalView extends
onModalFocus={this._handleOnModalFocus}
onModalShow={this._handleOnModalShow}
onModalDismiss={this._handleOnModalDismiss}
onRequestResult={this._handleOnRequestResult}
onModalDidDismiss={this._handleOnModalDidDismiss}
onModalWillDismiss={this._handleOnModalWillDismiss}
onModalAttemptDismiss={this._handleOnModalAttemptDismiss}
Expand Down
1 change: 0 additions & 1 deletion src/components/ModalView/ModalViewTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export type ModalViewBaseProps = Partial<
// props - events
| 'onModalShow'
| 'onModalDismiss'
| 'onRequestResult'
| 'onModalBlur'
| 'onModalFocus'
| 'onModalDidDismiss'
Expand Down
10 changes: 0 additions & 10 deletions src/native_components/RNIModalView/RNIModalViewEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ export type OnModalDismissEventObject = NativeSyntheticEvent<
RNIModalViewInfo & {}
>;

// TODO
export type OnRequestResultEventObject = NativeSyntheticEvent<
RNIModalViewInfo & {}
>;

// TODO
export type OnModalBlurEventObject = NativeSyntheticEvent<
RNIModalViewInfo & {}
Expand Down Expand Up @@ -66,11 +61,6 @@ export type OnModalDismissEvent = (
event: OnModalDismissEventObject
) => void;

// eslint-disable-next-line prettier/prettier
export type OnRequestResultEvent = (
event: OnRequestResultEventObject
) => void;

// eslint-disable-next-line prettier/prettier
export type OnModalBlurEvent = (
event: OnModalBlurEventObject
Expand Down
2 changes: 0 additions & 2 deletions src/native_components/RNIModalView/RNIModalViewTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import type { ViewManagerConstantMap } from 'src/types/ViewModuleRelatedTypes';
import type {
OnModalShowEvent,
OnModalDismissEvent,
OnRequestResultEvent,
OnModalBlurEvent,
OnModalFocusEvent,
OnModalDidDismissEvent,
Expand Down Expand Up @@ -46,7 +45,6 @@ export type RNIModalViewProps = ViewProps & {
// TODO: Rename - Add `will/did` prefix and deprecate prev. props
onModalShow: OnModalShowEvent;
onModalDismiss: OnModalDismissEvent;
onRequestResult: OnRequestResultEvent;

onModalBlur: OnModalBlurEvent;
onModalFocus: OnModalFocusEvent;
Expand Down

0 comments on commit 76cc559

Please sign in to comment.