mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b48e2d71a | ||
|
|
37386a8223 | ||
|
|
697e96bc10 | ||
|
|
b76ccca30a | ||
|
|
4facc5fc9c | ||
|
|
720874fb10 | ||
|
|
d31d0141e4 | ||
|
|
3051f9b888 | ||
|
|
e2e610dbe9 | ||
|
|
2b0e8dd303 | ||
|
|
8ed0bafad2 |
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user