diff --git a/docs/netinfo.html b/docs/netinfo.html index b6eb58b19ff..aab5c81c712 100644 --- a/docs/netinfo.html +++ b/docs/netinfo.html @@ -1,31 +1,4 @@ -
NetInfo exposes info about online/offline status
Asynchronously determine if the device is online and on a cellular network.
none - device is offlinewifi - device is online and connected via wifi, or is the iOS simulatorcell - device is connected via Edge, 3G, WiMax, or LTEunknown - error case and the network status is unknownAvailable on all platforms. Asynchronously fetch a boolean to determine -internet connectivity.
Returns the device pixel density. Some examples:
Converts a layout size (dp) to pixel size (px).
Guaranteed to return an integer number.
// No-op for iOS, but used on the web. Should not be documented.
In iOS, you can specify positions and dimensions for elements with arbitrary precision, for example 29.674825. But, ultimately the physical display only have a fixed number of pixels, for example 640×960 for iphone 4 or 750×1334 for iphone 6. iOS tries to be as faithful as possible to the user value by spreading one original pixel into multiple ones to trick the eye. The downside of this technique is that it makes the resulting element look blurry.
In practice, we found out that developers do not want this feature and they have to work around it by doing manual rounding in order to avoid having blurry elements. In React Native, we are rounding all the pixels automatically.
We have to be careful when to do this rounding. You never want to work with rounded and unrounded values at the same time as you're going to accumulate rounding errors. Having even one rounding error is deadly because a one pixel border may vanish or be twice as big.
In React Native, everything in JS and within the layout engine work with arbitrary precision numbers. It's only when we set the position and dimensions of the native element on the main thread that we round. Also, rounding is done relative to the root rather than the parent, again to avoid accumulating rounding errors.