Skip to content

Commit 3b5c261

Browse files
committed
Move around the docs a bit
1 parent 4eab005 commit 3b5c261

3 files changed

Lines changed: 4 additions & 34 deletions

File tree

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
---
2-
id: pixels
3-
title: Physical vs Logical Pixels
4-
layout: docs
5-
category: Guides
6-
permalink: docs/pixels.html
7-
next: style
8-
---
9-
10-
111
## Pixel Grid Snapping
122

133
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.
@@ -17,23 +7,3 @@ In practice, we found out that developers do not want this feature and they have
177
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.
188

199
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.
20-
21-
## Displaying a line that's as thin as the device permits
22-
23-
A width of 1 is actually 2 physical pixels thick on an iPhone 4 and 3 physical pixels thick on an iphone 6+. If you want to display a line that's as thin as possible, you can use a width of `1 / PixelRatio.get()`. It's a technique that works on all the devices independent of their pixel density.
24-
25-
```javascript
26-
style={{ borderWidth: 1 / PixelRatio.get() }}
27-
```
28-
29-
## Fetching a correctly sized image
30-
31-
You should get a higher resolution image if you are on a high pixel density device. A good rule of thumb is to multiply the size of the image you display by the pixel ratio.
32-
33-
```javascript
34-
var image = getImage({
35-
width: 200 * PixelRatio.get(),
36-
height: 100 * PixelRatio.get(),
37-
});
38-
<Image source={image} style={{width: 200, height: 100}} />
39-
```

docs/Tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
id: tutorial
33
title: Tutorial
44
layout: docs
5-
category: Tutorial
5+
category: Quick Start
66
permalink: docs/tutorial.html
77
next: videos
88
---
@@ -147,7 +147,7 @@ var styles = StyleSheet.create({
147147
AppRegistry.registerComponent('SampleApp', () => SampleApp);
148148
```
149149

150-
After changing the entire contents of this file to the snippet above you should be able to simply cmd+R in the simulator to see the change. It should render “Loading movies..." until it gets the data back from Rotten Tomatoes at which point it should render “Movies loaded”.
150+
After changing the entire contents of this file to the snippet above you should be able to simply cmd+R in the simulator to see the change. It should render “Loading movies..." until it gets the data back from Rotten Tomatoes at which point it should render “Movies loaded”.
151151

152152
## ListView
153153

docs/Videos.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
id: videos
33
title: Videos
44
layout: docs
5-
category: Community Resources
5+
category: Quick Start
66
permalink: docs/videos.html
7-
next: pixels
7+
next: style
88
---
99

1010
<iframe width="650" height="315" src="//www.youtube.com/embed/KVZ-P-ZI6W4" frameborder="0" allowfullscreen></iframe>

0 commit comments

Comments
 (0)