Commit Graph

1485 Commits

Author SHA1 Message Date
Pieter De Baets 95cb4ea752 Fix UIView borderWidths not rendering correctly
Reviewed By: majak

Differential Revision: D4111231

fbshipit-source-id: f02c8f2ebda4c3e397d746ed5433afea539c9a88
2016-11-01 11:13:53 -07:00
Ashok Menon 1a75ba3c67 Expose BC version
Reviewed By: javache

Differential Revision: D4110361

fbshipit-source-id: 6cde7d8ca26d30a804f1a99cf9380dcbc0ff5541
2016-11-01 10:28:55 -07:00
Ashok Menon ace32e650c Refactoring JSC Wrapper
Reviewed By: javache

Differential Revision: D4110360

fbshipit-source-id: 5a8bda7cf005dc340ad18a559f8bf0da8d4075d1
2016-11-01 10:28:55 -07:00
Ashok Menon 16290851aa Recognise and run BC bundles
Reviewed By: javache

Differential Revision: D4067425

fbshipit-source-id: fade9adebfa8a59dc49aeadfd01a782f7b686082
2016-11-01 10:28:55 -07:00
James Ide fc11a5fde8 Add support for native animated events on iOS
Summary:
This adds native support for `Animated.event` on iOS.

**Test plan**
Tested in the native animated UIExplorer example that it works properly like on Android.
Closes https://github.com/facebook/react-native/pull/9598

Differential Revision: D4110331

fbshipit-source-id: 15748d23d0f475f2bcd1040ca3dca33e2620f058
2016-11-01 03:58:53 -07:00
Dustin Shahidehpour bb84c37dce Prevent crash when accessing child count, but child list is NULL.
Reviewed By: emilsjolander

Differential Revision: D4104093

fbshipit-source-id: cd7b09818759aa76415b97e241f1a6746a2bc50c
2016-10-31 12:44:09 -07:00
Emil Sjolander df7d61bbbb Some small simplifications for function return values
Reviewed By: gkassabli

Differential Revision: D4101772

fbshipit-source-id: 626df10c0fc76278c330c86be4dc82fdda5f5156
2016-10-31 11:13:39 -07:00
Emil Sjolander d0f8e7f35c void* -> CSSNodeRef in CSSNodeList
Reviewed By: gkassabli

Differential Revision: D4101773

fbshipit-source-id: 8a5c9066da796967bd02ce6b1fc74ff40e15dfe1
2016-10-31 11:13:39 -07:00
Pieter De Baets 7063ff466a Modules export constants if any superclass exports them (2nd try)
Reviewed By: fkgozali

Differential Revision: D4098128

fbshipit-source-id: 73d7f068373b3a9dd5af1881b4cca4e54856cec6
2016-10-31 04:58:50 -07:00
Mehdi Mulani a96b4ab5a0 Warn when height/width is set in style without correct flex
Reviewed By: emilsjolander, yungsters

Differential Revision: D4095399

fbshipit-source-id: 6246e47a39ebbc60835bc1ce5e9fb78c6630a851
2016-10-28 12:13:37 -07:00
Kevin Gozali cea7c6edf2 Reverted commit D4081915
Reviewed By: fkgozali

Differential Revision: D4081915

fbshipit-source-id: 7fa750becc12b40861f30d86411388180fec2d59
2016-10-27 17:28:40 -07:00
Pieter De Baets 285786ad30 Correctly generate viewConfig for shadow properties
Reviewed By: fkgozali

Differential Revision: D4090109

fbshipit-source-id: 6aa24ae95ddcbdabdc5d1da8ab817960bde960a4
2016-10-27 12:43:52 -07:00
Emil Sjolander 8e69a9f695 BREAKING - Make first parameter of measure and print functions CSSNodeRef instead of just context
Reviewed By: javache

Differential Revision: D4081544

fbshipit-source-id: d49679025cea027cf7b8482898de0a01fe0f9d40
2016-10-27 10:58:42 -07:00
Mehdi Mulani 97153d68cf Guard against bad values set in RCTCustomScrollView
Summary:
UIScrollView's internal logic with scroll indicator dies when bad values (e.g. NaN/Infinity) are set on the position/size.
We already guard UIManager with these checks but the RCTScrollView's underlying scrollview (RCTCustomScrollView) can get these set from other places, and we're seeing crashes in this area.

Reviewed By: javache

Differential Revision: D4088601

fbshipit-source-id: b1185cc7c65ba0266787441169264c94338fc55c
2016-10-27 09:28:32 -07:00
Pieter De Baets aa4428cd13 Remove customDirectEventTypes
Summary: This method has been deprecated for a while and there are no internal use-cases left (customBubblingEventTypes is still used by RCTViewManager though).

Reviewed By: fkgozali

Differential Revision: D4083327

fbshipit-source-id: 261e0dce3b41714d13b46d146f87fc415eb9e817
2016-10-27 06:58:52 -07:00
Pieter De Baets 19ab84ffb7 Cleanup and simplify view config generation
Reviewed By: fkgozali

Differential Revision: D4083308

fbshipit-source-id: 42ca797a8faede68bd031e84cf1c33a3e3ade37f
2016-10-27 06:58:52 -07:00
Pieter De Baets af3f656d97 Modules export constants if any superclass exports them
Reviewed By: fkgozali

Differential Revision: D4081915

fbshipit-source-id: 3a99033cd156c1393f7c8bbbb45f43772eb3a8df
2016-10-27 04:29:01 -07:00
Pieter De Baets 8bc30af6c8 Fix some warnings in React.xcodeproj
Reviewed By: majak

Differential Revision: D4081860

fbshipit-source-id: 4b503df3c4e8b6e06b04613919a4a3405bf01171
2016-10-27 04:29:01 -07:00
Pieter De Baets 384ea330c8 Move Platform constants to RCTPlatform
Reviewed By: majak

Differential Revision: D4081849

fbshipit-source-id: bee08af2f68dcc1af424f382f960ff897ba11945
2016-10-27 04:29:00 -07:00
Pieter De Baets 82911a8204 s/CGFloat/float in RCTShadowView
Reviewed By: emilsjolander

Differential Revision: D4081788

fbshipit-source-id: 91da6af0fff1317ff4661572e8e7c1cc5594f810
2016-10-26 13:13:47 -07:00
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
Douglas Lowder d368ebfab2 Apple TV support 1: existing Objective C code should compile for tvOS
Summary:
First commit for Apple TV support: changes to existing Objective-C code so that it will compile correctly for tvOS.
Closes https://github.com/facebook/react-native/pull/9649

Differential Revision: D3916021

Pulled By: javache

fbshipit-source-id: 34acc9daf3efff835ffe38c43ba5d4098a02c830
2016-09-27 06:28:33 -07:00
Pieter De Baets 339531065f Fix some linter warnings
Reviewed By: majak

Differential Revision: D3930059

fbshipit-source-id: dbbf67f287c46535f9c5947cd7ac101c5c91615e
2016-09-27 06:13:31 -07:00
Martin Kralik cfae3e376d fixed crash when setting custom shadow props to null
Reviewed By: emilsjolander

Differential Revision: D3923634

fbshipit-source-id: 005e316e70fa280960c796375b2e94f9967a089d
2016-09-27 03:43:34 -07:00
Marc Horowitz 97e3c091f8 Sync support for new ios bridge
Reviewed By: javache

Differential Revision: D3897528

fbshipit-source-id: f30d2b1c490c1a9f7fc1f136858e6c7a146b9ca2
2016-09-26 16:14:11 -07:00
Marc Horowitz 51df83d7d5 Move batchedbridge start out of init
Reviewed By: javache

Differential Revision: D3913304

fbshipit-source-id: 7d9b5b352d95dd770757cc99dddcce510cdd4909
2016-09-26 16:14:11 -07:00
Antti Moilanen 72e203bf95 Fix ScrollView's snap index when scrolling forward and user taps the screen again while still scrolling
Summary:
Currently when snapping is used with ScrollView it calculates wrong snap index if user taps the screen second time while ScrollView is still scrolling. This happens because the code only adds 1 to the snap index when translationAlongAxis is smaller than zero. When user taps screen second time the translationAlongAxis is 0 and snap index ends up being one less than it should. This causes the ScrollView to scroll one step backwards.

Bug can be reproduced with the new examples I added to UIExplorer's ScrollView in [scrollview-snap-bug-example branch](https://github.com/anttimo/react-native/tree/scrollview-snap-bug-example).

Fix can be verified by running the same examples with the ScrollView fix in [scrollview-snap-bug-example-with-fix branch](https://github.com/anttimo/react-native/tree/scrollview-snap-bug-example-with-fix).

![scrollview-bug](https://cloud.githubusercontent.com/assets/150881/14427555/10d59d1e-fffe-11
Closes https://github.com/facebook/react-native/pull/6906

Differential Revision: D3927123

Pulled By: majak

fbshipit-source-id: 38828cc60a02a754bdc3ec72fb98d8777917f15e
2016-09-26 16:14:10 -07:00
Mehdi Mulani 0ce2bbdd64 Fix Modal to handle in-call status bar
Summary: Changing the Modal's presentation style ensures that UIKit correctly adjusts its bounds when entering/exiting the in-call status bar.

Reviewed By: fkgozali

Differential Revision: D3916167

fbshipit-source-id: a0bea60751744ac082ba6ec38177fb093a8f2be5
2016-09-26 15:58:29 -07:00
Emil Sjolander 0a9b6bedb3 BREAKING - Fix unconstraint sizing in main axis
Summary:
This fixes measuring of items in the main axis of a container. Previously items were in a lot of cases measured with UNSPECIFIED instead of AT_MOST. This was to support scrolling containers. The correct way to handle scrolling containers is to instead provide them with their own overflow value to activate this behavior. This is also similar to how the web works.

This is a breaking change. Most of your layouts will continue to function as before however some of them might not. Typically this is due to having a `flex: 1` style where it is currently a no-op due to being measured with an undefined size but after this change it may collapse your component to take zero size due to the implicit `flexBasis: 0` now being correctly treated. Removing the bad `flex: 1` style or changing it to `flexGrow: 1` should solve most if not all layout issues your see after this diff.

Reviewed By: majak

Differential Revision: D3876927

fbshipit-source-id: 81ea1c9d6574dd4564a3333f1b3617cf84b4022f
2016-09-26 06:13:56 -07:00
Pieter De Baets 31b158c9fe Export native modules without RCT or RK prefix
Reviewed By: mmmulani

Differential Revision: D3901600

fbshipit-source-id: 7d4a027f0f2478e2a9ac9916326b91279bec3cb3
2016-09-23 11:14:11 -07:00
Pieter De Baets ff79224d37 Simplify ModuleConfig array format
Reviewed By: lexs, mhorowitz

Differential Revision: D3901563

fbshipit-source-id: 70aea19db1b01170be57b74ccfa1a306dfa1f362
2016-09-23 11:14:10 -07:00
mattpodwysocki 2da08884b2 Introducing .NET version of css-layout using P/Invoke
Summary:
This version of the css-layout project includes support for .NET projects.  Up in the air is how many configurations of .NET projects we allow for, such as Portable Class Libraries, Universal Windows Platform, .NET Core, etc.  Still needs integration with Buck.
Closes https://github.com/facebook/css-layout/pull/220

Reviewed By: lucasr

Differential Revision: D3909367

Pulled By: emilsjolander

fbshipit-source-id: aaaa9c4ff2d3452649f256c3268cf873cf33a0b9
2016-09-22 16:28:38 -07:00
Mehdi Mulani 858e95b2aa Warn when displaying a modal with unsupported interface orientations
Summary: In dev mode, this removes all iOS crashes from specifying the incorrect interface orientations. It also includes okay-ish instructions for how to fix the problem.

Reviewed By: fkgozali

Differential Revision: D3904998

fbshipit-source-id: 699599fa77fd87e6615436250e38944e577e75a0
2016-09-22 12:58:33 -07:00
Yiding Jia bb933c8ad4 Make custom jsc initialization a link-time replacable function.
Reviewed By: bnham

Differential Revision: D3880106

fbshipit-source-id: 2a3c3c8ff120ecc66b31325700c187cbd957f361
2016-09-20 16:58:42 -07:00
Emil Sjolander 375a5805d1 Cleanup some multiline code
Reviewed By: lucasr

Differential Revision: D3886866

fbshipit-source-id: e19c1be4af58605933f90b5bf381008338be2236
2016-09-20 10:30:15 -07:00
Emil Sjolander 10601c921e Move justifyContent check into switch statement
Reviewed By: lucasr

Differential Revision: D3886861

fbshipit-source-id: 17ba2962016af34b5add3ce6d8355c9c305a35c0
2016-09-20 10:30:13 -07:00
Emil Sjolander be140107b9 Remove empty line in function call
Reviewed By: lucasr

Differential Revision: D3886856

fbshipit-source-id: cf76ad9b6c85a62b9f2683618a6abe986d98acc2
2016-09-20 10:30:11 -07:00
Emil Sjolander 7f2bbf4263 Remove use of snake_case
Reviewed By: lucasr

Differential Revision: D3886849

fbshipit-source-id: eaf3f219fe1ccb717ba363dba0d2f475ffb204e3
2016-09-20 10:30:08 -07:00
Pieter De Baets 21fda19ca9 Consistently handle startup errors
Summary:
If we use RCTLogError, we show a redbox with a native stacktrace before we can actually show the JS stacktrace (which is only done through dispatch_async). Instead use RCTLogWarn so its logged to console but not reported as a redbox.

Also fix call to RCTNSErrorFromJSErrorRef off the main thread RCTJSCExecutor.

Reviewed By: majak, mmmulani

Differential Revision: D3886813

fbshipit-source-id: 119d04858cb0c85c79e12ff8a79806711f8e0b27
2016-09-20 06:28:36 -07:00
Pieter De Baets bd4cd6ea5d Fix non-exported module warnings for superclasses
Reviewed By: mhorowitz

Differential Revision: D3841655

fbshipit-source-id: b855f9bef6c53a0964c59e1977e5eb23452edce3
2016-09-19 04:44:12 -07:00
littlesome 610c4826a5 Set viewTag for RCTTouchEvent to avoid EventID conflict
Summary:
Using target view's reactTag as viewTag for RCTTouchEvent.

Fix issue https://github.com/facebook/react-native/issues/9503
Closes https://github.com/facebook/react-native/pull/9952

Differential Revision: D3880152

Pulled By: majak

fbshipit-source-id: 1025aae6a6a1d5074496a9e4a6cf7dfebc713dc7
2016-09-16 16:13:47 -07:00
Pieter De Baets 9ff4d31dc4 Remove unnecessary JSContextGetGlobalContext call
Reviewed By: majak, alexeylang

Differential Revision: D3871178

fbshipit-source-id: 4a6dff7cce233e9bc2e2a80858774a2e6af6b67d
2016-09-16 06:28:48 -07:00
Pieter De Baets 228f104dad Improve RCTNSErrorFromJSError
Reviewed By: adamjernst

Differential Revision: D3871146

fbshipit-source-id: 44de849852d8c00ab4589938ef317e4c8d98d7e6
2016-09-16 06:28:48 -07:00
Pieter De Baets 95cce07baf Support invoking method that returns result and flushes call queue
Reviewed By: mhorowitz

Differential Revision: D3870879

fbshipit-source-id: bc8f70d9866dfc25468c9072c209cc6842b98575
2016-09-16 06:28:48 -07:00
Emil Sjolander a6e1e33a50 Reverted commit D3855801
Summary: Introduce `overflow:scroll` so that scrolling can be implemented without the current overflow:visible hackiness. Currently we use AT_MOST to measure in the cross axis but not in the main axis. This was done to enable scrolling containers where children are not constraint in the main axis by their parent. This caused problems for non-scrolling containers though as it meant that their children cannot be measured correctly in the main axis. Introducing `overflow:scroll` fixes this.

Reviewed By: astreet

Differential Revision: D3855801

fbshipit-source-id: 3c365f9e6ef612fd9d9caaaa8c650e9702176e77
2016-09-14 11:28:34 -07:00
Emil Sjolander 1f9c9ecb4b BREAKING - Fix unconstraint sizing in main axis
Summary: Introduce `overflow:scroll` so that scrolling can be implemented without the current overflow:visible hackiness. Currently we use AT_MOST to measure in the cross axis but not in the main axis. This was done to enable scrolling containers where children are not constraint in the main axis by their parent. This caused problems for non-scrolling containers though as it meant that their children cannot be measured correctly in the main axis. Introducing `overflow:scroll` fixes this.

Reviewed By: astreet

Differential Revision: D3855801

fbshipit-source-id: 6077b0bcb68fe5ddd4aa22926acab40ff4d83949
2016-09-14 09:14:02 -07:00
Emil Sjolander 8eee79b5d1 Remove legacy test suite
Reviewed By: lucasr

Differential Revision: D3863095

fbshipit-source-id: a2c4f87cd2263b4cc1fcdec4f2a0964f0696472f
2016-09-14 08:58:35 -07:00
Pieter De Baets d6926c5468 Allow precreated JSC executor init without applicationScript
Reviewed By: mmmulani

Differential Revision: D3836643

fbshipit-source-id: 18937ef5b39ebe3b3fd743490f86e40ffa6ee015
2016-09-13 06:43:40 -07:00
Hugo Dozois 38354c4cbf Add: expose hot & live reload, remote debug, profiling
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

- Being able to call these from JS is really useful in envs where action sheets are not available (eg: App Extensions). I made the functions act as explicit toggles, this way it's easy to set the wanted behavior.

**Test plan (required)**
- I tested the functions manually.

![Remote debug from an iMessage Application](https://cloud.githubusercontent.com/assets/4422516/17445198/976ebfe0-5af8-11e6-885f-1b40f9518aab.png)
Closes https://github.com/facebook/react-native/pull/9242

Differential Revision: D3749568

fbshipit-source-id: 2cea1d609dc792aec73d4bcf1eae07575725b4b7
2016-09-12 02:58:56 -07:00
Alexey Lang d6fe78fc25 Refactor measuring native requires
Reviewed By: javache

Differential Revision: D3829204

fbshipit-source-id: 9a3a29bfc12e3af60eeac1e03b93a626d0d256c8
2016-09-09 15:28:44 -07:00
Jacob Parker 9e6e573e19 NavigatorIOS System Icon Support
Summary:
Continuation on #3959 (started by cancan101). Rebased to latest master, adds support for left system icon, fixes issues mentioned in previous PR.

<img width="432" alt="screen shot 2016-09-05 at 13 54 41" src="https://cloud.githubusercontent.com/assets/7275322/18248478/5b7aa25c-7370-11e6-8c51-01a2b7fd1030.png">
Closes https://github.com/facebook/react-native/pull/9742

Differential Revision: D3836850

Pulled By: javache

fbshipit-source-id: ef9f6e42211ed18bf5f3dc1eb7a8b1318d939674
2016-09-08 17:58:50 -07:00
Alexey Lang 532751f8a8 Start measuring RCTPLBridgeStartup and RCTPLTTI early
Reviewed By: javache

Differential Revision: D3828404

fbshipit-source-id: 7cbfa2eeb60e249be8aad09da5314be998213f0e
2016-09-08 07:28:41 -07:00
Pieter De Baets 99e0267c25 Cleanup and document native module configuration
Summary: Get rid of the old behaviour of JSON encoding in `nativeRequireModuleConfig` and consistently use the same names for function types "async/promise/sync"

Reviewed By: lexs

Differential Revision: D3819348

fbshipit-source-id: fc798a5abcaf6a3ef9d95bd8654afa7825c83967
2016-09-08 04:13:51 -07:00
Ben Roth afde9da93d Scope RCTReloadNotification to one bridge
Summary:
At the moment, posting RCTReloadNotification in any circumstance causes all RCTBridge instances to reload. This change scopes the notification to the bridge for which it was intended.
Closes https://github.com/facebook/react-native/pull/8762

Differential Revision: D3831914

fbshipit-source-id: ff29574f574ecd1a403057ddd0458dea38f0136e
2016-09-07 17:28:47 -07:00
Alexey Lang a31a2910a1 Make bridge logger thread-safe and fix noisy in bridge core time
Reviewed By: javache

Differential Revision: D3828301

fbshipit-source-id: 29efdef2fb2c601984c27c4d0a69e1542bbff385
2016-09-07 13:10:12 -07:00
Mehdi Mulani de3457f31d Allow <Modal /> to be presented in different orientations
Reviewed By: javache

Differential Revision: D3760002

fbshipit-source-id: 01f5c246fb0fc041ec2d63b4ef80de858fb6fdf2
2016-09-07 13:10:11 -07:00
Kevin Gozali 96de161304 enable RTL layout by default for all apps
Summary:
We're now enabling RTL layout by default assuming the app has the proper localized assets. Previously, this was disabled by default to minimize surprise. Apps that don't want this RTL support can still manually disable them by using `RCTI18nUtil.allowRTL(false)` (iOS) or `I18nUtil.allowRTL(false)` (android) in the apps start-up logic, as outlined in the blog post: http://facebook.github.io/react-native/blog/2016/08/19/right-to-left-support-for-react-native-apps.html

iOS Util function: f0fb228ec7/React/Modules/RCTI18nUtil.m (L53)
Android Util function: 380830e4aa/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java (L63)

Differential Revision: D3825054

fbshipit-source-id: 88b355fef9e3847939a414f80d2285979e27af08
2016-09-06 17:58:47 -07:00
rh389 6e216d2034 Include CSSLayout.h consistently with other project includes
Summary:
Include CSSLayout headers in the same way as other project headers, ie `#import <CSSLayout/CSSLayout.h>` becomes `#import "CSSLayout.h"`. CSSLayout is not a framework or system dependency, so shouldn't (AFAIK) be included with angle brackets. Doing so breaks framework builds, such as when RN is used as a pod in a swift project.

In combination with https://github.com/facebook/css-layout/pull/217 this fixes https://github.com/facebook/react-native/issues/9014 (specifically swift cocoapods projects). There is then no need for a separate CSSLayout pod subspec.

Tests run on the RN project in isolation (with changes inside `CSSLayout` itself also applied) and against a dummy swift project with RN included as a pod.

NB: This effectively reverts https://github.com/facebook/react-native/pull/9015 and may break non-swift cocoapods projects unless https://github.com/facebook/css-layout/pull/217 is merged and synced first.

Update: As discussed with alloy and emilsjolander, wrap these imports in a preprocess
Closes https://github.com/facebook/react-native/pull/9544

Differential Revision: D3821791

Pulled By: javache

fbshipit-source-id: d27ac8be9ce560d03479b43d3db740cd196c24da
2016-09-06 09:13:39 -07:00
BaihaoTian d31756bf01 improve (RCTJSErrorFromCodeMessageAndNSError)
Summary:
First of all,please forgive my poor english. LOL

When I use Promises  as callBack,

 I followed the guide to make a (RCTPromiseRejectBlock),in this RCTPromiseRejectBlock,

from the guide I should add a (NSString)code a (NSString)message and an (NSError) to a  RCTPromiseRejectBlock.

As what did guide said I just make a NSError with

```
 NSError *error=[NSError errorWithDomain:@"native stroage error" code:402 userInfo:@{@"data":key}];

```

As you can see, I want to transfer some data in this callback.But I just found the (userInfo) of NSError didn't composed to a  RCTPromiseRejectBlock.

So I check out the source code of RCTUtil ,I found this

```

// TODO: Can we just replace RCTMakeError with this function instead?
NSDictionary<NSString *, id> *RCTJSErrorFromCodeMessageAndNSError(NSString *code,
                                                                  NSString *message,
                                                                  NSError *__nullable error)
{
  NSString *errorMessage;
Closes https://github.com/facebook/react-native/pull/9519

Differential Revision: D3821334

Pulled By: javache

fbshipit-source-id: 0fa40dd93932af70123b8f8a20a5c7dc5afdd6ac
2016-09-06 06:13:49 -07:00
makee 0d9490fa67 remove incorrect `__unused` modifier
Summary:
the `update` argument was used below
Closes https://github.com/facebook/react-native/pull/9753

Differential Revision: D3820510

fbshipit-source-id: 8cad707a9cd4887c7ee07fe960b1f918761e64c5
2016-09-06 02:43:40 -07:00
Pieter De Baets 1a7c231ef3 Remove last arg from RCTProfileEnd, make macro's function-like
Reviewed By: tadeuzagallo

Differential Revision: D3801302

fbshipit-source-id: 297a58db876366e21e232094c1361aa0dcd9016d
2016-09-05 11:13:33 -07:00
Pieter De Baets dda3c5f48d Support sync method calls in the objc bridge
Reviewed By: mhorowitz

Differential Revision: D3801188

fbshipit-source-id: b990680049a46840472a25e66882f8a29890ae90
2016-09-05 07:44:00 -07:00
Pieter De Baets 753b37e479 Remove unused -[RCTBridgeMethod profileArgs]
Reviewed By: mhorowitz

Differential Revision: D3801106

fbshipit-source-id: 214a18b548f8142c0f3d6b2f7db7a24894d1f01d
2016-09-05 07:44:00 -07:00
Gant dcdf16a0fb RefreshControl Position Bug
Summary:
Refresh bug #7976
This bug has persisted for 3 versions of React Native.   Currently everyone is having to do a silly fix, documented in the bug.   I spent an hour trying to find the source of the bug.   Failing to find the issue quickly, I've just decided to make this simple bugfix.

According to janicduplessis #7976 we will likely be re-writing this control in iOS 10.
Closes https://github.com/facebook/react-native/pull/9249

Differential Revision: D3817227

fbshipit-source-id: f98282aadeca3e85239836f589eda901d454f2ce
2016-09-04 01:43:38 -07:00
Indragie Karunaratne 31c8e20c8e Remove -[RCTJSExecutor errorForJSError:]
Reviewed By: javache

Differential Revision: D3814718

fbshipit-source-id: 9b8c91cb81d77fda4959df26806d54c9b7be42a0
2016-09-02 17:43:37 -07:00
Marc Horowitz 3940f06211 Add more profiling, fix existing profiling, perf fix
Reviewed By: javache

Differential Revision: D3807467

fbshipit-source-id: 3ff6feebd6d7966952152bac708389506de721e6
2016-09-02 12:43:48 -07:00
Marc Horowitz a8cf12a932 Fix some unsafe thread behavior
Reviewed By: javache

Differential Revision: D3789293

fbshipit-source-id: 80118c7f8faf487fe35d4d83a91f023219f6bf80
2016-09-01 19:58:58 -07:00
Pieter De Baets 6abacc893b Use NSURLComponents.queryItems instead of parsing query strings
Reviewed By: mmmulani

Differential Revision: D3742617

fbshipit-source-id: 2d6580919fa546d89266943a917165fbc44aa8e8
2016-09-01 19:43:48 -07:00
Pieter De Baets 07553d0f1c Update React Native minimum OS version to iOS8
Reviewed By: majak

Differential Revision: D3723143

fbshipit-source-id: 482f9820370b752d937e6df7f74c33d53a0a2e7d
2016-09-01 19:43:47 -07:00
Pieter De Baets 46b54fd7a8 Support bundle argument for image loading
Reviewed By: mmmulani

Differential Revision: D3768798

fbshipit-source-id: 5b35f06957cebfe74aca90fe6a456f7f739509a9
2016-08-31 17:43:49 -07:00
Pieter De Baets 17205aac57 Track BatchedBridge in FBReactModule to decide when to re-apply feature flags
Reviewed By: majak

Differential Revision: D3735447

fbshipit-source-id: a38c34feddb3f11cb5b99783054849fd291fc14f
2016-08-31 16:14:03 -07:00
Ben Nham 7db93a376b configure glog sink for custom jsc
Reviewed By: alexeylang

Differential Revision: D3789493

fbshipit-source-id: b3ecbd1caddfeef5e948e43444be95207c573f67
2016-08-31 11:29:05 -07:00
Adam Comella 6897f40af7 Fix sizing of absolutely positioned nodes inside overflow:hidden parent
Summary:
When an absolutely positioned node appeared inside an overflow:hidden
parent, we were limiting its height. This is inconsistent with how
layout behaves on the web.
Closes https://github.com/facebook/css-layout/pull/218

Reviewed By: lucasr

Differential Revision: D3797285

Pulled By: emilsjolander

fbshipit-source-id: 98f98e77aa26edce86b9882c1cac284799b69a27
2016-08-31 08:13:41 -07:00
Emil Sjolander e5aa29c195 Fix and add tests for cssedge priority
Reviewed By: lucasr

Differential Revision: D3791106

fbshipit-source-id: 3e0c943f94218848a1fbf36e5ae48dbc720ea923
2016-08-31 08:13:41 -07:00
Scott Wolchok 8a8ac771b1 clean up NSClassFromString in Libraries/
Reviewed By: adamjernst

Differential Revision: D3794507

fbshipit-source-id: 5f6f8d3ccfcb8a7339532ca1c092750b85d622d2
2016-08-30 17:58:47 -07:00
Emil Sjolander 899adf5343 Expose flexGrow, flexShrink, and flexBasis properties
Reviewed By: javache, astreet

Differential Revision: D3785140

fbshipit-source-id: a735602c53da72e3bce69ba30936c4ed25d76b88
2016-08-30 03:13:39 -07:00
Adam Comella 4178d21e96 Expose overflow prop to layout engine
Summary:
The overflow prop needs to be set on the shadow view so that it can make its way into the layout engine. In some situations, the value of the overflow prop affects the calculations of the layout engine.

**Test plan (required)**

Verified in a test app that the `overflow` prop makes its way into the layout engine. Also, my team's app is currently using this change.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/9659

Differential Revision: D3790552

fbshipit-source-id: 61513ece63ae214f48c6cb6f40fb29757a0ac706
2016-08-30 00:59:00 -07:00
Mehdi Mulani 029f5687be Display React Native Modals with transparent background
Reviewed By: javache

Differential Revision: D3779522

fbshipit-source-id: c7c036b20755ac49714c5085c38ba122abcbae04
2016-08-29 13:58:48 -07:00
Kasper Hirvikoski 101190f7f8 Verify exported modules only once to support dynamic context in DEBUG-mode
Summary:
**Motivation:** We have a project that dynamically changes classes in runtime. This component is initialised within the React Native context. Therefor `RCTBatchedBridge` copies the classes before changes are made to them. While React Native is running, changes are made to the classes dynamically. When the project reloads the `RCTBatchedBridge`, it now has an invalid list of classes containing trash pointers. This causes the project to crash on https://github.com/facebook/react-native/blob/master/React/Base/RCTBatchedBridge.m#L288 with EXC_BAD_ACCESS in the DEBUG-mode.

**Solution:** Copy the class list on each reload to get the current state. Since this is only a DEBUG-feature the overhead of this should not be a major issue.
Closes https://github.com/facebook/react-native/pull/9541

Differential Revision: D3775012

Pulled By: javache

fbshipit-source-id: d55fa0742ca100d8018c73080230cf718aa5a7e9
2016-08-29 12:13:34 -07:00
Kevin Gozali 35e7a266db allow finding the rootTag of any reactTag inside UIManager
Summary: added API to in UIManager to find the rootTag/View of any reactTag based on its layout (shadow views) hierarchy (not to be used by JS)

Reviewed By: javache

Differential Revision: D3750410

fbshipit-source-id: 68611e39930d53ece478f25245ddc7f7838daaa6
2016-08-28 22:58:28 -07:00
Pieter De Baets ea3bb35db0 Fix crash in RCTJSStackFrame
Reviewed By: mmmulani

Differential Revision: D3776330

fbshipit-source-id: 0e9126825e86dd7c124bc22341ab3b39b1bd3e0b
2016-08-26 09:58:47 -07:00
Emil Sjolander 2a859eb7e3 Revert changes causing layout failures
Differential Revision: D3776987

fbshipit-source-id: 06bd154a36f895782f45511cd8cf49cc6d7cbe7d
2016-08-26 03:13:41 -07:00
Emil Sjolander 06ee832928 Generate tests for flex properties
Differential Revision: D3771513

fbshipit-source-id: 1b5edc7a28bb26217e8a6d10d1829d9031c3ae2e
2016-08-25 15:44:23 -07:00
rh389 d943e28bc6 Use quote style for local includes
Summary:
This PR changes `#include <CSSLayout/*.h>` to  `#include "*.h"` within the `CSSLayout` directory.

Rationale: Quote includes are preferred for user (aka local/project) includes, whereas angle includes are preferred for standard libraries and external frameworks. In particular, XCode 7.1+ will not search user paths (even the current directory) when angle brackets are used unless "Always search user paths" is enabled - it is off by default and [Apple recommend](https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW110) that it is only enabled for backwards compatibility.

I think this is the best fix for https://github.com/facebook/react-native/issues/9014, and seems like good practice in any case.
Closes https://github.com/facebook/css-layout/pull/217

Reviewed By: majak

Differential Revision: D3764132

Pulled By: emilsjolander

fbshipit-source-id: c8a6e8d19db71455922e3ba8f6c72bd66018fa84
2016-08-24 10:43:42 -07:00
Bret Johnson 8fd2d7d17c Added way to not launch packager during CI build, as it hangs CI builds
Summary:
Change & motivation:
Added an environment variable, RCT_NO_LAUNCH_PACKAGER, that when set
Xcode not the launch the packager when building. This switch is needed
for CI builds, where launching the packager, which stays running, causes
the build to hang; port conflicts can be an issue as well. Really the
packager is only appropriate for interactive developer builds.  This
is a problem for Visual Studio Team Services where we just added
React Native CI build support with a React Native build extension and
surely a problem for all CI systems.  This fix is simple, and now if
the build machine sets RCT_NO_LAUNCH_PACKAGER globally or passes
it as an arg to xcodebuild, the packager won't launch and all is well.

Testing:
I tested by building both with & without the environment variable defined, ensuring
things work probably in both cases.  I also added support to our VSTS build ask to use
this and verified it works as expected too, when setting the variable..
Closes https://github.com/facebook/react-native/pull/6180

Differential Revision: D3764648

Pulled By: sahrens

fbshipit-source-id: b41cc06152aec271bbfdb2bd52d4b83a5f9c09a7
2016-08-24 10:13:36 -07:00
Matt Johnston 96d27ca9f1 fix typo
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see
Closes https://github.com/facebook/react-native/pull/9560

Differential Revision: D3763027

Pulled By: hramos

fbshipit-source-id: 3d60833fde92a30658f3d9f108708b41ce859a13
2016-08-24 08:29:00 -07:00
Mehdi Mulani d8b2bab794 Allow <Modal /> to be configured with a custom presentation/dismissal block
Reviewed By: javache, majak

Differential Revision: D3751545

fbshipit-source-id: 4cf420769f7939289c0b0b70ae784328df8e2bbf
2016-08-23 16:58:41 -07:00
Pieter De Baets a718f14af7 Remove deprecated RCTImageSource method
Reviewed By: majak

Differential Revision: D3755010

fbshipit-source-id: a1c4cfa066c51ec0111378a1b4e08f58b92e6cbd
2016-08-23 11:28:42 -07:00
Martin Kralik a6868161cb dont use ios border rendering if we use default black color
Summary:
iOS and css have a different way to draw borders. Decision which rendering to use considers alpha value of given color as well.
If alpha=0 -> border is invisible -> we use ios render.
That doesn't work as expected in a case where only `borderWidth` property is set.
A default black color is used when no `borderColor` is set, but alpha checking logic will test `null`. Which resolves as alpha=0.

Reviewed By: javache

Differential Revision: D3750523

fbshipit-source-id: 453d52a16287c6286e8887a9ab3795d3ded1dec6
2016-08-23 03:58:34 -07:00
Emil Sjolander 25f2a26ce9 Use const where possible
Reviewed By: IanChilds

Differential Revision: D3741999

fbshipit-source-id: 1ba7da5784c3047f2d4c03746890192f724aa65e
2016-08-22 06:59:03 -07:00
Emil Sjolander 50b0943c16 Remove unnecessary indirection
Reviewed By: IanChilds

Differential Revision: D3741988

fbshipit-source-id: fdb31dc45a478508b41c522f0e1b3ef842971b50
2016-08-22 06:59:03 -07:00
Ben Nham 4ad01be3a0 Remove iOS 7 version check in RCTJSCWrapperCreate
Reviewed By: michalgr

Differential Revision: D3729175

fbshipit-source-id: 43ee2ba19b3d8fed20bd268d1e2d0fab83e2fe9f
2016-08-18 03:28:34 -07:00
Emil Sjolander 0da5fd21c7 Compute edge values similar to how Spacing.java does it
Reviewed By: lexs

Differential Revision: D3728742

fbshipit-source-id: aa19400880afa49664f7bde72b1df45314e699bb
2016-08-17 10:44:01 -07:00
Emil Sjolander fa9cf22074 Remove CSSPosition in favor of CSSEdge
Reviewed By: IanChilds

Differential Revision: D3728740

fbshipit-source-id: 19dc817a637b80d1f6df8d76982feb2e1fb2705a
2016-08-17 10:44:01 -07:00
Pieter De Baets fba96ab990 Use image references consistently in UIExplorer
Reviewed By: davidaurelio

Differential Revision: D3728780

fbshipit-source-id: 4da6a0417eea1ccd0ec0d25574959661f05decb1
2016-08-17 04:43:52 -07:00
Mehdi Mulani e9d6f29b64 Don't allow unsetting a region in RCTMapView
Reviewed By: javache

Differential Revision: D3723065

fbshipit-source-id: c922d03fa6c2a696b2ec00965b17b7215060aee5
2016-08-16 10:59:03 -07:00
Ben Nham 53c5c4f8c3 Rename custom JavaScriptCore.framework to JSC.framework
Reviewed By: michalgr

Differential Revision: D3709748

fbshipit-source-id: bc2a7124127944c5d24e584747074065eefa1207
2016-08-15 15:13:40 -07:00
Emil Sjolander f7a22bc33c Use single function for margin, position, padding, and border
Reviewed By: lucasr

Differential Revision: D3715201

fbshipit-source-id: ea81ed426f0f7853bb542355c01fc16ae4360238
2016-08-15 09:28:41 -07:00
Emil Sjolander 0ea4198009 Add support for flex-grow, flex-shrink, and flex-basis
Reviewed By: lucasr

Differential Revision: D3714520

fbshipit-source-id: 80d3a9a1e2b6f74b863bbe22357f2c9865fa290e
2016-08-15 09:28:41 -07:00
Emil Sjolander 451cc2dee7 Use library style imports
Reviewed By: IanChilds

Differential Revision: D3714512

fbshipit-source-id: 4c42d52b3ab92903e9e9451df0ca1564e2d33f0f
2016-08-15 09:28:41 -07:00
Emil Sjolander 043a6cd2c1 Update clang-format rules
Reviewed By: IanChilds

Differential Revision: D3714510

fbshipit-source-id: f6d0436346416aab023aacbedd70ea189e583e8d
2016-08-15 09:28:41 -07:00
Ben Nham d22003a0de dynamically load JavaScriptCore with RTLD_LOCAL option
Reviewed By: tadeuzagallo

Differential Revision: D3703415

fbshipit-source-id: c67865b7fe75c21a3b620dc3a794b5a0005cf71e
2016-08-13 03:31:08 -07:00
Ben Nham ce2f119222 fix loading of dynamic linked JavaScriptCore on iOS simulator
Reviewed By: michalgr

Differential Revision: D3703392

fbshipit-source-id: 670185de1eefd1c542de2df96e40aede3b2c12cc
2016-08-11 18:43:27 -07:00
Emil Sjolander 656f9f4b9d Use modern initializer syntax instead of comments
Reviewed By: adamjernst

Differential Revision: D3698569

fbshipit-source-id: c92b18540140662979cf001aeedaa76504c6a3ac
2016-08-11 02:58:31 -07:00
Kellie Medlin 2bd1f627ea Test building with clang 3.9
Reviewed By: compnerd

Differential Revision: D3667327

fbshipit-source-id: f3ad04360068ee26aeec6f1c2dbe0ed96ba32ad0
2016-08-10 13:13:34 -07:00
Pieter De Baets 6775d1f136 Set property ivar for shadow view frame
Reviewed By: emilsjolander

Differential Revision: D3683649

fbshipit-source-id: d818cb0eea064baca99be2bc6edf1b61b90bb64b
2016-08-10 10:58:49 -07:00
Pieter De Baets 4afaf5e538 Fix RCTRootView invalidation using the wrong bridge
Reviewed By: majak

Differential Revision: D3696533

fbshipit-source-id: e7ef4373e975e585f4c34df71966c8b5b30d3e9a
2016-08-10 07:43:33 -07:00
Jacob Parker f951da912d Add iOS support for CSS property font-variant, accepting tabular-nums…
Summary:
Ground work for allowing `font-variant`s. Currently allows switching between `tabular-nums` and `proportional-nums`. I will need guidance on how to test this, and a few pointers on code style (new to Objective C, and had to make one or two hacks).
Closes https://github.com/facebook/react-native/pull/9045

Reviewed By: majak

Differential Revision: D3664338

Pulled By: javache

fbshipit-source-id: 032f326c37ee6150348da2b33b6a3fc1988e8920
2016-08-09 08:43:34 -07:00
Pieter De Baets 335132ad63 Fix some analyzer warnings
Reviewed By: majak

Differential Revision: D3683672

fbshipit-source-id: 879578b050186bc779d01a17822d41bf7e473123
2016-08-09 03:58:36 -07:00
Roshan Jossey 915345bd01 Fix memory leak bug in RCTModalHost
Summary:
This PR addresses issue #9265.

Negated the condition that checks if `_hostViews` exists so that `_hostViews` will be allocated only if it doesn't exist
Closes https://github.com/facebook/react-native/pull/9295

Differential Revision: D3686214

fbshipit-source-id: ec0caac99d231786eefad023f3f0ed44a79f687e
2016-08-08 15:58:33 -07:00
ymmuse 7b02c1de3f fix CSSNodeList memory leak
Summary:
CSSNodeListFree does not free the list->items memory
Closes https://github.com/facebook/css-layout/pull/214

Differential Revision: D3683643

Pulled By: emilsjolander

fbshipit-source-id: 7f9ef19f4603d5558cc2f8302756b3bcec2f6c12
2016-08-08 04:58:30 -07:00
Pieter De Baets f35b372883 Make sure layout happens after setFrame:forView:
Reviewed By: majak

Differential Revision: D3682745

fbshipit-source-id: 108ff292aa79765d8e5bb7fc364717eba662c0ea
2016-08-08 03:43:23 -07:00
Pieter De Baets 6b9406ed5a Fix missing font constants on iOS7
Reviewed By: dinhviethoa

Differential Revision: D3682528

fbshipit-source-id: 7e3a0b7c2c043a869f2f5dfe9aaf404897076d0b
2016-08-07 11:58:30 -07:00
Pieter De Baets f571f016d9 Improve types in RCTFont API
Reviewed By: majak

Differential Revision: D3662880

fbshipit-source-id: f54e1ac164373337460047eb3708a588f578b5fc
2016-08-05 12:44:21 -07:00
Pieter De Baets 3d6240f9a6 Implement system font caching in RCTFont
Reviewed By: majak

Differential Revision: D3662848

fbshipit-source-id: 7135c0a80c6781669e43ae9a58a26a2c85f2c827
2016-08-05 12:44:21 -07:00
Pieter De Baets c5a44b7ca3 Move font helpers to RCTFont
Reviewed By: majak

Differential Revision: D3662804

fbshipit-source-id: 2c03a094a74c617c0d6172e327bd77d23d0d44c2
2016-08-05 12:44:20 -07:00
Pieter De Baets e30327cb13 Fix styling of system fonts
Summary:
When you call `-[RCTConvert UIFont:withFamily:...]` with a non-nil font object, we'll try to use the existing font object for system information. On iOS9+ which uses the San Francisco font, `[UIFont fontNamesForFamilyName:]` doesn't return anything useful, so we need to make sure that we detect this as a system font and use the appropriate methods. This issues is made worse by the fact that RCTTextView and friends recreate the font property for every attribute that is set (pretty horrible perf-wise).

This fixes https://github.com/facebook/react-native/issues/2140

Reviewed By: sahrens

Differential Revision: D3662751

fbshipit-source-id: c528e8945ed361a922c03f861d3c0b584658573b
2016-08-05 12:44:20 -07:00
Pieter De Baets 0222107170 Customize main thread initialization of native modules (2nd try)
Reviewed By: majak

Differential Revision: D3671197

fbshipit-source-id: e8df7669be79303d335f2c881e97310b5fed47f9
2016-08-05 11:28:32 -07:00
James Ide f8f7a1540d Prefix isUndefined with "CSS"
Summary:
Consistently namespace all of css-layout's public C API with "CSS". The only function that needed to be renamed was isUndefined, which I renamed to CSSValueIsUndefined.

Fixes #210.
Closes https://github.com/facebook/css-layout/pull/211

Reviewed By: lucasr

Differential Revision: D3674922

Pulled By: emilsjolander

fbshipit-source-id: 1752f477bde45586db112fe2654d0404cc52e1d1
2016-08-05 06:28:38 -07:00
Mengjue Wang f0fb228ec7 Provide forceRTL for LTR language to test
Summary:
1. Provide forceRTL function for developer to test RTL layout in LTR language bundle in I18nUtil and expose it in I18nManager.
2. Rename `allowRTL` and `setAllowRTL` functions

Reviewed By: fkgozali

Differential Revision: D3663693

fbshipit-source-id: 3db13a44c069ae73d1728c211306422db5dd8122
2016-08-04 12:28:30 -07:00
Emil Sjolander 4983a58d6c Add and run clang format script
Reviewed By: lucasr

Differential Revision: D3662225

fbshipit-source-id: ddd4064cbf9be21ca6a97001ace1b56b4314c86f
2016-08-04 08:28:53 -07:00
Emil Sjolander 5fd6c0903e Add jni bindings
Reviewed By: lucasr

Differential Revision: D3648793

fbshipit-source-id: d0e696e196fa7c63109c9117a65645ca3d6c9c00
2016-08-04 08:28:53 -07:00
wenzhao.yin 223bcd74ad Cancel check update task
Summary:
When call `[RCTDevMenu invalidate]`, it will cancel updateTask. But in fact, after the `[updateTask cancel]`, the updateTask's completionHandler will call `checkForUpdates` again, so it will create a new updateTask.
Closes https://github.com/facebook/react-native/pull/6165

Differential Revision: D3669576

Pulled By: javache

fbshipit-source-id: 443924b7f4be1716797fc5690e90d962cf31b923
2016-08-04 07:15:49 -07:00
Brent Vatne 0093dcc9c5 Don't show keyboard shortcuts with redbox on device
Summary:
Unless there is some really fancy way to make pressing the keyboard shortcuts like cmd+r from your dev machine and have it reload on your device like you can in the simulator, we probably shouldn't display these when running on device.

![img_4679](https://cloud.githubusercontent.com/assets/90494/17316248/331d890a-5827-11e6-9796-0f2bf24315d7.PNG)

<img width="487" alt="screen shot 2016-08-01 at 8 29 41 pm" src="https://cloud.githubusercontent.com/assets/90494/17316250/3b174e5c-5827-11e6-8337-ac0c01843fae.png">

![img_4677](https://cloud.githubusercontent.com/assets/90494/17316257/47aebcd6-5827-11e6-8a16-b128275f73e8.JPG)
Closes https://github.com/facebook/react-native/pull/9154

Differential Revision: D3663618

Pulled By: javache

fbshipit-source-id: 22d85d65702fa8d99788b79d04136c36da0d5b66
2016-08-03 17:43:49 -07:00
alvaromb e52cab5a7f Adds the ability to use UIManager to check if a node is an ancestor
Summary:
Sometimes is handy to check if a React node is a descendant of another node or not. For instance, I want to check if the focused `TextInput` is descendant of an specific `ScrollView`:

```js
const currentlyFocusedField = TextInput.State.currentlyFocusedField()
UIManager.viewIsAncestorOf(
  currentlyFocusedField,
  this.getInnerViewNode(),
  (isAncestor) => {
    if (isAncestor) {
      console.log('The focused field is a descendant of this ScrollView!')
    }
  }
)
```

This function uses the same strategy as the `measureLayout` method to check if one node is an ancestor of other node. As the `measureLayout` method, this is performed outside the main thread.

By now I've only implemented the iOS version and its tests, but if this function is going to be merged I'll implement the Android version too. I have objc experience but no Java or Android, so I prefer to validate this functionality before jumping into developing the Android part.
Closes https://github.com/facebook/react-native/pull/7876

Differential Revision: D3662045

Pulled By: javache

fbshipit-source-id: b9668e8ea94fd01db76651f16243926cf9c2566f
2016-08-03 04:13:43 -07:00
Emil Sjolander f80b93afd3 Dont redefine abort() as it may leak into other files
Differential Revision: D3661871

fbshipit-source-id: 14a9d076299b4f21d17a2bed68aa30b796c438a5
2016-08-03 01:58:39 -07:00
Pieter De Baets b83ccb5749 Reverted commit D3580025
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 4422b6b97ef844158e369e022d62d6f0ae641222
2016-08-02 14:13:27 -07:00
Pieter De Baets e762d961cd Use new enqueueJSCall method everywhere
Reviewed By: majak

Differential Revision: D3605263

fbshipit-source-id: 215f896d675b937593c8b796ed6ec5261ac74dbf
2016-08-02 11:14:06 -07:00
Pieter De Baets 47d6d289d4 Customize main thread initialization of native modules
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 18abc15b894c745f584d91da47035c6db036aafa
2016-08-02 10:27:25 -07:00
Emil Sjolander f94e4348dd Implement custom assert macro
Reviewed By: javache

Differential Revision: D3648805

fbshipit-source-id: a6bf1bb55e1e0ee37284647ab76d66f3956a66c0
2016-08-02 08:13:58 -07:00
Emil Sjolander 2d168fcd61 use #pragma once
Reviewed By: lucasr

Differential Revision: D3648895

fbshipit-source-id: faf42cda82764adaf41cf3f3f9109d48aea203fe
2016-08-02 08:13:58 -07:00
Emil Sjolander ef585e33b1 Make use of modern standard types
Reviewed By: lucasr

Differential Revision: D3649096

fbshipit-source-id: dc9fc8861c3106494c5d00d6ac337da50a4c945b
2016-08-02 08:13:57 -07:00
Pieter De Baets 73f3713cd0 Improve error message when packager is not running
Reviewed By: majak

Differential Revision: D3655608

fbshipit-source-id: 49401a03beb986285d288bb80ba78052a26326ef
2016-08-02 08:13:57 -07:00
Nathan Azaria 8258366a3d Add gating to various use of RCTProfileIsProfiling
Reviewed By: javache

Differential Revision: D3641529

fbshipit-source-id: 21e685ab853159d19acea57c8cd9255a04d8226f
2016-08-01 23:58:33 -07:00
Emil Sjolander 42fc2e80db shouldUpdate -> hasNewLayout
Reviewed By: majak

Differential Revision: D3613695

fbshipit-source-id: 4e16e8d4de90660a09d6e1d3a43c6c5e89349993
2016-08-01 05:28:28 -07:00
Mengjue Wang a06e4b75e4 bottom styling isn't applied when a View is not absolute-positioned
Summary: The new CSSLayout have a wrong calculate for the getRelativePosition. So use the getLeadingPosition will get 0 instead of return undefined. Fix it with using isLeadingPosDefined.

Reviewed By: fkgozali

Differential Revision: D3640799

fbshipit-source-id: 50d3bd2ea4c0d8bf96ba34297425ba269b0535cd
2016-07-28 23:43:27 -07:00
Mengjue Wang 66514869aa Provide RTL support for RCTShadowView
Summary:
The make current RCTShadowView support RTL layout.
Two changes I made:
1 Change all left/right to start/end for margin, padding, boarder and position
2 Change the paddingAsInsets to support RTL

Reviewed By: majak

Differential Revision: D3548002

fbshipit-source-id: 15cc5228d2d28d0e12a7147daf57967e5b87ee63
2016-07-28 17:28:32 -07:00
Mengjue Wang 873c6ff5b9 Fix CSSLayout to Support RTL
Summary:
The current CSSLayout can't support RTL because wrong calculation for absolute position.
This change is mainly to fix the issue: https://github.com/facebook/css-layout/issues/197
Three main problems I fixed:
1. Calculate the position in the same way as margin, boarder, and padding. So that to fix the absolute problem.
2. Fix one wrong calculation for leading value when we only know the trailing value. It was hard code for the LTR situation. Now I changed it to depends on the main Axis.
3. Expose getter and setter function for RN to read layout direction and start/end position value.

Reviewed By: fkgozali

Differential Revision: D3616949

fbshipit-source-id: ae7a47cc0a5d02b42b95f87232be51ab144056d9
2016-07-28 14:58:35 -07:00
David Goldman fd48bc3cff Implement multi-source Images on iOS
Summary: Mirrors Android's support for multiple sources for Image, allowing us to fetch new images as the size of the view changes.

Reviewed By: mmmulani

Differential Revision: D3615134

fbshipit-source-id: 3d0bf2b75f63a4379e0e49f2dab9aea351b31d5f
2016-07-28 14:13:46 -07:00
Emil Sjolander 471eefcb74 Move dirty layout into css-layout
Reviewed By: majak

Differential Revision: D3610634

fbshipit-source-id: 1dc9017c0a34ced231b5bebe334591f3d0b89bf3
2016-07-25 03:58:41 -07:00
Wenjing Wang 15dfa5b224 Reverted commit D3598946
Reviewed By: majak

Differential Revision: D3598946

fbshipit-source-id: fb70f5b031a85f30a6207eb95b7fd0ccd7d78039
2016-07-23 01:28:31 -07:00
Emil Sjolander 55638f804d Move dirty layout into css-layout
Reviewed By: majak

Differential Revision: D3598946

fbshipit-source-id: fdbbbf3b9bd262e0b14b5b9a40171a1c039695a7
2016-07-22 11:43:21 -07:00
Pieter De Baets 82c8129627 Fix double React perflogger creation
Reviewed By: mmmulani

Differential Revision: D3599003

fbshipit-source-id: 25090309c92127b403d1df6a8b7c18ad5a088b5e
2016-07-22 09:58:29 -07:00
Janic Duplessis 5903949ad6 Load local assets synchronously to prevent image flicker
Summary:
This uses `[UIImage imageNamed:]` to load local assets that are bundled using `require('../image/path.png')` and makes sure it is done synchronously on the main queue to prevent images from flickering. This improves user experience a lot when using large local images and prevents icon flickers to match the behaviour of most native apps.

This adds to methods to the ImageLoader protocol, one to tell if the image loader must be executed on the url cache queue and one to tell if the result of the image loader should be cached. I then use these to make the LocalImageLoader bypass the url cache queue and avoid caching images twice.

Note that this doesn't affect debug builds since images are loaded from the packager.

I'm not sure if we want to still support async loading of local images as I'm not sure how much of a perf difference this will make. Maybe someone at fb can benchmark this see how it affects your apps but there wasn't a noticeable one in mine. Also I only enabled this for loading png and jpg im
Closes https://github.com/facebook/react-native/pull/8102

Reviewed By: bnham

Differential Revision: D3433647

Pulled By: javache

fbshipit-source-id: 37bd6aff20c0465c163db3cdbcaeaedff55f7b1f
2016-07-21 07:58:51 -07:00
Emil Sjolander 0df569dc7f Handle children internally in CSSLayout
Reviewed By: javache

Differential Revision: D3588205

fbshipit-source-id: 27f701a9a85cc0e86bb1d233a6bc74b529a8d4d4
2016-07-20 13:28:30 -07:00
Emil Sjolander c7ff46bf55 Make isTextNode a prop instead of a function
Reviewed By: javache

Differential Revision: D3586184

fbshipit-source-id: 8b269c11c5d47efb6b788be68336845399292168
2016-07-20 08:59:00 -07:00
Emil Sjolander 1af9270e45 Revamp API
Reviewed By: majak

Differential Revision: D3579423

fbshipit-source-id: 040ecab2f20216aa136ccb8a9e7e15ffa882b313
2016-07-20 08:58:59 -07:00
Emil Sjolander 768caf5e08 Use library style import for CSSMacros
Reviewed By: javache

Differential Revision: D3576815

fbshipit-source-id: 8d8cf34f701529b272f564088fb1b28708ec27a9
2016-07-20 07:28:36 -07:00
Emil Sjolander 1aa7ad0ab8 CamelCase
Reviewed By: majak

Differential Revision: D3576069

fbshipit-source-id: cecda2cdb67f2f66ac92e336068d58731ccdb101
2016-07-20 06:43:32 -07:00
Emil Sjolander 0587c85094 Add [RCTShadowView isCSSLeaf] for skipping css tree of children
Summary: RCTShadowText currently overrides a couple methods from RCTShadowView to reset the count of the cssNode children to 0. This diff instead moves that logic into RCTShadowView behind a configurable flag making it easier to reason about.

Reviewed By: javache

Differential Revision: D3586434

fbshipit-source-id: 4389a8119dc49e3fc4357174c87c0c69287ae385
2016-07-20 02:58:39 -07:00
Emil Sjolander 102577565a Remove fillCSSNode method
Summary: fillCSSNode was only ever used in RCTShadowView to set the child count which is already performed in insert/remove subview calls and in RCTShadowText is was used to set the measure function which can be done in the initializer instead.

Reviewed By: majak, javache

Differential Revision: D3586418

fbshipit-source-id: de2155daf0f1702c8977bf23183a3b6a650d016b
2016-07-20 02:58:39 -07:00
Pieter De Baets 63e0e6c7e4 Add more profiling markers to RCTJSCExecutor
Summary: Add some additional perf markers, and remove the usage of RCTProfileBlock as it completely breaks debugging / stepping in those blocks.

Reviewed By: majak

Differential Revision: D3579900

fbshipit-source-id: 8846dfc39b2448daa3669d5e1e8efb9096f183c5
2016-07-19 07:28:34 -07:00
Mehdi Mulani 40c06b99a2 Short-circuit setContentInset in RCTScrollView
Reviewed By: javache

Differential Revision: D3579609

fbshipit-source-id: c108bbe135a0a9a98045ebc8068a103c892a1d0f
2016-07-18 11:58:27 -07:00
David Goldman 9d2e6a2f8a Add ability to customize error messages and stacks within the iOS redbox
Reviewed By: javache

Differential Revision: D3517605

fbshipit-source-id: a2efba80bbe1f6c74bf4e01f7807389962cb2463
2016-07-18 11:28:36 -07:00
Pieter De Baets 4269003cb7 Make bridge initialization configurable
Reviewed By: majak

Differential Revision: D3424412

fbshipit-source-id: 933925b97cb2bdfabd84c3533fefb01efb41d030
2016-07-18 07:13:32 -07:00
Pieter De Baets 23e28eca11 Add completion callback to enqueueJSCall
Reviewed By: majak

Differential Revision: D3423580

fbshipit-source-id: c063c9c5d8961d5c9cb14c32d70767c67d78430a
2016-07-18 07:13:32 -07:00
Pieter De Baets 7fa677f7c3 Add MessageQueue method for executing function and returning its result
Reviewed By: majak

Differential Revision: D3175793

fbshipit-source-id: e1e66e3dcde8b1fb35973340e12d947a0e955775
2016-07-18 07:13:32 -07:00
Janic Duplessis 80872ffccd Remove exported constants from RCTTimers to allow lazy initialization
Summary:
As per javache comments in #8734.

Also removes now useless feature detection check.

**Test plan**
Tested that rIC still works in UIExplorer example.
Closes https://github.com/facebook/react-native/pull/8795

Differential Revision: D3572566

Pulled By: javache

fbshipit-source-id: 261d13d8b03898313f8b4184d634c70f81a61b62
2016-07-15 13:58:40 -07:00
Adam Ernst 31f01c02db Eliminate "packager running predicate"
Summary: Instead of the somewhat odd concept of a "packager running predicate", just expose a class method for generating a JS bundle URL given a host, root, and options. This can be used by consumers that need custom behavior.

Reviewed By: javache

Differential Revision: D3564185

fbshipit-source-id: b1a7e66a2dada6a9eefe783b12b03fca7a330be3
2016-07-15 05:43:47 -07:00
Emil Sjolander 4e056e94ff Use library imports for csslayout
Reviewed By: javache

Differential Revision: D3561526

fbshipit-source-id: b1b420f52230c323d64406deb813ee104dd6f7b5
2016-07-15 04:43:40 -07:00
Emil Sjolander e9f53eee2c Remove CSSLayoutTestUtils from RN
Reviewed By: javache

Differential Revision: D3561502

fbshipit-source-id: 3a58ed9fb291793d70cc3e8f4ae21fabff73275e
2016-07-14 09:43:39 -07:00
Emil Sjolander f22e86e18d Changed vendored folder name to match library name
Reviewed By: javache

Differential Revision: D3561358

fbshipit-source-id: 894367bf2e019e5f9fbd40d34ef2752f26645b90
2016-07-14 06:13:50 -07:00
Emil Sjolander a939f310ab Name library header same as library
Reviewed By: javache

Differential Revision: D3561336

fbshipit-source-id: fd4ccd4c731443c72252f6d20286b2772fc40a3c
2016-07-14 06:13:50 -07:00
Pieter De Baets b9f391d616 Avoid wrapping every UIManager block in another block
Reviewed By: majak

Differential Revision: D3555003

fbshipit-source-id: e7fd5373d002e98bdeb566deaca4345de56c3414
2016-07-14 03:28:20 -07:00
Janic Duplessis 5618c3ff09 Initial implementation of requestIdleCallback on iOS
Summary:
iOS follow up to #8569. This currently depends on the Android PR since it contains the JS implementation, only review the last commit. Just putting this out here for visibility, don't merge this before the Android PR.

**Test plan**
Tested by running a background task that burns all remaining idle time (see UIExplorer example).

Tested that native only calls into JS when there are pending idle callbacks.

Tested that timers are executed before idle callback.
Closes https://github.com/facebook/react-native/pull/8734

Differential Revision: D3560818

fbshipit-source-id: a28d3092377a7fd4331647148d40fe69e4198c7e
2016-07-13 22:58:30 -07:00
Adam Ernst 22eabe59a2 Introduce experimental API to allow overriding how packager run status is determined
Summary: The docs for this new method explain what it does.

Differential Revision: D3556890

fbshipit-source-id: b075e750cdd1e7354e0a26c03b3fd74cca52aeb7
2016-07-13 16:43:38 -07:00
Adam Ernst 16d29fe16f Minor refactor to RCTBundleURLProvider's constants
Reviewed By: javache

Differential Revision: D3556772

fbshipit-source-id: ae394c751679171345804c4d2eab8cd41cc4ba13
2016-07-13 16:43:38 -07:00
Adam Ernst b4e267a993 Refactor RCTBundleURLProvider
Summary:
- Avoid using `+initialize`, use dispatch_once instead; it should be equivalent but more performant.
- Don't even let the `isPackagerRunning:` and `guessPackagerHost` methods exist unless `RCT_DEV` is on; they didn't do anything interesting when it is off.

Reviewed By: javache

Differential Revision: D3556645

fbshipit-source-id: 7dcdb4ae27f6625010e15846d757269f6f04155c
2016-07-13 16:43:38 -07:00
Adam Ernst 235dd0051d Remove allowLoadingNonRAMBundles
Differential Revision: D3555963

fbshipit-source-id: 24c23e8522c293aad030cd98e0c4ebcb76c54271
2016-07-13 16:43:38 -07:00
Adam Ernst 37d03396c6 Improve error message for non-file URLs
Summary: Include the actual scheme instead of "non-file".

Reviewed By: javache

Differential Revision: D3555812

fbshipit-source-id: 3ae0490f2d8fae01a551ba2877789dc15818fc50
2016-07-13 16:43:38 -07:00
yueshuaijie 8612d7640d Add WebView.dataDetectorTypes prop.
Summary:
WebView component detect phone numbers in html as URL links by default. But sometimes we don't want this behavior.
This PR add dataDetectorTypes as a prop of WebView, so one can specify value of this prop as one or more of phoneNumber/link/address/calendarEvent/none/all
This prop maps to UIWebView.dataDetectorTypes
Closes https://github.com/facebook/react-native/pull/8743

Differential Revision: D3556440

fbshipit-source-id: 55f01d2cdd785381f261a9dc931aa9311f0ad1d4
2016-07-13 14:43:25 -07:00
Emil Sjolander 86e304f6a3 Move csslayout into xplat
Reviewed By: lucasr

Differential Revision: D3509483

fbshipit-source-id: dfd0b00002b7da6432667b4a795edb5a15cf9a88
2016-07-13 10:28:27 -07:00
Adam Ernst 3b4120d595 Simplify JS error to NSError API
Summary: No need to specify duplicative information.

Reviewed By: javache

Differential Revision: D3550805

fbshipit-source-id: b5abc3f1c74e26b4d4641c29fedba189cc46406e
2016-07-13 08:28:34 -07:00
Pieter De Baets ceffb085d0 Remove more weakSelf/strongSelf errors
Reviewed By: mmmulani

Differential Revision: D3555000

fbshipit-source-id: 13b75571a0d09374ee82977cb2acbf1f894479ca
2016-07-13 08:13:17 -07:00
Adam Comella 68b0ce657e iOS: Provide correct initial value for AppState.currentState
Summary:
Attempt to fix #7919.

Currently, if the app is launched into the background and you read `AppState.currentState` too soon, you will see the value `'active'` instead of `'background'`. This is because the default value of `AppState.currentState` is hardcoded to be `'active'` and it is initialized with the actual value asynchronously.

This attempts to fix the bug by having the `RCTAppState` module provide the initial state as a module constant.

As noted in #7919, it looks like this fix was already tried and reverted with 0fb3d8de83. zjj010104, hedgerwang, nicklockwood -- can you explain why? I would very much like to get this bug fixed. Nobody has followed up on the issue I filed so I decided to just go ahead and make a PR with my best guess at a fix.

**Test plan (required)**

Built a small app as described in the repro steps for #7919 and verified that, when the app is launched into the background, `init currentState: background` is printed. Also verified that  `i
Closes https://github.com/facebook/react-native/pull/8058

Differential Revision: D3554619

fbshipit-source-id: 5d950b85e335765552bbd3cf6ed91534062e35a1
2016-07-12 23:28:22 -07:00
David Aurelio c33084cc94 Read within bounds of `NSData` object
Summary: This prevents the `isUnbundle` check to read beyond the end of an `NSData` instance by using `getBytes:length:` instead of accessing the underlying buffer directly.

Reviewed By: javache

Differential Revision: D3548874

fbshipit-source-id: 7c93c66cc6abb4a2a321888ab394212f4d14a03e
2016-07-12 10:13:24 -07:00
Pieter De Baets 7b7ecdf337 Cleanup warnings
Reviewed By: majak

Differential Revision: D3542606

fbshipit-source-id: 41246a012a32fafc4ddbb307c7b9919e3c203393
2016-07-12 05:59:12 -07:00
Adam Ernst 3be8c957b0 Minor cleanup to make loader unaware of bridge
Summary: The loader should be a utility that stands alone. The bridge uses the loader, not the other way around.

Reviewed By: bnham

Differential Revision: D3546157

fbshipit-source-id: 91016afb629df1f8c83c8fca6f42649be0b046b0
2016-07-12 05:28:37 -07:00
Adam Ernst c7a590655c Expose a method to synchronously load bundle if possible
Summary:
This diff exposes a new experimental method `[RCTJavaScriptLoader +attemptSynchronousLoadOfBundleAtURL:sourceLength:error:]`. It may be used if you know that a specific call site must load its JavaScript synchronously, or else fail entirely.

This new API will succeed for file URLs that point to a RAM bundle. It will fail for non-RAM-bundle files and for HTTP URLs.

This also cleans up the error domain and codes for this class. This should be the only externally visible change from this diff if you don't use the new API: the codes and domains you receive from the API may change slightly. They were pretty sloppy and undocumented before, so I think this change is for the better.

Reviewed By: bnham

Differential Revision: D3545956

fbshipit-source-id: 30e65f4e8330d2d68f3f50ade077fdc1db4a435e
2016-07-12 05:28:36 -07:00
Adam Ernst 80c71e5cae Refine RCTJSCExecutor's APIs for using a thread/context that already exists
Summary:
The `initWithJSContextProvider:` API created a `RCTJSCExecutor` with a thread/context that already exists, but it did not solve the problem of loading an actual application script; the `executeApplicationScript:` API is also asynchronous.

Create a new merged API that allows you to pass in a pre-created thread/context pair and immediately receive an `RCTJSCExector` that has already executed a specified application script.

This also removes the `underlyingJSContext` API entirely, in favor of passing it back in a byref variable in the new API. This minimizes the surface area for API abuse.

Reviewed By: bnham

Differential Revision: D3545349

fbshipit-source-id: 1c564f44d2a5379b5e6f75640079a28fd7169f67
2016-07-12 05:28:36 -07:00
Adam Ernst 0a98b612aa Change how native require hook is registered
Summary:
Instead of two separate dispatches to the JavaScript thread, only do one. Avoid the strongSelf dance entirely.

This refactor does mean that the cost of registering the nativeRequire hook on the context is not measured by the `RCTPLRAMBundleLoad` tag. However it should be almost zero-cost to construct and set a single block, so I'm OK with that change.

Reviewed By: bnham

Differential Revision: D3542940

fbshipit-source-id: d6bd26e478d0d33b56f8116d7efe6aac80c91711
2016-07-11 15:58:20 -07:00
Pieter De Baets ba4c34c0db Remove deprecated nativeScrollDelegate property
Summary: We deprecated it a while back and nobody is using it internally.

Reviewed By: majak

Differential Revision: D3542602

fbshipit-source-id: dfe11a47b21d2f8a7c946c902f0ea427615ffc31
2016-07-11 13:34:02 -07:00
Pieter De Baets 3816ced49b nil out pendingCalls when we're done with them
Reviewed By: mmmulani

Differential Revision: D3543825

fbshipit-source-id: cf2fcdb4e1536c00675fafa85d0f880313a80655
2016-07-11 13:33:58 -07:00
Pieter De Baets 81f59dfdc2 Remove code for testing without JS bundle
Reviewed By: mmmulani

Differential Revision: D3542347

fbshipit-source-id: d0dcfb65645faf515e6e48e6ff733646e1bcf907
2016-07-11 13:33:55 -07:00
Pieter De Baets 2ae23d9f36 Flush pending calls off the main-thread
Reviewed By: majak

Differential Revision: D3535193

fbshipit-source-id: 8c4736629eab3c723641f0c3fb449c168cd492a1
2016-07-11 13:33:52 -07:00
Adam Ernst af7104b49e Extract part of executeApplicationScript into a C function
Reviewed By: javache

Differential Revision: D3542897

fbshipit-source-id: aa74c0c7c4477158fc9c8aff69432aed592f472f
2016-07-11 13:33:50 -07:00
Adam Ernst 5e89baa7a0 Remove needless weakSelf from executeApplicationScript
Reviewed By: javache

Differential Revision: D3542798

fbshipit-source-id: bf3fe15c78b55691176aecf209210a6f35f98862
2016-07-11 13:33:48 -07:00
Adam Ernst 8fb6111fa5 Make loadRAMBundle a C function, not a method
Summary: This makes the state it uses more explicit. It also makes a bug with performance measurement obvious: if we early return to error, we never mark stop for `RCTPLRAMStartupCodeSize`.

Reviewed By: javache

Differential Revision: D3542751

fbshipit-source-id: e6c1e3f3a76098ca37b8078f6e9abc805ad2d9da
2016-07-11 13:33:46 -07:00
Pieter De Baets 7b718b03eb Allow RCTDisplayLink to pause more often
Summary:
By default we run the the JS display link, even if there are no modules listening. Given that most listeners will be lazily constructed, let's make it paused by default.

Since RCTTiming almost never unpauses due to some long-lived timers, implement a sleep timer that pauses the displaylink but uses an NSTimer to wake up in time.

Reviewed By: mhorowitz

Differential Revision: D3235044

fbshipit-source-id: 4a340fea552ada1bd8bc0d83b596a7df6f992387
2016-07-11 08:28:24 -07:00
Alex Kotliarskyi e5650560c0 Class for JS stack frames instead of dictionaries
Summary:
Currently React Native codebase treats JS stack traces as array of dictionaries.

This diff switches the Red Box to use new `RCTJSStackFrame` for internal data representation, while keeping the exposed API unchanged. The next step would be to replace the rest of manual parsing and usage of dictionaries.

The new class has ability to parse the stack from raw strings or dictionaries.

Depends on D3429031

Reviewed By: javache

Differential Revision: D3473199

fbshipit-source-id: 90d2a4f5e8e054b75c99905f35c2ee54927bb311
2016-07-11 06:13:32 -07:00
Nathan Azaria c8b5880102 Renamed updateObject:forKey to updateValue:forKey
Reviewed By: javache

Differential Revision: D3534820

fbshipit-source-id: 32afa39aedd43319fb5933ee0b169a41f4c8cd19
2016-07-11 03:43:23 -07:00
Nathan Azaria defc34a28b Removed calls to RCTBundleURLProvider setDefaults
Reviewed By: javache

Differential Revision: D3534799

fbshipit-source-id: 0c784cd9a993c6379e49087906ebf670ddd4f8cd
2016-07-11 02:58:32 -07:00
Pieter De Baets 4aedcc7670 Fix double completion callback in RCTJavascriptLoader
Reviewed By: foghina, mmmulani

Differential Revision: D3541511

fbshipit-source-id: 9a0a4be635ca910cb1a5c875a0f4a2b82c51cf71
2016-07-10 12:28:24 -07:00
Emil Sjolander 70b989eb67 Revert land of css-layout PR #199
Reviewed By: bestander

Differential Revision: D3536627

fbshipit-source-id: e89b2a5fd38d1228bd8526c46bb26c594947837a
2016-07-08 16:48:13 -07:00
Adam Ernst 39cb110c5b Add the ability to pre-create the JavaScript thread with RCTJSCExecutor
Summary: This can be used to create a JavaScript thread and `JSContext` in advance, then supply them to the `RCTJSCExecutor` at creation time later.

Reviewed By: javache

Differential Revision: D3534553

fbshipit-source-id: 99ccf711928cd12e84c9fbe142c6d19a7af55d07
2016-07-08 12:35:50 -07:00
Adam Ernst 294173a427 Organize ivars in RCTJSCExecutor
Reviewed By: javache

Differential Revision: D3534380

fbshipit-source-id: 364213f24256602471a5b3cd1afe6c7be4aab743
2016-07-08 12:35:48 -07:00
Adam Ernst 7ee2f48451 Remove left-over ctx property from RCTJavaScriptContext
Summary: This was left over from a previous change.

Reviewed By: javache

Differential Revision: D3534376

fbshipit-source-id: 6932364d1c32d8fbdf56c642893f9ea5e6dc1fee
2016-07-08 12:35:45 -07:00
Emil Sjolander ca66383941 Correctly size cross axis when measuring flex basis
Summary:
https://github.com/facebook/css-layout/pull/199

- Nodes were measured with the assumption of being text nodes (height depends on width) when determining flex basis. This is not always true. Even when we are just interested in the main axis (flex basis) we need to correctly constrain the cross axis.
- Some tests were wrong. Measuring texts.big and expecting it to have textSizes.smallHeight which doesn't make a lot of sense.

Reviewed By: vjeux

Differential Revision: D3510163

fbshipit-source-id: ee53b548dd078005fdd153d279e4c7fef3dd02d0
2016-07-08 09:28:35 -07:00
Adam Ernst 1ebd9c5dea Create JSContext inside setUp
Summary:
In practice, it *MUST* be the call to `self.context` within `setUp` that triggers the creation of the context:

- It can't come before that point because `_jscWrapper` has not been set up yet
- It can't come after that point since `self.context` would create the context there.

Just move the creation to be inline, enforced by assert. This makes it easier to reason about where the context is created, and easier to change how it is created later.

Reviewed By: javache

Differential Revision: D3529843

fbshipit-source-id: 8ed5a9861ebefd4b9e0f7155db8587dcf0442b7a
2016-07-08 09:13:59 -07:00
Adam Ernst 29f9be6d9c Remove needless weak self in RCTJSCExecutor
Summary: There's no reason for this; setUp is once-and-done. Probably just trying to ignore the incorrect clang warning.

Reviewed By: javache

Differential Revision: D3528494

fbshipit-source-id: e4f986df8d097e4720dfd4a51e7fb6c9c9b5108f
2016-07-08 09:13:59 -07:00
Emil Sjolander 89a53b687c Use AT_MOST measurespec when onyl max dimension is defined
Summary:
https://github.com/facebook/css-layout/pull/200
Make use of max dimension styles to allow root to be measured with AT_MOST measure mode

Reviewed By: IanChilds

Differential Revision: D3513505

fbshipit-source-id: 169f49717e896eb6270b52fb7115ce005aa0e3a8
2016-07-08 03:58:28 -07:00