-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
Thank you guys for great work on react-native for Android.
Issue Description
I believe following could be considered as bug. Currently it is impossible to put Long value into WritableMap. Typical usage of Long value is android geolocation time (timestamp). It could not be be converted to int, because it is larger than java Integer.MAX_VALUE.
Steps to Reproduce / Code Snippets
@ReactMethod
public void getLocations(Callback success, Callback error) {
WritableArray locationsArray = Arguments.createArray();
LocationDAO dao = DAOFactory.createLocationDAO(getContext());
try {
Collection<Location> locations = dao.getAllLocations();
for (Location location : locations) {
WritableMap out = Arguments.createMap();
out.putInt("time", Convert.safeLongToInt(location.getTime())); // time cannot be converted safely to int
out.putDouble("latitude", location.getLatitude());
out.putDouble("longitude", location.getLongitude());
out.putDouble("accuracy", location.getAccuracy());
out.putDouble("speed", location.getSpeed());
out.putDouble("altitude", location.getAltitude());
out.putDouble("bearing", location.getBearing());
locationsArray.pushMap(out);
}
success.invoke(locationsArray);
} catch (Exception e) {
Log.e(TAG, "Getting all locations failed: " + e.getMessage());
error.invoke("Converting locations to JSON failed.");
}
}
Expected Results
WritableMap should have method putLong.
Additional Information
- React Native version: 0.29
- Platform(s) (iOS, Android, or both?): Android
- Operating System (macOS, Linux, or Windows?): macOS, Linux, Windows
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.