Commit Graph

73 Commits

Author SHA1 Message Date
Nick Lockwood aca76c75dd Fix gzip on iOS 9 2015-07-27 01:18:40 -08:00
Nick Lockwood 5db42643cf Added JSONKit support
Summary:
React Native will now use JSONKit if it's already available in the project, otherwise it will fall back to using NSJSONSerialization as before. This provides a small performance boost to JSON parsing in some cases.
2015-07-20 09:52:31 -08:00
Nick Lockwood 82a774e92b Added unit tests for gzip functionality 2015-07-17 04:55:27 -08:00
Nick Lockwood 81ad713f5f Added Gzip support
Summary:
Added Gzip function to RCTUtils. This uses dlopen to load the zlib library at runtime so there's no need to link it into your project.

The main reason for this feature is to support gzipping of HTTP request bodies. Now, if you add 'Content-Encoding:gzip' to your request headers when using XMLHttpRequest, your request body will be automatically gzipped on the native side before sending.

(Note: Gzip decoding of *response* bodies is handled automatically by iOS, and was already available).
2015-07-16 09:38:20 -08:00
Nick Lockwood 90dd7a13f0 Added support for URLs pointing to files inside application home 2015-07-13 10:34:48 -08:00
Alex Akers c928d9495b [React Native] Fix whitespace 2015-07-07 12:12:01 -08:00
Alex Akers 3c541ca540 [React Native] Update native error callback handling
Summary:
This introduces a new `RCTResponseErrorBlock` block type that allows a bridge module writer to call it with an `NSError` instance rather than a dictionary.
2015-07-07 08:54:05 -08:00
Alex Akers c065d98112 [React Native] Change `nil` to `Nil` because it's more correct
Summary: #OCD
2015-07-06 11:15:45 -08:00
Tadeu Zagallo 336e18d20b [ReactNative] Move module info from bridge to RCTModuleData
Summary:
@public

The info about bridge modules (such as id, name, queue, methods...) was spread
across arrays & dictionaries on the bridge, move it into a specific class.

It also removes a lot of information that was statically cached, and now have
the same lifecycle of the bridge.

Also moved RCTModuleMethod, RCTFrameUpdate and RCTBatchedBridge into it's own
files, for organization sake.

NOTE: This diff seems huge, but most of it was just moving code :)

Test Plan:
Tested UIExplorer & UIExplorer tests, Catalyst, MAdMan and Groups. Everything
looks fine.
2015-06-24 17:42:12 -08:00
Nick Lockwood 650fc9de4c Increased warning levels to -Wall -Wextra, and fixed Xcode 7 beta issues
Summary:
@public

I've increased the warning levels in the OSS frameworks, which caught a bunch of minor issues. I also fixed some new errors in Xcode 7 relating to designated initializers and TLS security.

Test Plan:
* Test the sample apps and make sure they still work.
* Run tests.
2015-06-15 07:52:50 -08:00
Nick Lockwood f88bc3eb73 [ReactNative] Refactor RCTDataManager to support pluggable data source modules (RCTURLRequestHandlers)
Summary:
@public

This is a refactor of @philikon's original diff that decouples the dependencies between the Network and Image modules, and replaces RCTDataQueryExecutor with a more useful abstraction.

I've introduced the RCTURLRequestHandler protocol, which is a new type of bridge module used for loading data using an NSURLRequest. RCTURLRequestHandlers can be registered using RCT_EXPORT_MODULE() and are then available at runtime for use by the RCTDataManager, which will automatically select the appropriate handler for a given request based on the handler's self-reported capabilities.

The currently implemented handlers are:

- RCTHTTPRequestHandler - the standard open source HTTP request handler that uses NSURLSession
- RKHTTPRequestHandler - the internal FB HTTP request handler that uses FBNetworking
- RCTImageRequestHandler - a handler for loading local images from the iOS asset-library

Depends on D2108193

Test Plan:
- Internal apps still work
- OSS port still compiles, Movies app and a sample Parse app still work
- uploading image to Parse using the above code snippet works
- tested `FormData` with string and image parameters using http://www.posttestserver.com/
2015-06-09 12:27:06 -08:00
Nick Lockwood f4bf80f3ea [ReactNative] Allow uploading native files (e.g. photos) and FormData via XMLHttpRequest 2015-06-09 12:27:05 -08:00
Tadeu Zagallo 2a08897c6e [ReactNative] Batch JS -> Native calls per queue
Summary:
@public

For every call that comes from JS to Native we'd call dispatch_async so the
method would be cllead on the queue/thread it's expecting. This diff
buckets the calls by target queue, dispatches only once to that queue, and then
call all the methods for it inside the same dispatch.

Test Plan: {F22510090}
2015-06-09 06:52:54 -08:00
Spencer Ahrens 7ffa7bd1f1 [ReactNative] Implement merge functionality for AsyncStorage 2015-06-03 16:53:29 -08:00
Jason Prado 656c5e4e27 Revert "[ReactNative] Add completionBlock to -[RCTBridge enqueueJSCall:args:]"
Test plan: broke catalyst apps

Summary: This reverts commit 9fba6a360dc5f8bf.

fbobjc/Tools/revert

Reverter: jprado

@build-break

commit 9fba6a360dc5f8bf014f3d3c584c545b16da5100
Author:     Tadeu Zagallo <tadeuzagallo@fb.com>
AuthorDate: Thu May 28 08:29:19 2015 -0700
Commit:     Service User <svcscm@fb.com>
CommitDate: Thu May 28 09:53:53 2015 -0700

    [ReactNative] Add completionBlock to -[RCTBridge enqueueJSCall:args:]

    Summary:
    @public

    Allow to pass an optional completion block to the bridge JS calls.

    The block will be called from the JS thread, after the javascript has finished
    running and the returned calls have been processed/dispatched to the native modules.

    Test Plan: Added `testCallbackIsCalledOnTheRightTime` to `RKBatchedBridgeTests`
2015-05-28 09:30:51 -08:00
Tadeu Zagallo 3b24f52a20 [ReactNative] Add completionBlock to -[RCTBridge enqueueJSCall:args:]
Summary:
@public

Allow to pass an optional completion block to the bridge JS calls.

The block will be called from the JS thread, after the javascript has finished
running and the returned calls have been processed/dispatched to the native modules.

Test Plan: Added `testCallbackIsCalledOnTheRightTime` to `RKBatchedBridgeTests`
2015-05-28 08:53:53 -08:00
Nick Lockwood fe4b4c2d83 Optimised blending for translucent images with opaque background color + fixed cropping for images in cover/contain mode.
Summary:
@public

Our background color propagation mechanism is designed to make rendering of translucent content more efficient by pre-blending against an opaque background. Currently this only works for text however, because images are not composited into their background even if the background color is opaque.

This diff precomposites network images with their background color when the background is opaque, allowing them to take advantage of this performance optimization.

I've also added some logic to correctly crop the downloaded image when the resizeMode is "cover" or "contain" - previously it was only correct for "stretch".

Before:{F22437859}
After:{F22437862}

Test Plan: Run the UIExplorer "<ListView> - Paging" example with "color blended layers" enabled and observe that the images appear in green now, instead of red as they did before.
2015-05-22 07:19:06 -08:00
Tadeu Zagallo ea470408e2 [ReactNative] Allow JSON fragments on RCTJSONStringify 2015-05-06 05:44:40 -08:00
Nick Lockwood 88a83084e4 Fixed UIExplorer in Catalyst shell 2015-05-06 00:08:08 -08:00
Tadeu Zagallo 483077d4da [ReactNative] Don't log invalid utf8 strings 2015-04-29 12:24:52 -08:00
Alex Akers 826b56a41b [React Native] Update RCTView border implementation 2015-04-27 04:10:43 -08:00
Nick Lockwood bf4868edda Added non-class-scanning-based approach fror registering js methods 2015-04-08 05:45:20 -08:00
Tadeu Zagallo 20291a02df [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00