Commit Graph

1265 Commits

Author SHA1 Message Date
Pieter De Baets 4ea359a4f3 Remove getter for RCTShadowView flex
Reviewed By: emilsjolander

Differential Revision: D4081779

fbshipit-source-id: 4e2a1780738423396111c7cfde2fe12010ad0e93
2016-10-26 13:13:47 -07:00
Nikhilesh Sigatapu c67225818d Add a way to access the underlying JavaScriptCore context
Summary:
**Motivation**

I'm working on a project that uses React Native and needs to add direct synchronous bindings to native stuff through the JavaScriptCore C API. This is because it's performance-sensitive and would benefit from the quickest JS->C path. It does this using cross-platform C++ code that works on both iOS and Android. Most of the infrastructure for getting access to the JSC context is already in React Native actually, just had to add a few more things.

(lexs you mentioned to tag you in this pull request)

**Test plan**

Modify the JavaScriptCore context through the `JSContextRef` returned (eg. add an object at global scope) and verify that it exists in JavaScript.
Closes https://github.com/facebook/react-native/pull/10399

Differential Revision: D4080945

Pulled By: lexs

fbshipit-source-id: 6659b7a01e09fd84475adde183c1d3aca2d4cf09
2016-10-26 03:43:44 -07:00
Neil Sarkar c144bbfb7e Allow serializing underlying NSError objects, closes #10506
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

See https://github.com/facebook/react-native/issues/10506. A native `NSError` with `NSUnderlyingErrorKey` set causes a JSON stringify error from the websocket dispatcher if remote debugging is enabled.

**Test plan (required)**

I'm not familiar with the react native testing framework. Happy to add a test for this if someone can point me to where this part of the codebase is exercised :)

I did some spot checks with nil user dictionaries and nil underlying errors here. The case that this solves is testable using https://github.com/superseriouscompany/react-native-error-repro, specifically:

```objective-c
NSError *underlyingError = [NSError errorWithDomain:@"underlyingDomain" code:421 userInfo:nil];
NSError *err = [NSError errorWithDomain:@"domain" code:68 userInfo:@{@"NSUnderlyingError": underlyingError}];

reject(@"foo", @"bar", err);
```
Closes https://github.com/facebook/react-native/pull/10507

Differential Revision: D4080802

Pulled By: lacker

fbshipit-source-id: 93a41d9e9a710e406a6ccac214a5617271b4bede
2016-10-26 01:43:39 -07:00
littlesome 49667db1c8 Fix Alert memory leak
Summary:
1. Using weak container to hold the currently opened alerts.
2. Using weak reference to alertController in action handler block.
3. BTW,  remove the unused vars: _alertCallbacks, _alertButtonKeys.

Test plan (required)

```
- (void)invalidate
{
  for (UIAlertController *alertController in _alertControllers) {
    [alertController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
  }
}
```
Since we use weak container, _alertControllers should only contains the currently opened alerts.

I test this way: Put a breakpoint in invalidate, open the UIExplorer play with the 'Alert' & 'AlertIOS' examples, then fire a reload and see if _alertControllers contains the expected values.
Closes https://github.com/facebook/react-native/pull/10407

Differential Revision: D4078649

Pulled By: lacker

fbshipit-source-id: 8509e7e7142379a81d5b28c9067c085bad8bb5cb
2016-10-25 17:28:49 -07:00
Scott Wolchok d932c96ddc Don't preallocate child lists
Reviewed By: emilsjolander

Differential Revision: D4078012

fbshipit-source-id: 7cdcab03ec4067550a5fee5e1baea14344f3a8f9
2016-10-25 17:13:36 -07:00
Emil Sjolander 942f724166 Suggest the compiler to inline smaller functions
Reviewed By: gkassabli

Differential Revision: D4074580

fbshipit-source-id: 69b63fadf2011cb688af58f09d67c2cb711a0e20
2016-10-25 10:43:41 -07:00
Kazuki Sakamoto 31d3926784 Update CSSNodeFree for C#, Java and Objective-C
Reviewed By: emilsjolander

Differential Revision: D4069655

fbshipit-source-id: 1fd764059784d7968af38b6aaf7fb6f70fdee8ee
2016-10-25 07:43:44 -07:00
Emil Sjolander 3c5a7ae859 Fix bug in canUseCachedMeasurement causing unneeded double measure
Reviewed By: gkassabli

Differential Revision: D4071621

fbshipit-source-id: 19d87d939051ddf8ee2e1c6e60efee22d173bbb9
2016-10-25 07:43:44 -07:00
Emil Sjolander 1ba4e8b9c6 Reduce duplicate function calls
Reviewed By: gkassabli

Differential Revision: D4068140

fbshipit-source-id: 91261afb73e1c5e23c2cfc84df6ecc5c844a4e78
2016-10-24 12:28:39 -07:00
Emil Sjolander 58b5e28e71 Simplify memory model between managed and unmanaged memory
Differential Revision: D4051454

fbshipit-source-id: 8f5d010be520b3d1c981a7f85e5e6d95773ea6c1
2016-10-24 10:43:43 -07:00
Emil Sjolander ea6458b63e Remove flex shorthand getter because it doesnt make a lot of sense
Reviewed By: gkassabli

Differential Revision: D4064674

fbshipit-source-id: 69935b85042020b4e8c61a393c1be8f4d42a6674
2016-10-24 03:44:22 -07:00
Emil Sjolander dc142ad8f9 Dont override flexShrink, flexGrow, and flexBasis with shorthand flex
Reviewed By: gkassabli

Differential Revision: D4064696

fbshipit-source-id: db2d4b8e60209f0a9eed6794a167b85e453be41c
2016-10-24 03:44:18 -07:00
Emil Sjolander 978d45ddef Forward gLogger output to adb on android platforms
Reviewed By: splhack

Differential Revision: D4064619

fbshipit-source-id: de23e72844e25106d0db756064f5699959f45ed2
2016-10-23 10:58:40 -07:00
Kevin Gozali 150c522be9 allow fetching any resource under js folder via packager
Summary: This is a simple hook to allow native side to fetch any file under the js root folder via packager. Historically, only the `main.jsbundle` is fetched via the packager. This then allows fetching local file like a json file that lives under the same root js folder

Reviewed By: yungsters

Differential Revision: D4037730

fbshipit-source-id: a2d6eb5e30d148fee573d413fc4036d0189f4938
2016-10-20 11:43:44 -07:00
Emil Sjolander 9ed8cae47e Fixup format file for hopefully the last time in a while and re-format code
Reviewed By: gkassabli

Differential Revision: D4044545

fbshipit-source-id: 60ebb73cfdd9dbc9b5fae62ddebf37e9b1e6eecf
2016-10-20 06:28:33 -07:00
Kazuki Sakamoto 1607ff2466 Introduce CSSLayoutSetLogger to pass the print result to C# side
Reviewed By: emilsjolander

Differential Revision: D4027044

fbshipit-source-id: 90e2e449260888770f71fa7ea790ca9764d91c44
2016-10-19 11:13:59 -07:00
Emil Sjolander a9d94c2dfb Change flex basis to override main axis size
Reviewed By: gkassabli

Differential Revision: D4029374

fbshipit-source-id: bc3c72879f3937a50bf8a636b547adc7b9a4f5a7
2016-10-19 06:43:57 -07:00
Emil Sjolander 6d3ecbe07a Use typedefs from header
Reviewed By: gkassabli

Differential Revision: D4036421

fbshipit-source-id: 01f15cb840363850970e6a60e661af06fd6ec9e0
2016-10-18 10:29:30 -07:00
Emil Sjolander c805cf8376 Use switch instead of ifelse chain
Reviewed By: gkassabli

Differential Revision: D4036445

fbshipit-source-id: 2159946f53507ff3d7505795e5baa5f820cdb65c
2016-10-18 10:13:39 -07:00
Emil Sjolander 0699a30980 Fix flex-shrink when shrinking to zero size
Reviewed By: gkassabli

Differential Revision: D4036345

fbshipit-source-id: f6848d7a316a694426f761d5e51d972bd379d90e
2016-10-18 09:28:45 -07:00
Emil Sjolander 4d0b3e684a Remove default: usage to ensure compiler can help with missing cases
Reviewed By: gkassabli

Differential Revision: D4036440

fbshipit-source-id: f5ef4c8afff0f353de50681ad304878f90255fef
2016-10-18 07:02:01 -07:00
Emil Sjolander 02fc4c8ffa Move absolute layout calculation out into seperate function
Reviewed By: gkassabli

Differential Revision: D4028329

fbshipit-source-id: 2903f66b028063cec0a6b3037ca7cb4d6552176d
2016-10-17 12:14:17 -07:00
Emil Sjolander 3e332d9cc8 Fix justify content + min dimension when children overflow
Reviewed By: gkassabli

Differential Revision: D4029442

fbshipit-source-id: d28ebd269c452c3359e16ecc5749a415da6e4d75
2016-10-17 08:13:38 -07:00
Emil Sjolander 72cd12ed13 Move flex basis calculation out into seperate function
Reviewed By: gkassabli

Differential Revision: D4028328

fbshipit-source-id: 6d5f3bf1321077675eaa65408a70c9dc92a675be
2016-10-17 05:43:50 -07:00
Emil Sjolander d376155e2c Fix justify content + min dimension usage in root
Reviewed By: gkassabli, lucasr

Differential Revision: D4021443

fbshipit-source-id: 00f58c6078ac3076221e1148aacc34712786deb5
2016-10-17 04:14:34 -07:00
dlowder-salesforce 64a4c6070d Travis CI reliability fixes: preload package manager and increase tim…
Summary:
- Consolidate common code in iOS and tvOS test scripts
- Start the packager before starting tests, to improve reliability
- Increase timeout value in RCTTestRunner.m
Closes https://github.com/facebook/react-native/pull/10378

Differential Revision: D4028364

Pulled By: bestander

fbshipit-source-id: 24c2124a1c62643a02f0668b60a67b971e08d1a3
2016-10-16 15:43:44 -07:00
Jacob Parker abb8ea3aea Implement a postMessage function and an onMessage event for webviews …
Summary:
JS API very similar to web workers and node's child process.

Work has been done by somebody else for the Android implementation over at #7020, so we'd need to have these in sync before anything gets merged.

I've made a prop `messagingEnabled` to be more explicit about creating globals—it might be sufficient to just check for an onMessage handler though.

![screen shot 2016-09-06 at 10 28 23](https://cloud.githubusercontent.com/assets/7275322/18268669/b1a12348-741c-11e6-91a1-ad39d5a8bc03.png)
Closes https://github.com/facebook/react-native/pull/9762

Differential Revision: D4008260

fbshipit-source-id: 84b1afafbc0ab1edc3dfbf1a8fb870218e171a4c
2016-10-16 06:43:46 -07:00
Pieter De Baets 8355ef91ad Add a default context name to RCTJSCExecutor
Reviewed By: mmmulani

Differential Revision: D4015748

fbshipit-source-id: 077287b8438aa13f2a1479d68eacb0662bf295aa
2016-10-14 11:43:43 -07:00
Emil Sjolander 9a33f3f40e Don't assume a node with a measure function is a leaf node
Reviewed By: gkassabli

Differential Revision: D4021096

fbshipit-source-id: 7e039239b1697a0ac42dce9f4b7e252a931bad7e
2016-10-14 04:43:38 -07:00
Alex Kotliarskyi 5f548e15f9 Show packager progress in UI
Reviewed By: javache

Differential Revision: D3941904

fbshipit-source-id: 4ea3b61e9d636eeaddbadbe4ba6c62069955f022
2016-10-13 11:43:41 -07:00
Georgiy Kassabli ef021348af Compatibility with Apple TVOS
Reviewed By: emilsjolander

Differential Revision: D4001901

fbshipit-source-id: f095b4ac0ba91addb28d877b411ec27ecff4aad6
2016-10-13 10:58:47 -07:00
Dan Caspi ce179d4b43 Properly removing bytecode caching from iOS
Reviewed By: alexeylang

Differential Revision: D4003142

fbshipit-source-id: 9decdba54417bce8240a5e8f34c0c32b16c9f494
2016-10-13 06:58:45 -07:00
Scott Wolchok 863459064f Fix build with -Wmissing-prototypes
Reviewed By: mzlee

Differential Revision: D4012611

fbshipit-source-id: f56949d464e0ce602138b60f4abfd45b211be3b2
2016-10-12 21:13:45 -07:00
Dan Caspi 9408461405 Disabling bytecode caching for custom JSC
Reviewed By: michalgr

Differential Revision: D4002399

fbshipit-source-id: 7ac836873ee4b0d5fc0e9529d7e4257fe577e852
2016-10-11 13:43:42 -07:00
Alex Kotliarskyi 84eaeb0adf Add multipart response download task (2nd edition)
Reviewed By: mmmulani

Differential Revision: D3976605

fbshipit-source-id: c15cc859aa1288e831f70256566f743f4a8d9cd2
2016-10-11 12:28:42 -07:00
Alex Kotliarskyi fd554c31c7 Fix devmenu on iPad
Summary:
This fixes the following problem on iPad (happens when trying to show the devmenu ActionSheet):
> Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController () of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'

I see 2 ways of fixing the issue: falling back to Alert (always displayed in the center) or adding a fake view somewhere on the screen to display the ActionSheet.

Reviewed By: mmmulani

Differential Revision: D3989672

fbshipit-source-id: 59fabc50ec1aac3ae6ddd7ecf4d8e8e5b9586dba
2016-10-10 12:13:46 -07:00
Kazuki Sakamoto 9673c885fd Introduce CSSAssertSetFailFunc and CSSAsserFail to throw managed exception
Reviewed By: emilsjolander

Differential Revision: D3982084

fbshipit-source-id: 058a87c10ca89238362be4d8759cc00dd0c9b376
2016-10-07 12:43:58 -07:00
Kazuki Sakamoto dd6d297c55 Introduce CSSNodeGetInstanceCount API
Reviewed By: emilsjolander

Differential Revision: D3981990

fbshipit-source-id: 98005ae1fc21d4c8802f24030fff9ffb00bd292d
2016-10-07 11:13:33 -07:00
Dan Caspi 1c23b70929 Add support for custom JSC across CS
Reviewed By: javache

Differential Revision: D3944510

fbshipit-source-id: 1c67c8a53a65149250a602f2ccd6b234a022897f
2016-10-07 07:58:46 -07:00
Ovidiu Viorel Iepure 645540809f Revert "Add multipart response download task"
Summary:
Checking whether reverting commit 69ec19c61e fixes travis builds.

Travis run: https://travis-ci.org/facebook/react-native/builds/165087391
Closes https://github.com/facebook/react-native/pull/10250

Differential Revision: D3974738

Pulled By: bestander

fbshipit-source-id: a84759b51c2ca11e953b420515dacd597181ec65
2016-10-05 09:58:37 -07:00
Douglas Lowder 8622998335 Apple TV support 2: Xcode projects and CI (scripts/objc-test.sh)
Summary:
* Motivation *

Second PR for Apple TV support.

* Test plan *

Apple TV tests have been added to scripts/objc-test.sh
Closes https://github.com/facebook/react-native/pull/10227

Differential Revision: D3974064

Pulled By: javache

fbshipit-source-id: 36dffb4517efa489e40fa713a30655d1d76ef646
2016-10-05 07:28:44 -07:00
Alex Kotliarskyi 69ec19c61e Add multipart response download task
Reviewed By: mmmulani

Differential Revision: D3940132

fbshipit-source-id: 7a6543223cea2523bedc585f890c9f64df0509ff
2016-10-04 15:13:35 -07:00
Alex Kotliarskyi e2b25c8c9d Add multipart response stream reader
Summary:
Packager can take a long time to load and the progress is usually displayed in another window (Terminal). I'm adding support for showing a UI inside React Native app for packager's progress when loading a bundle.

This is how it will work:

1. React Native sends request to packager with `Accept: multipart/mixed` header.
2. Packager will detect that header to detect that client supports progress events and will reply with `Content-Type: multipart/mixed`.
3. While building the bundle it will emit chunks with small metadata (like `{progress: 0.3}`). In the end it will send the last chunk with the content of the bundle.
4. RN runtime will be receiving the events, for each progress event it will update the UI. The last chunk will be the actual bundle which will end the download process.

This workflow is totally backwards-compatible -- normally RN doesn't set the `Accept` header.

Reviewed By: mmmulani

Differential Revision: D3845684

fbshipit-source-id: 5b3d2c5a4c6f4718d7e5de060d98f17491e82aba
2016-10-03 18:13:36 -07:00
Alexander Pantyuhov c4ac8b329c StatusBar: barStyle support for Android (API 23+)
Summary:
Android (starting from API 23) supports "light status bar", thus it is possible to extend StatusBar and make `barStyle` property work not only for iOS, but also for Android.

This PR introduces one more `barStyle` option `dark-content` in addition to two existing ones (`default` and `light-content`).
Why there are 3 options instead of 2?

Two simple reasons:
1) to make all existing applications fully compatible with these changes;
2) the default status bar on Android is dark with white text and icons, while on iOS it is light with black text and icons on it. Thus the `default` option means something like "I don't really care, just apply the default color for this platform", while two other options (`light-content` and `dark-content`) allow to accurately specify the required result.
Closes https://github.com/facebook/react-native/pull/10185

Differential Revision: D3952346

fbshipit-source-id: 999a67614abff52321fbeb06298ebf1946c3f1d1
2016-09-30 12:58:37 -07:00
Emil Sjolander a75ec1153c Free memory used in tests to enable use of valgrind
Reviewed By: javache

Differential Revision: D3937493

fbshipit-source-id: 23c6970d7769b081575d39de583ba954fc65a397
2016-09-29 04:13:33 -07:00
Marc Horowitz 9981b8928d Make shared new bridge work in wilde/pyml
Reviewed By: javache

Differential Revision: D3926487

fbshipit-source-id: 6c40233c6140ef7ca1f78a5119e34c0979c444ee
2016-09-28 14:13:55 -07:00
Marc Horowitz af5c8a8fd2 Add support for new ios bridge to FBReactBridgeJSExecutor
Reviewed By: javache

Differential Revision: D3897535

fbshipit-source-id: 35bdaf885b03c0c95017a68b69f1f506e6943f2b
2016-09-28 14:13:55 -07:00
Marc Horowitz 441d146b7b Include the name of the bridge class in the dev menu
Reviewed By: javache

Differential Revision: D3933300

fbshipit-source-id: 933191c31731f4ad1a44dfe0854b28ef802e4dd1
2016-09-28 13:58:41 -07:00
Emil Sjolander b32a857d60 Fix bug introduced by D3886866
Reviewed By: lucasr

Differential Revision: D3923635

fbshipit-source-id: bfeb175bb40393be63cafb6a995b22701b87ffec
2016-09-27 10:14:35 -07:00
Dan Caspi dfcfb90baa Fix [JSValue ...] & [JSContext ...] access with custom JSC
Reviewed By: bnham

Differential Revision: D3859956

fbshipit-source-id: 966aba9a267371eb553b8be574fa247b21930d1c
2016-09-27 09:43:30 -07:00