maxs15 / maxs15/react-native-modalbox

Callback on open/close

Open
#111 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.9k
Forks
496
PR merge metrics
No merged PRs in 30d

Description

I'm aware of the `onOpen` and `onClose` properties but I want to highlight a use case for also having the ability to implement a callback function when the open/close animation has completed.

In particular, I'm using the `close` function in two different places. My modal view has a close icon for which I simply want to close. It also has a submit button and for this case, if I simply close and then call my data save function, the animation does not show properly because the UI thread gets blocked long enough. I have wrapped my data save function in a Promise but the animation is still affected. So in this case, I would like to wait for the close animation to complete and then, in a callback, execute my save function. Using the `onClosed` event doesn't seem to be a better option here as the function that responds to this event would need to know which of the two close scenarios I'm performing and would require polluting the component with unnecessary additional data and logic.

I'm all for implementing this myself and submitting a PR but I'm wondering if there was a reason this was not implemented in the first place.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by locating the modal component's existing onOpen, onClose, and onClosed handling, then trace where the open/close animation completes. Done means a callback can distinguish the initiating close action and run only after the close animation has finished.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.