-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
put Long value to WritableMap #9685
Comments
Why don't you put it as a double then? JS doesn't have multiple numeric types, whether you'd put a long or double on the native side would be irrelevant for JS. There are multiple ways to convert a long into a double. You can either try to cast it with As a reply to "I believe following could be considered as bug.", it's surely not a bug as there's no method that causes a failure or anything, it's more of an inconvenience. It was a convenience for me as well recently, so I simply did the casting above. If it's too much a trouble for you, please send a PR and I'm sure a Facebook employee would consider it. |
Ok I exaggerated bit with bug definition just to get attention to this. :-) Sorry for that. Also thank you for suggestion with using double. Will try that. Anyway I'll keep this issue open if you don't mind. Maybe I can take look on RN internals and implement that. |
@hey99xx brings up a great point. JavaScript does not have longs and a PR for this issue is going to cause subtle bugs. You must either use a 64-bit double, 53-bit int (Java's 32-bit ints are OK), or string. This is a limitation of JavaScript, not React Native, so I'm going to close this out. |
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
Expected Results
WritableMap should have method putLong.
Additional Information
The text was updated successfully, but these errors were encountered: