Commit Graph

1561 Commits

Author SHA1 Message Date
Valentin Shergin ca6e0b37cf `reactRespondsToTouch:` was removed
Summary:
* It complicates Touch Handling mechanism.
* The same functionality can be (and should be) implemented via overriding standard `hitTest:` method.
* It was marked as deprecated a while ago.

Reviewed By: mmmulani

Differential Revision: D4667776

fbshipit-source-id: 2e047c3308563a2849ea351a242270f0800fead2
2017-04-10 12:32:31 -07:00
Pieter De Baets 2336ac299c Improve constant extraction from RCTNativeModule
Reviewed By: dcaspi

Differential Revision: D4829671

fbshipit-source-id: 6b1cef1d31c7d8981c6f1e304d3742e885f8a83b
2017-04-08 15:18:08 -07:00
Pieter De Baets f3dfd616f4 Allow lazy Cxx modules to not initialize
Reviewed By: mhorowitz

Differential Revision: D4851596

fbshipit-source-id: cf5f5c51b9aaa0da96f7ab6fba1277b72c988400
2017-04-08 15:18:08 -07:00
Pieter De Baets 5767b98f4d Add JSC utility header to RCTBridge
Reviewed By: shergin

Differential Revision: D4823509

fbshipit-source-id: 79c96d3bc183d89a5dec7da06b0a0a710d8c7dea
2017-04-07 11:16:59 -07:00
Pieter De Baets 76b93e1253 Add block-based initializer for RCTModuleData
Reviewed By: shergin

Differential Revision: D4821772

fbshipit-source-id: 2cd35ec6726b6fe1494a92966ade5aa0b86e769b
2017-04-07 11:16:59 -07:00
Ben Roth 540f4c9638 Fix crash in `RCTRedBox::formatFrameSource:`
Summary:
Motivation: Similar to https://github.com/facebook/react-native/pull/13242 - the application will crash with `[NSNull lastPathComponent]: unrecognized selector sent to instance` if a stack frame with no filename makes it to RCTRedBox.
Closes https://github.com/facebook/react-native/pull/13360

Differential Revision: D4848980

Pulled By: javache

fbshipit-source-id: dc506f2ba39c2d4d68982b56a6e765a19dc048b0
2017-04-07 11:03:56 -07:00
Pieter De Baets ceac54ebe9 Use forward declaration in RCTCxxModule
Reviewed By: mhorowitz

Differential Revision: D4821449

fbshipit-source-id: 8e75a7b17e0986bc9416a0afde0d7dfa179d4fed
2017-04-07 09:30:33 -07:00
Pieter De Baets b2647ea335 Allow ModuleRegistry initialization to complete lazily
Reviewed By: mhorowitz

Differential Revision: D4794794

fbshipit-source-id: f3b7a5d02587b4cd4e214aa6b0368a0d214fb63f
2017-04-07 09:30:33 -07:00
Shruti Malugu 39eb090906 Fixing another iOS app extension unsafe API usage in react native
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [yes] Explain the **motivation** for making this change.
    Using react-native library inside iOS app extension causes a compile error inside react native stating that usage of UIAlertView is not allowed inside iOS app extension and should use UIAlertController instead. I have updated the code to use UIAlertController based on the other instances of the UIAlertController usage in the react-native library

- [ partial ] Provide a **test plan** demonstrating that the code is solid.
This code should be launched when developers start the profiler from the React native debug menu. I am currently in process of upgrading my app from 0.34 to the latest react native ( aka app not in working state). Would appreciate if there is an alternative way for me to test this functionality out.

Just tried to create a new react-native project using "react-native init testproject" and upon running "react-native run-ios", I  hit the following error a
Closes https://github.com/facebook/react-native/pull/13328

Differential Revision: D4844559

Pulled By: javache

fbshipit-source-id: e516ca57cb2abf2b09aa53abecb0fe60a40190b4
2017-04-06 12:30:55 -07:00
Alex Dvornikov b3872e807d Check that RCTDidInitializeModuleNotification is being called with the correct bridge
Reviewed By: javache

Differential Revision: D4800110

fbshipit-source-id: acc8bc512ed17a84abeac74afb91db51ab4c5043
2017-04-06 00:46:05 -07:00
Alex Dvornikov 37c1678421 Report JS errors in debug console
Reviewed By: javache

Differential Revision: D4835405

fbshipit-source-id: d10658d1b885048ea3495388450208bb0e29ee5b
2017-04-05 19:51:03 -07:00
Pieter De Baets ff95805657 Fix YGEnums references in ReactCxx.xcodeproj
Summary:
cc ericvicenti
Closes https://github.com/facebook/react-native/pull/13301

Differential Revision: D4830381

Pulled By: ericvicenti

fbshipit-source-id: 866864ac34f6c873c1646e59cd0245b3f6634d7e
2017-04-04 15:40:04 -07:00
Douglas Lowder 6a81de37d4 Add YGEnums to tvOS build
Summary:
**Motivation** Fix the Apple TV build, which is broken after a recent commit.

**Test plan** Travis tvOS test script should succeed.
Closes https://github.com/facebook/react-native/pull/13284

Differential Revision: D4827053

Pulled By: ericvicenti

fbshipit-source-id: 380e8f1b32adfeea844bedc11326e5a6a755066a
2017-04-04 10:00:36 -07:00
Pieter De Baets e0bd35f76f Fix order of timers called in the same frame
Reviewed By: mmmulani

Differential Revision: D4802858

fbshipit-source-id: 8d8400c20b7e487aea5a0943f91ac7adc2d23108
2017-04-03 18:48:48 -07:00
Valentin Shergin bc1ea548d0 Better TextInput: Simplified focus/first-responder management on iOS
Summary:
Pair `reactWillMakeFirstResponder` and `reactDidMakeFirstResponder` was replaced with just `reactFocus` method
which is supposed to incapsulate all "focus" and "focus-later-if-needed" functionality.

Reviewed By: mmmulani

Differential Revision: D4664626

fbshipit-source-id: 8d3b7935ca26d32ba1d1826a585cce0396fcc885
2017-04-03 15:16:16 -07:00
Emil Sjolander beb559d9cf Fix xcode project file
Reviewed By: ericvicenti

Differential Revision: D4821749

fbshipit-source-id: 19730209557c58457e6cc67916e9a8cb944fb963
2017-04-03 14:33:52 -07:00
Shruti Malugu edbb48c67a Replacing all instances of [UIApplication sharedApplication] wi…
Summary:
…th RCTSharedApplication()

Thanks for submitting a PR! Please read these instructions carefully:

- [ ] Explain the **motivation** for making this change.
          Using React Native latest version with Cocoapods 1.2.0 causes the following error inside iOS app extensions

> /react-native/React/Modules/RCTAccessibilityManager.m:67:70: ‘sharedApplication’ is unavailable: not available on iOS (App Extension) — Use view controller based solutions where appropriate instead.

Moving the use of [UIApplication sharedApplication] to RCTSharedApplication() which is safe on app extension

- [ ] Provide a **test plan** demonstrating that the code is solid.
        I am not sure how to test such that all the features which touch the modified code are tested.

- [ ] Match the **code formatting** of the rest of the codebase.
- [ ] Target the `master` branch, NOT a "stable" branch.

What existing problem does the pull request solve?
    Using React Native latest v
Closes https://github.com/facebook/react-native/pull/13227

Differential Revision: D4816338

Pulled By: javache

fbshipit-source-id: e3e3c77882990ad1817b0b633521cff52571ecd0
2017-04-01 03:34:41 -07:00
Ben Roth 9075fe0618 Fix crash in `RCTJSStackFrame::stackFrameWithDictionary:`
Summary:
Motivation: When logging to RCTRedBox, if any of the stack frames lacks a line number or a column, the application will crash with `[NSNull integerValue]: unrecognized selector sent to instance`.
Closes https://github.com/facebook/react-native/pull/13242

Differential Revision: D4812185

Pulled By: hramos

fbshipit-source-id: 4b1c3c38f67cf59034a383c95d4280d1b6380300
2017-03-31 13:32:47 -07:00
Pieter De Baets e12e57eb77 Move bindKeys to RCTBridge setUp
Reviewed By: shergin

Differential Revision: D4794788

fbshipit-source-id: 0839829f4ed010bf2fb2574092a8f68f4c95341a
2017-03-31 05:31:26 -07:00
Pieter De Baets f6754348be Merge RCTPlatform.isTesting and RCTRunningInTestEnvironment
Reviewed By: fkgozali

Differential Revision: D4802834

fbshipit-source-id: 76bb98877f2fc427c01806b192d8dc71489a1c4a
2017-03-30 10:02:35 -07:00
Pieter De Baets 5af30382d5 Improve fbsystrace support
Reviewed By: mhorowitz

Differential Revision: D4756318

fbshipit-source-id: 7811f680a7ad044b5ae028ee9b2fed5f46ce2a63
2017-03-30 06:53:16 -07:00
Ben Alpert 1d367004e9 Improve feel of scroll snapping behavior on iOS
Reviewed By: sahrens, shergin

Differential Revision: D4768384

fbshipit-source-id: 6319d058292be6ba38c059d8d1a1bf70bac603e2
2017-03-29 07:16:01 -07:00
Janic Duplessis ec5baf02bd Fix cxx bridge headers when archiving
Summary:
There were some headers that were in the `public` or `private` section instead of `project` this causes headers to be included in archives and prevent it from being able to be uploaded to the app store. This fixes it by using only `project` headers and copy files like we use in other places.

Also fixes a file that was moved and not updated in ReactCxx.xcodeproj.

**Test plan**
Tested that I am now able to upload an archive on the app store.
Closes https://github.com/facebook/react-native/pull/13008

Differential Revision: D4779894

Pulled By: javache

fbshipit-source-id: 6e36e925cc3fc03c095c9f1872eb5a45b7f0d78c
2017-03-28 06:45:56 -07:00
Janic Duplessis c9fae2fb93 Native Animated - Restore default values when removing props on iOS
Summary:
This fixes a bug that causes properties to keep stale values because they were not restored to their default after being removed when their value was controlled by native animated.

To fix this we restore default values in `disconnectFromView` by updating views with null values for all props that we modified previously. However this causes another issue where we lose any props that were set by the normal process because NativeAnimated operations are always executed after UIManager operatations. To fix this I added a way to hook into UIManager view updating process to be able to execute NativeAnimated operations either before or after updating native views.

In the case of disconnecting we want to do it before updating views so that it does: Value changed by native animated -> value restored to default -> (optional) value updated by normal prop.

This PR also depends on #10658.

**Test plan**
Tested that this fixed a particular bug in an app that uses ex-navigation + native animations where a navbar w
Closes https://github.com/facebook/react-native/pull/11819

Differential Revision: D4752566

Pulled By: javache

fbshipit-source-id: 68ee28200ffeba859ae1b98ac753bd7dcb8910f0
2017-03-28 05:33:02 -07:00
Sokovikov c87c4d052f Fixed previously broken support for negative `scale` (`transform` style property)
Summary:
closes #13081

UIExplorer, TransformExample
Closes https://github.com/facebook/react-native/pull/13083

Reviewed By: mmmulani

Differential Revision: D4758237

Pulled By: shergin

fbshipit-source-id: 58385a4cde7a739b6657c293c381644a92918265
2017-03-24 18:15:42 -07:00
Pieter De Baets 7c9173bc9e Enable -Wimplicit-retain-self en sync warning config for all projects
Summary:
This is enforced for all of our internal iOS code and a common cause of import failures.

cc janicduplessis
Closes https://github.com/facebook/react-native/pull/13124

Differential Revision: D4765016

fbshipit-source-id: 7c8248c98bca0fa6bad24d5a52b666243375e0db
2017-03-23 15:01:34 -07:00
Pieter De Baets 9d377e98a0 Fix warnings in React.xcodeproj
Summary:
Various fixes of xcode projects and cleaning up some warnings
Closes https://github.com/facebook/react-native/pull/13109

Differential Revision: D4762652

Pulled By: lacker

fbshipit-source-id: b452976a58962439de4adecc8e703264af40cb38
2017-03-23 11:36:17 -07:00
Pieter De Baets 0ea1ea5fb7 Remove unused websocket-executor-name and websocket-executor-port options
Reviewed By: davidaurelio

Differential Revision: D4745529

fbshipit-source-id: 2c69aca33c999ccf2af8dbf8d9af2c1d123b59cd
2017-03-22 05:38:04 -07:00
Marc Horowitz ba149d7277 Tease apart React and RCTBatchedBridge targets
Reviewed By: javache

Differential Revision: D4679655

fbshipit-source-id: 8123488c2d50dd7cc2329b5131e99998fe1f1e2f
2017-03-21 18:31:23 -07:00
Marc Horowitz d9ac00735c Make the choice of bridge based on an optional delegate method
Reviewed By: javache

Differential Revision: D4679644

fbshipit-source-id: f53e554e283fdb0b59c41623e690fd1a21e03a57
2017-03-21 18:31:23 -07:00
Pieter De Baets 314ec87269 Remove unused CxxMessageQueue
Differential Revision: D4713064

fbshipit-source-id: 511b782279b89076228f00290e78ed155e2e723e
2017-03-21 12:46:27 -07:00
Ben Roth b3be5743e9 Fix property accessor warning in RCTDevSettings::websocketExecutorName
Summary:
Motivation: Fixes Xcode warning `Ivar '_websocketExecutorName' which backs the property is not referenced in this property's accessor` which shows up because this property has no setter (and is never set anywhere).
Closes https://github.com/facebook/react-native/pull/12639

Differential Revision: D4745437

Pulled By: javache

fbshipit-source-id: 3ab4b0df62f90adc2b62d891197dc783e07da4e3
2017-03-21 04:20:02 -07:00
Daniele Conti 08c404d293 Eagerly change the listeners count
Summary:
While working with `RCTEventEmitter` I noticed that if an event is emitted before `_listenerCount` is updated, it will not go through because the listeners count hasn't been updated. Moving the count update before the invokation of `startObserving` and `stopObserving` fixes the issue. Same way if you remove the last listener and an event is fired before the count is updated (while it shouldn't be fired).

**Test plan (required)**

An easy test to demonstrate it is to implement `startObserving` to synchronously fire an event. Without the change, a warning is thrown, with the change, the event is fired. Not very strong on Obj-C here and I didn't know how to mock out the native stuff. Would be glad to write a failing unit test tho :)
Closes https://github.com/facebook/react-native/pull/11907

Differential Revision: D4738965

Pulled By: javache

fbshipit-source-id: cf175051be5b9c5de761d3dcd290560e1639b05e
2017-03-20 12:49:00 -07:00
Jhen f352aa129a Add missing `toggleElementInspector` event send when `jsLoaded`
Summary:
- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

The PR #11613 (0.43) removed this missing `toggleElementInspector` event send when `jsLoaded` in DevMenu (Now is DevSettings), it should open the inspector if `isElementInspectorShown` is true when we reload JS.

The dev menu text `Show / Hide Inspector` is dependent on `isElementInspectorShown` bool value.

([This behavior in 0.42](https://github.com/facebook/react-native/blob/0.42-stable/React/Modules/RCTDevMenu.mm#L436-L442))

Manual testing in UIExplorer:

* Open the dev menu and click `Show Inspector`
* Open the dev menu and click `Reload JS`
* The built-in inspector should keep open (dev menu text: `Hide Inspector`)
Closes https://github.com/facebook/react-native/pull/12999

Differential Revision: D4738959

Pulled By: javache

fbshipit-source-id: b3f584db51aa0e1b463c52003967b00bcd81bc99
2017-03-20 12:49:00 -07:00
Jeff Thomas 439889262c RCTLocalAssetImageLoader: Add searching shipped frameworks beyond mainBundle
Reviewed By: javache

Differential Revision: D4715608

fbshipit-source-id: 5cb2febf543e2ff6e30d0c6d8737de9a2cce2383
2017-03-20 12:00:44 -07:00
Valentin Shergin b53d76efb7 Better TextInput: RCTUITextView was decoupled in separate file and now handles placeholder feature
Reviewed By: mmmulani

Differential Revision: D4663151

fbshipit-source-id: ce57ca4bebf4676df2ae5e586a1b175ec2aac760
2017-03-20 00:02:58 -07:00
Valentin Shergin 1b013cd30c Better TextInput: Fixing multiline <TextInput> insets and prepare for auto-expanding feature
Summary:
Several things:
 * The mess with insets was fixed. Previously we tried to compensate the insets difference with `UITextField` by adjusting `textContainerInset` property, moreover we delegated negative part of this compensation to the view inset. That was terrible because it breaks `contentSize` computation, complicates whole insets consept, complicates everything; it just was not right. Now we are fixing the top and left inset differences in different places. We disable left and right 5pt margin by setting `_textView.textContainer.lineFragmentPadding = 0` and we introduce top 5px inset as a DEFAULT value for top inset for common multiline <TextInput> (this value can be easilly overwritten in Javascript).
 * Internal layout and contentSize computations were unified and simplified.
 * Now we report `intrinsicContentSize` value to Yoga, one step before auto-expandable TextInput.

Depends on D4640207.

Reviewed By: mmmulani

Differential Revision: D4645921

fbshipit-source-id: da5988ebac50be967caecd71e780c014f6eb257a
2017-03-20 00:02:55 -07:00
Valentin Shergin d272334186 RCTRootView is now has empty autoresizing mask by default
Summary: `autoresizingMask` is supposed to be set outside self class, this is UIKit convention.

Reviewed By: mmmulani

Differential Revision: D4697098

fbshipit-source-id: 7e0aa5d3032184de980b3cecafebbc4ce8ef9ada
2017-03-19 22:01:56 -07:00
Valentin Shergin 64c327ae68 Fixed issue where setting `zero scale` transfrom matrix to UIView brokes `hitTest` mechanism
Summary:
The Math Strikes Back

Several related things:
 * When we specify `scale: 0;` style for some view it ends up with calling `CATransform3DScale` with zero scale parameter.
 * In this case `CATransform3DScale` returns transform matrix full of zeros. It actually depends on representation and matrix-type (2d or 3d) but in UIView debugger it appears as [0, 0, 0, 0, ...]. And probably it is correct result.
 * By default, for hit-testing, UIKit uses specially optimized logic based on GPU/CALayer infrastructure under the hood. And the transform matrix full of zeros breaks this algorithm. I guess, it happens because zero-matrix doesn't quite make sense.

So, `scale: 0;` is a weird edge case, and in this diff, we are trying to illuminate it by replacing with epsilon value.

Related SO issues:
http://stackoverflow.com/questions/25964224/cgaffinetransformscale-not-working-with-zero-scale
http://stackoverflow.com/questions/7937369/animate-uiview-scale-to-zero

Reviewed By: blairvanderhoof

Differential Revision: D4734475

fbshipit-source-id: 7241cdffa86c05a6552860a25789e2281588ba23
2017-03-19 22:01:55 -07:00
Ashwin Bharambe f48b54bf62 Expose RCTImageLocalAssetURL as a utility
Reviewed By: javache

Differential Revision: D4696627

fbshipit-source-id: 56d3e59983f524dfd5021835734b9b34203e20f2
2017-03-17 17:02:06 -07:00
Ashwin Bharambe 95c1926193 Introduce `DeviceInfo` as a new native module
Summary:
The `UIManager` already has a lot of responsibilities and is deeply
tied with React Native's view architecture. This diff separates out a
`DeviceInfo` native module to provide information about screen dimensions and
font scale, etc.

Reviewed By: fkgozali

Differential Revision: D4713834

fbshipit-source-id: f2ee93acf876a4221c29a8c731f5abeffbb97974
2017-03-17 17:01:57 -07:00
Pieter De Baets ce270220e4 Extract module registry creation to helper
Reviewed By: mhorowitz

Differential Revision: D4721817

fbshipit-source-id: 2fa17ca5317a57d429aa75d6c1865932af27e02f
2017-03-17 07:08:14 -07:00
Pieter De Baets ea069b69de Make Cxx modules lazy on iOS
Reviewed By: mhorowitz

Differential Revision: D4716040

fbshipit-source-id: 08cc1317e15f0b3bd1df6d76c483a560f5c43d53
2017-03-17 07:08:14 -07:00
Pieter De Baets 73e81b87d3 Remove unused onNativeException delegate method
Reviewed By: mhorowitz

Differential Revision: D4597914

fbshipit-source-id: 82a109d1e6d8b0c93380840c22ec74dc75ab1a45
2017-03-17 07:08:14 -07:00
Pieter De Baets d7b37c4050 Remove JsToNativeBridge's nativeQueue
Reviewed By: mhorowitz

Differential Revision: D4589737

fbshipit-source-id: 3b2730417d99c4f98cfaad386bc50328f2551592
2017-03-17 07:08:14 -07:00
Jakub Woyke b8cc75c613 Don't call libc malloc and free directly from assembly
Reviewed By: strager, javache

Differential Revision: D4484300

fbshipit-source-id: 97b9c2e9525f38c9158cfb499ba93d1af7d84b69
2017-03-16 12:34:06 -07:00
Ashok Menon d5dda1b136 Adding in missing wrapper invocation.
Reviewed By: javache

Differential Revision: D4714260

fbshipit-source-id: 641dfd07e8161bedf31cfd4cf94b1dc64beec0f9
2017-03-15 18:30:20 -07:00
ShiHui 1195a8f3e6 Fix RCTPicker crash
Summary:
If user slide picker when picker item is zero, `UIPickerViewDelegate` will call `pickerView:didSelectRow:inComponent` row=0, `_items[row][@"value"]` will crash.
Closes https://github.com/facebook/react-native/pull/12187

Differential Revision: D4709882

Pulled By: mkonicek

fbshipit-source-id: 772c819d4eaef41ac983287877bda2918f40b1a7
2017-03-14 17:46:24 -07:00
Janic Duplessis 22151d28d4 Fix ReactCxx xcodeproj
Summary:
The ReactCxx project was not updated when RCTMap was removed in 48f30eca7e, this fixes it. It was also missing the systemJSCWrapper.cpp file.

**Test plan**
Tested that UIExplorerCxx now builds

cc mkonicek
Closes https://github.com/facebook/react-native/pull/12919

Differential Revision: D4709498

Pulled By: mkonicek

fbshipit-source-id: 995a1a914ab0a3227b1219c575a84d136800ff19
2017-03-14 16:46:00 -07:00
Marc Horowitz e622d51e20 Support ModuleHolder-based lazy init of C++ modules with C++ bridge on android
Reviewed By: AaaChiuuu

Differential Revision: D4614479

fbshipit-source-id: 109ac34b8688f0113675e4a4479d1ddcc6169ed4
2017-03-14 15:35:01 -07:00