PixelRatio.pixel()

Summary:
This implements #5073. It adds a static method `PixelRatio.pixel()` which returns the smallest drawable line width, primarily for use in styles.

It also updates the example apps to use the new function.
Closes https://github.com/facebook/react-native/pull/5076

Reviewed By: svcscm

Differential Revision: D2799849

Pulled By: nicklockwood

fb-gh-sync-id: b83a77790601fe882affbf65531114e7c5cf4bdf
This commit is contained in:
Kyle Corbitt
2016-01-15 05:14:27 -08:00
committed by facebook-github-bot-5
parent 78c6e416ae
commit cd89016ee7
15 changed files with 60 additions and 49 deletions

View File

@@ -15,7 +15,6 @@
var React = require('react-native');
var {
PixelRatio,
Navigator,
StyleSheet,
ScrollView,
@@ -131,7 +130,7 @@ var styles = StyleSheet.create({
button: {
backgroundColor: 'white',
padding: 15,
borderBottomWidth: 1 / PixelRatio.get(),
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#CDCDCD',
},
buttonText: {

View File

@@ -16,7 +16,6 @@
var React = require('react-native');
var {
Navigator,
PixelRatio,
StyleSheet,
ScrollView,
TabBarIOS,
@@ -185,7 +184,7 @@ var styles = StyleSheet.create({
button: {
backgroundColor: 'white',
padding: 15,
borderBottomWidth: 1 / PixelRatio.get(),
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#CDCDCD',
},
buttonText: {

View File

@@ -16,7 +16,6 @@
var React = require('react-native');
var {
PixelRatio,
Navigator,
ScrollView,
StyleSheet,
@@ -164,7 +163,7 @@ var styles = StyleSheet.create({
button: {
backgroundColor: 'white',
padding: 15,
borderBottomWidth: 1 / PixelRatio.get(),
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#CDCDCD',
},
buttonText: {

View File

@@ -16,7 +16,6 @@
var React = require('react-native');
var {
Navigator,
PixelRatio,
ScrollView,
StyleSheet,
Text,
@@ -190,7 +189,7 @@ var styles = StyleSheet.create({
button: {
backgroundColor: 'white',
padding: 15,
borderBottomWidth: 1 / PixelRatio.get(),
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#CDCDCD',
},
buttonText: {

View File

@@ -20,7 +20,6 @@ var ViewExample = require('./ViewExample');
var createExamplePage = require('./createExamplePage');
var {
AlertIOS,
PixelRatio,
ScrollView,
StyleSheet,
Text,
@@ -227,7 +226,7 @@ var styles = StyleSheet.create({
},
line: {
backgroundColor: '#bbbbbb',
height: 1 / PixelRatio.get(),
height: StyleSheet.hairlineWidth,
},
row: {
backgroundColor: 'white',
@@ -236,7 +235,7 @@ var styles = StyleSheet.create({
paddingVertical: 15,
},
separator: {
height: 1 / PixelRatio.get(),
height: StyleSheet.hairlineWidth,
backgroundColor: '#bbbbbb',
marginLeft: 15,
},

View File

@@ -229,7 +229,7 @@ var styles = StyleSheet.create({
logBox: {
padding: 20,
margin: 10,
borderWidth: 1 / PixelRatio.get(),
borderWidth: StyleSheet.hairlineWidth,
borderColor: '#f0f0f0',
backgroundColor: '#f9f9f9',
},
@@ -237,7 +237,7 @@ var styles = StyleSheet.create({
padding: 10,
margin: 10,
height: 120,
borderWidth: 1 / PixelRatio.get(),
borderWidth: StyleSheet.hairlineWidth,
borderColor: '#f0f0f0',
backgroundColor: '#f9f9f9',
},

View File

@@ -18,7 +18,6 @@
var React = require('react-native');
var {
ListView,
PixelRatio,
StyleSheet,
Text,
TextInput,
@@ -159,7 +158,7 @@ var styles = StyleSheet.create({
paddingVertical: 8,
},
separator: {
height: 1 / PixelRatio.get(),
height: StyleSheet.hairlineWidth,
backgroundColor: '#bbbbbb',
marginLeft: 15,
},

View File

@@ -17,7 +17,6 @@
var React = require('react-native');
var {
PixelRatio,
ProgressBarAndroid,
StyleSheet,
Text,
@@ -312,7 +311,7 @@ var styles = StyleSheet.create({
flexDirection: 'row',
paddingVertical: 8,
alignItems: 'center',
borderBottomWidth: 1 / PixelRatio.get(),
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: 'grey',
},
textButton: {

View File

@@ -21,7 +21,6 @@ var {
CameraRoll,
Image,
LinkingIOS,
PixelRatio,
ProgressViewIOS,
StyleSheet,
Text,
@@ -343,7 +342,7 @@ var styles = StyleSheet.create({
flexDirection: 'row',
paddingVertical: 8,
alignItems: 'center',
borderBottomWidth: 1 / PixelRatio.get(),
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: 'grey',
},
photoLabel: {