mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-09 04:08:11 +08:00
Run eslint --fix
Summary: CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable. **Test plan** Quick manual test, cosmetic changes only. Closes https://github.com/facebook/react-native/pull/16229 Differential Revision: D6009748 Pulled By: TheSavior fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
This commit is contained in:
committed by
Facebook Github Bot
parent
32e5c8e5b5
commit
0cd69e8a02
@@ -107,7 +107,7 @@ class Dimensions {
|
||||
handler: Function
|
||||
) {
|
||||
invariant(
|
||||
'change' === type,
|
||||
type === 'change',
|
||||
'Trying to subscribe to unknown event: "%s"', type
|
||||
);
|
||||
eventEmitter.addListener(type, handler);
|
||||
@@ -121,7 +121,7 @@ class Dimensions {
|
||||
handler: Function
|
||||
) {
|
||||
invariant(
|
||||
'change' === type,
|
||||
type === 'change',
|
||||
'Trying to remove listener for unknown event: "%s"', type
|
||||
);
|
||||
eventEmitter.removeListener(type, handler);
|
||||
|
||||
@@ -29,33 +29,33 @@ var Dimensions = require('Dimensions');
|
||||
* });
|
||||
* <Image source={image} style={{width: 200, height: 100}} />
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* ## Pixel grid snapping
|
||||
*
|
||||
* In iOS, you can specify positions and dimensions for elements with arbitrary
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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 JavaScript and within the layout engine works
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class PixelRatio {
|
||||
/**
|
||||
|
||||
@@ -51,6 +51,6 @@ const RCTLog = {
|
||||
setWarningHandler(handler: typeof warningHandler): void {
|
||||
warningHandler = handler;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RCTLog;
|
||||
|
||||
@@ -47,8 +47,8 @@ function createStrictShapeTypeChecker(
|
||||
invariant(
|
||||
false,
|
||||
`Invalid props.${propName} key \`${key}\` supplied to \`${componentName}\`.` +
|
||||
`\nBad object: ` + JSON.stringify(props[propName], null, ' ') +
|
||||
`\nValid keys: ` + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
||||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
||||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
||||
);
|
||||
}
|
||||
var error = checker(propValue, key, componentName, location, ...rest);
|
||||
@@ -56,7 +56,7 @@ function createStrictShapeTypeChecker(
|
||||
invariant(
|
||||
false,
|
||||
error.message +
|
||||
`\nBad object: ` + JSON.stringify(props[propName], null, ' ')
|
||||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user