Summary: No need to have two files; merge it into one and give it an appropriate name.
Reviewed By: javache
Differential Revision: D4296716
fbshipit-source-id: 904d13c23bb8d403b8efcb60f9a4aa5df5b08972
Summary: This singleton was unnecessary and can be implemented with a single `static` in `RCTDevMenu`. In another diff, I will rename `RCTWebSocketManager.{h,m}` to reflect the only class that remains.
Reviewed By: javache
Differential Revision: D4296551
fbshipit-source-id: 653971dfb31de5b0a161b531eed82a067f536ce3
Summary: Introduces an API to register a weakly-held listener for the reload (Cmd+R) command. This allows external infrastructure to hook into the reload command before the `RCTBridge` object is even created.
Reviewed By: javache
Differential Revision: D4286980
fbshipit-source-id: 51012fb8cbeb433dc880d9d98d847b07fdbb4c4f
Summary:
Xcode really sucks, per some discussion on e1577df1fd and https://developer.apple.com/library/content/technotes/tn2215/_index.html, if you use the headers phase, and mark headers in your static library as public, they will actually end up in the final package that's built and you can't submit to the app store! This changes our xcode setup to use a copy files phase instead.
I've also changed the header include path to be $(BUILT_PRODUCTS_DIR)/include, which is added to the include path by Xcode by default, so 3rd party libraries should not be impacted by these changes anymore.
Reviewed By: mkonicek
Differential Revision: D4291607
fbshipit-source-id: 969b9ebcbeb8161f85427f8c429e198d9d0fae30
Summary: The target config inside React.xcodeproj was messed up, with source files being included in multiple or wrong targets. I went over the files in React.xcodeproj and verified that each .m file was included only once and was in the right target and .h were in the right projects.
Reviewed By: majak
Differential Revision: D4284673
fbshipit-source-id: 99af61083c6ca81311e30f0ea0045d4e7bffc20c
Summary:
To make React Native play nicely with our internal build infrastructure we need to properly namespace all of our header includes.
Where previously you could do `#import "RCTBridge.h"`, you must now write this as `#import <React/RCTBridge.h>`. If your xcode project still has a custom header include path, both variants will likely continue to work, but for new projects, we're defaulting the header include path to `$(BUILT_PRODUCTS_DIR)/usr/local/include`, where the React and CSSLayout targets will copy a subset of headers too. To make Xcode copy headers phase work properly, you may need to add React as an explicit dependency to your app's scheme and disable "parallelize build".
Reviewed By: mmmulani
Differential Revision: D4213120
fbshipit-source-id: 84a32a4b250c27699e6795f43584f13d594a9a82
Summary:
Expose aspectRatio style prop from css-layout to React Native.
This means the following will now work:
<View style={{backgroundColor: 'blue', aspectRatio: 1}}/>
Reviewed By: javache
Differential Revision: D4226472
fbshipit-source-id: c8709a7c0abbf77089a4e867879b42dcd9116f65
Summary:
When native events where handled they were not sent to JS as an optimization but this caused some issues. One of the major one is touches are not handled properly inside a ScrollView with an Animated.event because it doesn't receive scroll events so it can't cancel the touch if the user scrolled.
Closes https://github.com/facebook/react-native/pull/10981
Differential Revision: D4226403
Pulled By: astreet
fbshipit-source-id: 41278d3ed4b684af142d9e273b11b974eb679879
Summary:
Added an experimental feature to allow to use only rounded values. See #184. It's not a perfect solution and definitely can be further improved. I'm looking forward to your ideas.
Closes https://github.com/facebook/css-layout/pull/256
Reviewed By: splhack
Differential Revision: D4214168
Pulled By: emilsjolander
fbshipit-source-id: 6293352d479b7b4dad258eb3f9e0afaa11cf7236
Summary: Correct header import paths, update podspec so we point at the copy in ReactCommon (and can eventually remove the copy under React)
Reviewed By: astreet
Differential Revision: D4204501
fbshipit-source-id: e979a010092f025b2cdc289e1e5f22fc7b65a8d1
Summary:
Corresponding Android PR: https://github.com/facebook/react-native/pull/11008
This gives apps the ability to find out the current scaling factor for fonts on the device. An event was also added so that apps can find out when this value changes.
**Test plan (required)**
Verified that the getter and the event work properly in a test app. Also, this change is used in my team's app.
Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/11010
Differential Revision: D4207620
Pulled By: ericvicenti
fbshipit-source-id: b3f6f4a412557ba97e1f5fb63446c7ff9a2ff753
Summary: Reveting the recent view clipping changes, since it doesn't work well with modals and the fix is not super simple.
Reviewed By: mmmulani
Differential Revision: D4204490
fbshipit-source-id: 510f2b04c604b3f3a223dc4accb424b030876fbe
Summary:
```isnan``` is already defined in ```math.h``` (at least when using VS13) so there is no need to redefine it. it also is a nan for float and not for double opposed to ```_isnan```
Closes https://github.com/facebook/css-layout/pull/253
Reviewed By: emilsjolander
Differential Revision: D4199331
Pulled By: splhack
fbshipit-source-id: 139fb0efd68dd5df79bbaef863a8e8b9246c795d
Summary:
Use ```size_t```instead of ```unsinged long``` as this is the "offical" return type of ```strlen```. Is VS13 ```size_t``` is defined as ```unsigned long long``` which leads to a compiler warning.
Closes https://github.com/facebook/css-layout/pull/254
Reviewed By: emilsjolander
Differential Revision: D4199327
Pulled By: splhack
fbshipit-source-id: 5e1a91f282bf776e4d9f5806e6467dfe36c7a633
Summary:
The various RCTLog macros (`RCTLogWarn`, `RCTLogError`, etc..) are based on the `_RCTLog` macro, which, in its expanded form, has a semi-colon in DEV mode (i.e., when `RCTLOG_ENABLED` is set to 1), and doesn't have one when `RCTLOG_ENABLED` is set to 0.
This could lead to a situation where code will compile in DEV but will fail to compile for prod.
Fixing this by removing the semicolon from the DEV version (as should).
Reviewed By: javache
Differential Revision: D4189133
fbshipit-source-id: 54cb4e2c96d1e48d9df88464aa58b13af432c2bd
Summary: Updates objc version to use the same CSSLayout files as the android version
Reviewed By: emilsjolander
Differential Revision: D4182821
fbshipit-source-id: 81f18184b539fe0ef76ea868bc067b8283c2cccb
Summary:
There was a bug in the view clipping logic.
Clipping works on uiview hierarchy, but I've been using `reactSuperview` to get clipping rect for my parent.
This is incorrect in a case where these two hierarchies don't match and there are some views between a view and its `reactSuperview`.
So we should really use normal `superview`. A minor complication is that `superview` is `nil` if we are clipped.
We could remember what our last `superview` was, but that's extra data we have to manage. Instead I use one clever trick to avoid doing so.
(Let me know if it makes sense based on my inline documentation.)
Reviewed By: mmmulani
Differential Revision: D4182647
fbshipit-source-id: 779cbcec0bd08eb270c3727c9c5cb9c080c4a2a4
Summary:
This broke the open source build: http://imgur.com/a/1Btd1
javache tells me reverting this line should fix it.
Reviewed By: javache, ericvicenti
Differential Revision: D4178951
fbshipit-source-id: c680de6b3b48bf137294dfe053afaff7b0613caf
Summary: Builds and ships libcsslayout.so with Android builds. This is not used yet, but a follow up diff will shortly move us from CSSNodeDEPRECATED to CSSNode (which uses libcsslayout)
Reviewed By: emilsjolander
Differential Revision: D4168140
fbshipit-source-id: d72bded88df81e4d54df31a08e4b101834770a73
Summary:
React view hierarchy doesn't have to always match uiview hierarchy. Plus if we clip view we loose knowledge about view's react superview if we just use `self.superview` as react superview.
This diff fixes it by storing a strong ref to reactSuperview in an associated object.
This is needed for new view clipping implementation (see the dependent diff).
Reviewed By: mmmulani
Differential Revision: D4081844
fbshipit-source-id: 9317d9db46fbd474382c5469b7922f88e5ee7568
Summary: The goal of this diff is to have assertion failures show up as error logs on Android. To do this, I updated the logging API to take calls with log levels. We now have to pass around va_list unfortunately since you can't re-expand or pass along var-args to a subcall.
Reviewed By: emilsjolander
Differential Revision: D4140898
fbshipit-source-id: e0eb9a1f0b08a7d90a8233f66bb857d5b871b6ad
Summary:
Solves issue #7632 where fonts with only a single font weight/type would not render.
Example of a built-in font that would not render is `Zapfino` and other custom fonts like `Impact` would not render.
Closes https://github.com/facebook/react-native/pull/10572
Differential Revision: D4143335
Pulled By: hramos
fbshipit-source-id: 2f64aad2fb5ddc7aae2ca7a5362a89b45e550e13
Summary:
The inline keyword is available only in C++. The __inline and __forceinline keywords are available in both C and C++. For compatibility with previous versions, _inline is a synonym for __inline.
https://msdn.microsoft.com/en-us/library/z8y1yy88(v=vs.120).aspx
Closes https://github.com/facebook/css-layout/pull/239
Reviewed By: astreet
Differential Revision: D4138941
Pulled By: emilsjolander
fbshipit-source-id: cb59dc91ef285e5378036c4912217fd4ec8d9f79
Summary:
Fixes#4740, where views would unnecessarily be retained after performing `navigator.pop()` - this was particularly problematic for big lists and memory-intensive custom views.
This fix causes no functional change: `_previousViews` are only used in the loop starting at line 564 to ensure that the JavaScript and Native navigation stacks are equivalent at all times. As we do in this fix, that loop limits itself to only the views expected to be on the React navigation stack. So overall this change makes the code logically 'more correct'.
Tested by checking that `_previousViews.count` is always equivalent to `previousReactCount` in the loop (which means we could remove the complex `MIN(... MIN(previousReactCount, _previousViews.count)` in the loop too, but I wanted to keep the diff as small as possible for now).
Closes https://github.com/facebook/react-native/pull/10789
Differential Revision: D4140502
Pulled By: ericvicenti
fbshipit-source-id: 4491ad3c16642914c3081295cf95c4cf36be9f94
Summary: Instead of silently ignorning non-leaf nodes with measure functions, we should assert that we don't create those kinds of trees.
Reviewed By: emilsjolander
Differential Revision: D4130770
fbshipit-source-id: a3ef10a2e63bbc12b5aa07977e4b84c8d59e3ffe
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
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
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
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
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
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
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
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