Compare commits

...
Author SHA1 Message Date
James Ide 0b48e2d71a [0.10.0] Release 0.10.0 2015-08-26 16:46:13 -07:00
Ben AlpertandJames Ide 37386a8223 [ReactNative] Fix switching to null event listener 2015-08-26 16:39:09 -07:00
Ben AlpertandJames Ide 697e96bc10 [React Native] Fix infinite loop in css-layout
Summary:
Manual pick of https://github.com/facebook/css-layout/commit/9001a3d2 since we're still lagging behind the upstream. Fixes #1378.
2015-08-26 16:18:35 -07:00
James Ide b76ccca30a [Podspec] Remove AnimationExperimental subspec and fix Image subspec
Summary:
AnimationExperimental is gone; remove it. The Image subspec now depends on the networking code, so we have to pull in those files. These changes were necessary to publish 0.10.0-rc to CocoaPods, so would be convenient to get them into master for 0.11.

Fixes #2354
Closes https://github.com/facebook/react-native/pull/2341
Github Author: James Ide <ide@jameside.com>
2015-08-26 16:18:25 -07:00
James Ide 4facc5fc9c [Views] Change rasterization scale to the main screen's scale
Summary:
`view.screen` can be nil if the view has not yet been added to the view hierarchy (e.g. new view), so we should use `[UIScreen mainScreen]` instead.

In the future, if we need to support multiple screens, one possible fix is to set the rasterization scale in didMoveToWindow/Superview. For now we have just one screen, though.
Closes https://github.com/facebook/react-native/pull/2334
Github Author: James Ide <ide@jameside.com>
2015-08-26 16:17:41 -07:00
Nick LockwoodandJames Ide 720874fb10 Fix null values in network requests 2015-08-26 16:17:18 -07:00
James Ide d31d0141e4 [TextInput] Fix multiline TextInput so text and cursor stay in bounds
Summary:
With a multiline TextInput, the text is initially rendered correctly but once you try to edit it, the cursor slides off the top of the view and out of its bounds. Also if the TextInput is scrollable, you can scroll the text out of the bounds of the view, which looks buggy unless you clip the overflow. This occurs because the top content inset is applied to the RCTTextView instead of the UITextView's text container.

This diff fixes both bugs by applying the vertical insets to the UITextView's textContainerInset instead of the RCTTextView's frame (which is a wrapper around a real UITextView).

The left inset is still applied to the frame because there is a bug with the text rendering when the left textContainerInset is negative: the initial text doesn't show up until you focus the text view. The bug doesn't occur when setting the right textContainerInset, so I apply this workaround to only the left inset.

Closes https://github.com/facebook/react-native/pull/2297
Github Author: James Ide <ide@jameside.com>
2015-08-26 16:17:05 -07:00
James Ide 3051f9b888 [npm] Upgrade to stacktrace-parser 0.1.2, which supports io.js
Summary:
stacktrace-parser used to list only Node 0.10 under its list of supported engines. This new version includes Node 1.x and 2.x (i.e. io.js) as well, which addresses the warning during `npm install`.

There's no problem with using the older version of stacktrace-parser; this just clears the warning.

Closes https://github.com/facebook/react-native/pull/1738
Github Author: James Ide <ide@jameside.com>
2015-08-26 16:16:58 -07:00
Nick LockwoodandJames Ide e2e610dbe9 Fix ReactART 2015-08-26 16:16:23 -07:00
James Ide 2b0e8dd303 0.10.0-rc 2015-08-14 21:24:16 -07:00
James Ide 8ed0bafad2 [Podspec] Remove AnimationExperimental subspec and update Image subspec 2015-08-14 21:23:53 -07:00
9 changed files with 47 additions and 33 deletions
+4 -4
View File
@@ -140,12 +140,12 @@ RCT_EXPORT_MODULE()
- (RCTURLRequestCancellationBlock)buildRequest:(NSDictionary *)query
completionBlock:(void (^)(NSURLRequest *request))block
{
NSURL *URL = [RCTConvert NSURL:query[@"url"]];
NSURL *URL = [RCTConvert NSURL:query[@"url"]]; // this is marked as nullable in JS, but should not be null
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];
request.HTTPMethod = [[RCTConvert NSString:query[@"method"]] uppercaseString] ?: @"GET";
request.HTTPMethod = [[RCTConvert NSString:RCTNilIfNull(query[@"method"])] uppercaseString] ?: @"GET";
request.allHTTPHeaderFields = [RCTConvert NSDictionary:query[@"headers"]];
NSDictionary *data = [RCTConvert NSDictionary:query[@"data"]];
NSDictionary *data = [RCTConvert NSDictionary:RCTNilIfNull(query[@"data"])];
return [self processDataForHTTPQuery:data callback:^(NSError *error, NSDictionary *result) {
if (error) {
RCTLogError(@"Error processing request body: %@", error);
@@ -220,7 +220,7 @@ RCT_EXPORT_MODULE()
* - @"contentType" (NSString): the content type header of the request
*
*/
- (RCTURLRequestCancellationBlock)processDataForHTTPQuery:(NSDictionary *)query callback:
- (RCTURLRequestCancellationBlock)processDataForHTTPQuery:(nullable NSDictionary *)query callback:
(RCTURLRequestCancellationBlock (^)(NSError *error, NSDictionary *result))callback
{
if (!query) {
+1 -2
View File
@@ -104,8 +104,7 @@ class XMLHttpRequest extends XMLHttpRequestBase {
sendImpl(method: ?string, url: ?string, headers: Object, data: any): void {
if (typeof data === 'string') {
data = {string: data};
}
if (data instanceof FormData) {
} else if (data instanceof FormData) {
data = {formData: data.getParts()};
}
RCTNetworking.sendRequest(
@@ -27,6 +27,7 @@ var warning = require('warning');
var registrationNames = ReactNativeEventEmitter.registrationNames;
var putListener = ReactNativeEventEmitter.putListener;
var deleteListener = ReactNativeEventEmitter.deleteListener;
var deleteAllListeners = ReactNativeEventEmitter.deleteAllListeners;
type ReactNativeBaseComponentViewConfig = {
@@ -230,7 +231,11 @@ ReactNativeBaseComponent.Mixin = {
_reconcileListenersUponUpdate: function(prevProps, nextProps) {
for (var key in nextProps) {
if (registrationNames[key] && (nextProps[key] !== prevProps[key])) {
putListener(this._rootNodeID, key, nextProps[key]);
if (nextProps[key]) {
putListener(this._rootNodeID, key, nextProps[key]);
} else {
deleteListener(this._rootNodeID, key);
}
}
}
},
+19 -8
View File
@@ -47,14 +47,25 @@ RCT_NOT_IMPLEMENTED(-initWithCoder:(NSCoder *)aDecoder)
- (void)updateFrames
{
// Adjust the insets so that they are as close as possible to single-line
// RCTTextField defaults
UIEdgeInsets adjustedInset = (UIEdgeInsets){
_contentInset.top - 5, _contentInset.left - 4,
_contentInset.bottom, _contentInset.right
};
[_textView setFrame:UIEdgeInsetsInsetRect(self.bounds, adjustedInset)];
[_placeholderView setFrame:UIEdgeInsetsInsetRect(self.bounds, adjustedInset)];
// RCTTextField defaults, using the system defaults of font size 17 and a
// height of 31 points.
//
// We apply the left inset to the frame since a negative left text-container
// inset mysteriously causes the text to be hidden until the text view is
// first focused.
UIEdgeInsets adjustedFrameInset = UIEdgeInsetsZero;
adjustedFrameInset.left = _contentInset.left - 5;
UIEdgeInsets adjustedTextContainerInset = _contentInset;
adjustedTextContainerInset.top += 5;
adjustedTextContainerInset.left = 0;
CGRect frame = UIEdgeInsetsInsetRect(self.bounds, adjustedFrameInset);
_textView.frame = frame;
_placeholderView.frame = frame;
_textView.textContainerInset = adjustedTextContainerInset;
_placeholderView.textContainerInset = adjustedTextContainerInset;
}
- (void)updatePlaceholder
+2 -7
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "React"
s.version = "0.8.0"
s.version = "0.10.0"
s.summary = "Build high quality mobile apps using React."
s.description = <<-DESC
React Native apps are built using the React JS
@@ -50,12 +50,6 @@ Pod::Spec.new do |s|
ss.preserve_paths = "Libraries/AdSupport/*.js"
end
s.subspec 'RCTAnimationExperimental' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/Animation/RCTAnimationExperimental*.{h,m}"
ss.preserve_paths = "Libraries/Animation/*.js"
end
s.subspec 'RCTGeolocation' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/Geolocation/*.{h,m}"
@@ -64,6 +58,7 @@ Pod::Spec.new do |s|
s.subspec 'RCTImage' do |ss|
ss.dependency 'React/Core'
ss.dependency 'React/RCTNetwork'
ss.source_files = "Libraries/Image/*.{h,m}"
ss.preserve_paths = "Libraries/Image/*.js"
end
+10 -6
View File
@@ -448,11 +448,12 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth) {
// We want to execute the next two loops one per line with flex-wrap
int startLine = 0;
int endLine = 0;
int nextLine = 0;
// int nextOffset = 0;
int alreadyComputedNextLayout = 0;
// We aggregate the total dimensions of the container in those two variables
float linesCrossDim = 0;
float linesMainDim = 0;
while (endLine != node->children_count) {
while (endLine < node->children_count) {
// <Loop A> Layout non flexible children and count children by type
// mainContentDim is accumulation of the dimensions and margin of all the
@@ -496,7 +497,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth) {
}
// This is the main recursive call. We layout non flexible children.
if (nextLine == 0) {
if (alreadyComputedNextLayout == 0) {
layoutNode(child, maxWidth);
}
@@ -512,12 +513,15 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth) {
// The element we are about to add would make us go to the next line
if (isFlexWrap(node) &&
!isUndefined(node->layout.dimensions[dim[mainAxis]]) &&
mainContentDim + nextContentDim > definedMainDim) {
mainContentDim + nextContentDim > definedMainDim &&
// If there's only one element, then it's bigger than the content
// and needs its own line
i != startLine) {
nonFlexibleChildrenCount--;
nextLine = i + 1;
alreadyComputedNextLayout = 1;
break;
}
nextLine = 0;
alreadyComputedNextLayout = 0;
mainContentDim += nextContentDim;
endLine = i + 1;
}
+2 -2
View File
@@ -765,11 +765,11 @@ RCT_EXPORT_METHOD(createView:(nonnull NSNumber *)reactTag
}
RCT_EXPORT_METHOD(updateView:(nonnull NSNumber *)reactTag
viewName:(__unused NSString *)viewName // not reliable, do not use
viewName:(NSString *)viewName // not always reliable, use shadowView.viewName if available
props:(NSDictionary *)props)
{
RCTShadowView *shadowView = _shadowViewRegistry[reactTag];
RCTComponentData *componentData = _componentDataByName[shadowView.viewName];
RCTComponentData *componentData = _componentDataByName[shadowView.viewName ?: viewName];
[componentData setProps:props forShadowView:shadowView];
[self addUIBlock:^(__unused RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
+1 -1
View File
@@ -126,7 +126,7 @@ RCT_REMAP_VIEW_PROPERTY(overflow, clipsToBounds, css_clip_t)
RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL, RCTView)
{
view.layer.shouldRasterize = json ? [RCTConvert BOOL:json] : defaultView.layer.shouldRasterize;
view.layer.rasterizationScale = view.layer.shouldRasterize ? view.window.screen.scale : defaultView.layer.rasterizationScale;
view.layer.rasterizationScale = view.layer.shouldRasterize ? [UIScreen mainScreen].scale : defaultView.layer.rasterizationScale;
}
RCT_CUSTOM_VIEW_PROPERTY(transformMatrix, CATransform3D, RCTView)
{
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "react-native",
"version": "0.8.0",
"version": "0.10.0",
"description": "A framework for building native apps using React",
"license": "BSD-3-Clause",
"repository": {
@@ -67,7 +67,7 @@
"sane": "^1.1.2",
"semver": "^4.3.6",
"source-map": "0.1.31",
"stacktrace-parser": "frantic/stacktrace-parser#493c5e5638",
"stacktrace-parser": "0.1.2",
"uglify-js": "2.4.16",
"underscore": "1.7.0",
"wordwrap": "^1.0.0",