OvalMoney / react-native-fitness

A React Native module to interact with Apple Healthkit and Google Fit.
MIT License
341 stars 68 forks source link

[Android] fix: crash - using consumed WriteableMap #101

Closed OrenZak closed 3 years ago

OrenZak commented 3 years ago

According to react-native implementation, we should not reuse the WriteableMap, because it is consumed. https://github.com/facebook/react-native/blob/66173e1d04285471a936b225ff34c4b8a5fc8dab/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeArray.java#L52 This will result in a native crash on Android.

The fix: moving the creation of WritableMap into the for a loop.

@Francesco-Voto can you have a look please ?