CaioQuirinoMedeiros / react-native-currency-input

A simple currency input component for both iOS and Android
https://www.npmjs.com/package/react-native-currency-input
MIT License
158 stars 25 forks source link

Flickering #20

Closed nandorojo closed 2 weeks ago

nandorojo commented 2 years ago

I've mentioned this before, but formatting the number causes a weird flicker on iOS.

https://user-images.githubusercontent.com/13172299/150595203-a85a3e13-e433-47a1-8f01-7b844f20c835.mp4

It appears that this is a known RN issue (https://github.com/facebook/react-native/issues/24585).

Interestingly, on Web, there is no flicker:

https://user-images.githubusercontent.com/13172299/150594706-a694fa7c-1405-4f21-9309-79fcfc61bd7e.mp4

This comment says that it can be solved by using defaultValue instead of value. Although it doesn't have many upvotes, so I'm not sure.

Are there any possible alternatives to fix this? Perhaps setNativeProps or something?

nandorojo commented 2 years ago

Sorry the first video wasn't working at first, I just uploaded a new one.

nandorojo commented 2 years ago

For example, I wonder if we can setNativeProps inside of onChangeText or onChange directly.

kissa1001 commented 2 weeks ago

Any updates on this issue?

CaioQuirinoMedeiros commented 2 weeks ago

The flickering happens because of how the TextInput works on React Native. The onChangeText is asynchronous with the native event. Nothing we can do about that