Skip to content

Commit

Permalink
Updates from Wed Feb 25
Browse files Browse the repository at this point in the history
- [react-packager] Fix lint errors | Amjad Masad
- [react-packager] fix a typo s/pacakge/package | Chengyin Liu
- [react-packager] Fix jest tests | Amjad Masad
- [Image] Really improve the quality of mis-sized images w/trilinear filtering | James Ide
  • Loading branch information
vjeux committed Mar 2, 2015
1 parent c892d2c commit 9bebc7e
Show file tree
Hide file tree
Showing 40 changed files with 227 additions and 276 deletions.
7 changes: 4 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
"Map": true,
"module": false,
"process": false,
"Promise": false,
"Promise": true,
"requestAnimationFrame": true,
"require": false,
"Set": true,
"setImmediate": true,
"setInterval": false,
"setTimeout": false,
"window": false,
"XMLHttpRequest": false
"XMLHttpRequest": false,
"pit": false
},

"rules": {
Expand Down Expand Up @@ -148,7 +149,7 @@
"no-multi-spaces": 0,
"brace-style": 0, // enforce one true brace style (off by default)
"camelcase": 0, // require camel case names
"consistent-this": 1, // enforces consistent naming when capturing the current execution context (off by default)
"consistent-this": [1, "self"], // enforces consistent naming when capturing the current execution context (off by default)
"eol-last": 1, // enforce newline at the end of file, with no multiple empty lines
"func-names": 0, // require function expressions to have a name (off by default)
"func-style": 0, // enforces use of function declarations or expressions (off by default)
Expand Down
4 changes: 4 additions & 0 deletions ReactKit/Views/RCTNetworkImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ - (void)setImageURL:(NSURL *)imageURL resetToDefaultImageWhileLoading:(BOOL)rese
if (reset) {
self.layer.contentsScale = _defaultImage.scale;
self.layer.contents = (__bridge id)_defaultImage.CGImage;
self.layer.minificationFilter = kCAFilterTrilinear;
self.layer.magnificationFilter = kCAFilterTrilinear;
}
if ([imageURL.pathExtension caseInsensitiveCompare:@"gif"] == NSOrderedSame) {
_downloadToken = [_imageDownloader downloadDataForURL:imageURL block:^(NSData *data, NSError *error) {
Expand All @@ -61,6 +63,8 @@ - (void)setImageURL:(NSURL *)imageURL resetToDefaultImageWhileLoading:(BOOL)rese
self.layer.bounds = CGRectMake(0, 0, CGImageGetWidth(firstFrame), CGImageGetHeight(firstFrame));
self.layer.contentsScale = 1.0;
self.layer.contentsGravity = kCAGravityResizeAspect;
self.layer.minificationFilter = kCAFilterLinear;
self.layer.magnificationFilter = kCAFilterLinear;
[self.layer addAnimation:animation forKey:@"contents"];
}
// TODO: handle errors
Expand Down
4 changes: 4 additions & 0 deletions ReactKit/Views/RCTStaticImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ - (void)_updateImage
if (!UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, _capInsets)) {
image = [image resizableImageWithCapInsets:_capInsets resizingMode:UIImageResizingModeStretch];
}

// Apply trilinear filtering to smooth out mis-sized images
self.layer.minificationFilter = kCAFilterTrilinear;
self.layer.magnificationFilter = kCAFilterTrilinear;

super.image = image;
}
Expand Down
5 changes: 5 additions & 0 deletions jestSupport/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

global.setImmediate = global.setImmediate || function(fn) {
return setTimeout(fn, 0);
};
4 changes: 4 additions & 0 deletions jestSupport/scriptPreprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ module.exports = {
transformSource: transformSource,

process: function(src, fileName) {
if (fileName.match(/node_modules/)) {
return src;
}

try {
return transformSource(src);
} catch(e) {
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
{
"name": "react-native",
"version": "0.0.1",
"version": "0.1.0",
"description": "Build native apps with React!",
"repository": {
"type": "git",
"url": "[email protected]:facebook/react-native.git"
},
"jest": {
"scriptPreprocessor": "jestSupport/scriptPreprocess.js",
"setupEnvScriptFile": "jestSupport/env.js",
"testPathIgnorePatterns": [
"/node_modules/",
"/packager/"
"/node_modules/"
],
"testFileExtensions": [
"js"
],
"unmockedModulePathPatterns": [
"source-map"
]
},
"scripts": {
Expand Down
Empty file removed packager/react-packager/,
Empty file.
86 changes: 0 additions & 86 deletions packager/react-packager/.jshintrc

This file was deleted.

14 changes: 0 additions & 14 deletions packager/react-packager/package.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

jest.autoMockOff();

describe('Activity', function() {
Expand Down
2 changes: 2 additions & 0 deletions packager/react-packager/src/Activity/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var COLLECTION_PERIOD = 1000;

var _endedEvents = Object.create(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

function ModuleDescriptor(fields) {
if (!fields.id) {
throw new Error('Missing required fields id');
Expand Down Expand Up @@ -28,7 +30,7 @@ ModuleDescriptor.prototype.toJSON = function() {
id: this.id,
path: this.path,
dependencies: this.dependencies
}
};
};

module.exports = ModuleDescriptor;
Loading

0 comments on commit 9bebc7e

Please sign in to comment.