-
Notifications
You must be signed in to change notification settings - Fork 24.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add dismissActionSheet method to ActionSheetIOS #33189
feat: Add dismissActionSheet method to ActionSheetIOS #33189
Conversation
Base commit: a7a781f |
Base commit: a7a781f |
@motiz88 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Hi @motiz88, would you mind checking why tests are failing internally? |
@@ -28,6 +28,7 @@ @implementation RCTActionSheetManager | |||
RCT_EXPORT_MODULE() | |||
|
|||
@synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED; | |||
NSMutableArray<UIAlertController *> *_alertControllers = [NSMutableArray array]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is _alertControllers
added as a global variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @danilobuerger, I've just changed it to be a property instead
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@@ -47,6 +47,7 @@ export interface Spec extends TurboModule { | |||
|}) => void, | |||
successCallback: (completed: boolean, activityType: ?string) => void, | |||
) => void; | |||
+dismissActionSheet: () => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a nullable function? This will break codebases that leverage OTA type safety in the case where this JS is running on a native app where this property isn't defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I've just updated it
7b68548
to
4123f36
Compare
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @gabrieldonadel in 64ebe5b. When will my fix make it into a release? | Upcoming Releases |
Summary: This PR adds a `dismissActionSheet` method to `ActionSheetIOS` in order to allow dismissing an ActionSheet programmatically. This is especially useful in apps where a user has the ability to open an ActionSheet and then open a push notification that will redirect them to another screen which usually leads to scenarios where the presented ActionSheet has no relation with the current screen. #### TODO - [ ] Submit react-native-website PR updating ActionSheetIOS documentation. ## Changelog [iOS] [Added] - Add dismissActionSheet method to ActionSheetIOS Pull Request resolved: facebook#33189 Test Plan: 1. Open the RNTester app and navigate to the ActionSheetIOS page 2. Test `dismissActionSheet` through the `Show Action Sheet and automatically dismiss it` example https://user-images.githubusercontent.com/11707729/155867546-c6770a49-9b09-45e3-a6b1-4f7645d67dbf.mov Reviewed By: lunaleaps Differential Revision: D34518952 Pulled By: cortinico fbshipit-source-id: 912a9b83ee078f791b42efddf5abb7e1cd09d520
Summary: This PR adds a `dismissActionSheet` method to `ActionSheetIOS` in order to allow dismissing an ActionSheet programmatically. This is especially useful in apps where a user has the ability to open an ActionSheet and then open a push notification that will redirect them to another screen which usually leads to scenarios where the presented ActionSheet has no relation with the current screen. - [ ] Submit react-native-website PR updating ActionSheetIOS documentation. [iOS] [Added] - Add dismissActionSheet method to ActionSheetIOS Pull Request resolved: facebook#33189 Test Plan: 1. Open the RNTester app and navigate to the ActionSheetIOS page 2. Test `dismissActionSheet` through the `Show Action Sheet and automatically dismiss it` example https://user-images.githubusercontent.com/11707729/155867546-c6770a49-9b09-45e3-a6b1-4f7645d67dbf.mov Reviewed By: lunaleaps Differential Revision: D34518952 Pulled By: cortinico fbshipit-source-id: 912a9b83ee078f791b42efddf5abb7e1cd09d520
Summary
This PR adds a
dismissActionSheet
method toActionSheetIOS
in order to allow dismissing an ActionSheet programmatically. This is especially useful in apps where a user has the ability to open an ActionSheet and then open a push notification that will redirect them to another screen which usually leads to scenarios where the presented ActionSheet has no relation with the current screen.TODO
Changelog
[iOS] [Added] - Add dismissActionSheet method to ActionSheetIOS
Test Plan
dismissActionSheet
through theShow Action Sheet and automatically dismiss it
exampleScreen.Recording.2022-02-27.at.00.54.10.mov