No Long for React Native

William Liu
1 min readDec 12, 2016
photo credit: deccanchronicle.com

Long (or Int 64) is a big integer type native client developers use. “number” is the number type JavaScript uses. But they don’t get along with each other.

The problem is that JavaScript has only one number type — Double!

Therefore, the fraction part of the number had 51 bits. This means the precision is up to 15 digits of Integer. Here is the reference if you want to learn more.

If you define an interface in Native side using long or pass initial props containing a long, you will have difficult time debugging it. The bug only repros when you pass in a bug number.

Keep this in mind and never mix Long and React Native!

--

--