react-native-modal-selector icon indicating copy to clipboard operation
react-native-modal-selector copied to clipboard

Delayed onChange

Open zlanich opened this issue 6 years ago • 5 comments

The onChange event currently doesn't fire until the closing animation is 100%, done if not later. This causes the UI to not be updated to the new value (at least when using a custom selector component), until about a full second later.

Would it be possible to fire the onChange event right away instead of after the animation?

I don't see a reason that would be problematic. Thoughts?

zlanich avatar May 19 '19 19:05 zlanich

That should be ok. Please submit a PR and we'll merge right away.

peacechen avatar May 19 '19 22:05 peacechen

I agree that conceptual this should be just fine. Just be aware of an issue regarding iOS and onChange while closing a modal. The way it is done today is to prevent this issue. I guess it is possible to do this in other ways, just remember to test on iOS with alert (e.g. the SampleApp). Related issues:

mikaello avatar May 20 '19 05:05 mikaello

@mikaello All good points. My one thought is this: Isn't the issue of an Alert interrupting the JS thread an issue in a million different ways? I feel like this issue would pop up in every project if you're firing off an Alert when an animation or other process may be running.

Is that even something worth sacrificing UI feedback/response to fix, something where the likely better solution would be to use a non-blocking Alert alternative? I feel like it's similar to alerts in a web browser. They're kind of lame to begin with, and most mature web apps don't use them anyway.

zlanich avatar May 21 '19 17:05 zlanich

I noticed the delay too. Could it be merged anyway?

manhthepixta avatar Sep 25 '19 03:09 manhthepixta

Hopefully this doesn't cause unintended side effects. If it does, we could add a prop to control the onChange behavior -- previous work-around or none.

peacechen avatar Sep 25 '19 04:09 peacechen