diff --git a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift index abb1ee44..85bd8945 100644 --- a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift +++ b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift @@ -326,13 +326,16 @@ extension RNIModalSheetViewDelegate: ModalSheetPresentationStateEventsNotifiable prevState: ModalSheetState?, currentState: ModalSheetState ) { - let payload: Dictionary = [ - "prevState": currentState.asDictionary, + var payload: Dictionary = [ "currentState": currentState.asDictionary ]; + payload.unwrapAndMerge(withOther: [ + "prevState": prevState?.asDictionary + ]); + self.dispatchEvent( - for: .onModalSheetStateWillChange, + for: .onModalSheetStateDidChange, withPayload: payload ); }; diff --git a/ios/Temp/ModalSheetPresentationStateMachine.swift b/ios/Temp/ModalSheetPresentationStateMachine.swift index 3560be8d..caae4603 100644 --- a/ios/Temp/ModalSheetPresentationStateMachine.swift +++ b/ios/Temp/ModalSheetPresentationStateMachine.swift @@ -24,6 +24,10 @@ public class ModalSheetPresentationStateMachine { // --------------- public func setStateExplicit(nextState: ModalSheetState){ + guard self.currentState != nextState else { + return; + }; + let prevState = self.prevState; let currentState = self.currentState;