Граф коммитов

5559 Коммитов

Автор SHA1 Сообщение Дата
Ramanpreet Nara 97a4b9b691 Fix RCTNetwork podspec
Summary:
RCTNetwork files require the `MobileCoreServices` framework. This diff adds the spec to the Podfile

Changelog:
[iOS][Fixed] - Fix RCTNetwork podspec

Reviewed By: PeteTheHeat

Differential Revision: D18331084

fbshipit-source-id: 0de9e6d5e2ad2a24ba0cfdecd4a8a18419acf042
2019-11-05 19:14:39 -08:00
Emily Janzer f3b3d777ab Add view config for AndroidHorizontalScrollContentView
Summary:
Add handwritten view config for AndroidHorizontalScrollContentView. Same as RCTScrollContentView, this native component has no props of its own other than what View accepts. It's simply used as a container for the horizontal ScrollView on Android.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18284673

fbshipit-source-id: 8cd6282a3b2e5c9876da5cc0e068b12dd56acfd8
2019-11-05 19:09:03 -08:00
Emily Janzer b7fac14b64 Add view config for AndroidHorizontalScrollView
Summary:
Adding a handwritten view config for AndroidHorizontalScrollView, the native component that's used with `<ScrollView horizontal={true} />` on Android. Native props are the same as `RCTScrollView`, so I'm reusing the type for that.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18284517

fbshipit-source-id: 7c81f72440b93d611f9574ad2c01a96530d07bf7
2019-11-05 19:09:03 -08:00
Emily Janzer 1f2dc8997f Add (empty?) view config for RCTScrollContentView
Summary:
Adding a handwritten view config for RCTScrollContentView. This host component doesn't actually have any props of its own separate from View; it's just a container for a ScrollView.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18283792

fbshipit-source-id: db95e981f54bef7c068b907c5d1fa52774dad147
2019-11-05 19:09:02 -08:00
Emily Janzer da39b07298 Add handwritten view config for RCTScrollView
Summary:
Adding a handwritten view config for RCTScrollView, to be used in DEV only (for now).

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18263203

fbshipit-source-id: 975499f030c7caed9851bcde0be42c5058911ad5
2019-11-05 19:09:02 -08:00
Jordan Brown 93e58b2c96 Suppressions for 0.111
Summary:
still some generated files in www that need to land before we can release 0.111 here.

drop-conflicts

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: dsainati1

Differential Revision: D18278838

fbshipit-source-id: b20c3fefb3aab7c5fb614b33d846c7548184f49a
2019-11-05 17:36:23 -08:00
Samuel Susla 6fb5f81193 Use commands instead of setNativeProps in DatePicker
Summary:
Changelog: DatePicker now uses commands instead of `setNativeProps`

We are moving away from `setNativeProps` in favour of commands API.

Reviewed By: shergin

Differential Revision: D17787870

fbshipit-source-id: aa532cbb7bfb3031c085e5122ab808522c437901
2019-11-05 10:41:41 -08:00
Rick Hanlon 1fb815ed43 LogBox - hotfix for opening logs
Summary:
`fatalIndex` is never null, we switched it to go to -1 when it's not set

Changelog: [Internal}

Reviewed By: cpojer

Differential Revision: D18324666

fbshipit-source-id: 04d4cca9923af2a91ceec03f8314dead4681e526
2019-11-05 07:14:27 -08:00
Jorge Bernal a6fc0898de Add support for native pseudo-OS to Platform.select (#26966)
Summary:
When you write platform-specific code using [file extensions](https://facebook.github.io/react-native/docs/platform-specific-code#platform-specific-extensions), you can specify `.ios.js`, `.android.js`, or the catch-all `.native.js` when you are sharing code with a web project.

This `native` shortcut is missing for the `Platform.select` method, and this PR is adding support for that.

## Changelog

[General] [Added] - Platform.select now supports native as an option.
Pull Request resolved: https://github.com/facebook/react-native/pull/26966

Test Plan: Added relevant passing unit tests for Platform module.

Differential Revision: D18323670

Pulled By: cpojer

fbshipit-source-id: 7524c1914beab4f86041dcf8e60875380ebf7e02
2019-11-05 05:39:20 -08:00
Kevin Gozali dd06f85bd0 TM JS: cleaned up TurboModuleRegistry types [2]
Summary:
Changelog: [Internal]

Moved the imports for `TurboModuleRegistry` and `TurboModule` from `react-native`. This was a jscodeshift with the script: P120688078

Reviewed By: yungsters

Differential Revision: D18262538

fbshipit-source-id: 48fac15229c897408928511c5ecbb42f17ec7b42
2019-11-04 18:51:05 -08:00
Kevin Gozali e40aa7922e TM JS: cleaned up TurboModuleRegistry types [1]
Summary:
Changelog: [Internal]

* The original intention was to export both `get()` and `getEnforcing()` from TurboModuleRegistry.js, so define export default there
* Exposes `TurboModule` type on the top-level `'react-native'` import
* Tried this out on `NativeSegmentFetcher`

Reviewed By: yungsters

Differential Revision: D18262535

fbshipit-source-id: a46f2b8b6147531998efac8aa3b8259885224902
2019-11-04 18:51:05 -08:00
Ramanpreet Nara 6f54f00e0d Make RCTDataRequestHandler, RCTFileRequestHandler, and RCTHTTPRequestHandler TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTDataRequestHandler, RCTFileRequestHandler, and RCTHTTPRequestHandler TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18093611

fbshipit-source-id: dad4e04104a9a5fc8e70a17ef0bdf7b29bff9171
2019-11-04 16:07:25 -08:00
Ramanpreet Nara ffb8191a51 Make RCTNetworking TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTNetworking TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18087243

fbshipit-source-id: 81bbf77d603e96fa94ad219e5ed68f42bb7e7dc5
2019-11-04 16:07:25 -08:00
Ramanpreet Nara 1d315608ef Make RCTCameraRollManager TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTCameraRollManager TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18148892

fbshipit-source-id: de49e368615032b2c4de129dc55191c562cbdfbe
2019-11-04 16:07:24 -08:00
Ramanpreet Nara c29ec64d94 Implement RCTConvertOptionalVecToArray(const folly::Optional<ContainerT> &vec)
Summary:
There are two implementations of `RCTConvertVecToArray`. The first implementation:

```
template<typename ContainerT>
NSArray *RCTConvertVecToArray(const ContainerT &vec, id (^convertor)(typename ContainerT::value_type element))
{
  NSMutableArray *array = [NSMutableArray new];
  for (size_t i = 0, size = vec.size(); i < size; ++i) {
    id object = convertor(vec[i]);
    array[i] = object ?: (id)kCFNull;
  }
  return array;
}
```
The purpose of the second implementation is to default the convertor function to the identify function:
```
template<typename ContainerT>
NSArray *RCTConvertVecToArray(const ContainerT &vec)
{
  return RCTConvertVecToArray(vec, ^id(typename ContainerT::value_type element) { return element; });
}
```

Meanwhile, there's only one implementation of `RCTConvertOptionalVecToArray`:

```
template<typename ContainerT>
NSArray *RCTConvertOptionalVecToArray(const folly::Optional<ContainerT> &vec, id (^convertor)(typename ContainerT::value_type element))
{
  return vec.hasValue() ? RCTConvertVecToArray(vec.value(), convertor) : nil;
}
```

In this diff, I overload `RCTConvertOptionalVecToArray` to default the convertor to the identify function.

Changelog:

[iOS][Added] - Added RCTConvertOptionalVecToArray with default converter

Reviewed By: PeteTheHeat

Differential Revision: D18148891

fbshipit-source-id: d7d5f05cda06c9fa5374334ec4e9dbbd8b6d2eba
2019-11-04 16:07:24 -08:00
Ramanpreet Nara 7e5de4e241 Make RedBox TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RedBox TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18142255

fbshipit-source-id: 2d130aca93a88ac7c983ce0e4848955ffb0be518
2019-11-04 16:07:23 -08:00
Ramanpreet Nara fe3ae9dce8 Make RCTDevMenu and RCTDevSettings TurboModule-compatible
Summary:
Changelog:
[iOS][Added] - Make RCTDevMenu and RCTDevSettings TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18148890

fbshipit-source-id: bd4f0b2797e299cd963e34fa47044a9e1232efe0
2019-11-04 16:07:23 -08:00
Janic Duplessis 686ab49107 Don't restore default values when components unmount (#26978)
Summary:
There are some cases where restoring default values on component unmount is not desirable. For example in react-native-screens we want to keep the native view displayed after react has unmounted them. Restoring default values causes an issue there because it will change props controlled my native animated back to their default value instead of keeping whatever value they had been animated to.

Restoring default values is only needed for updates anyway, where removing a prop controlled by native animated need to be reset to its default value since react no longer tracks its value.

This splits restoring default values and disconnecting from views in 2 separate native methods, this way we can restore default values only on component update and not on unmount. This takes care of being backwards compatible for JS running with the older native code.

## Changelog

[General] [Fixed] - NativeAnimated - Don't restore default values when components unmount
Pull Request resolved: https://github.com/facebook/react-native/pull/26978

Test Plan:
- Tested in an app using react-native-screens to make sure native views that are kept after their underlying component has been unmount don't change. Also tested in RNTester animated example.

- Tested that new JS works with old native code

Reviewed By: mmmulani

Differential Revision: D18197735

Pulled By: JoshuaGross

fbshipit-source-id: 20fa0f31a3edf1bc57ccb03df9d1486aba83edc4
2019-11-04 15:40:09 -08:00
Eli White e9b4928311 TextInput: Don't do an extra round trip to native on focus/blur
Summary:
I wrote up a bunch of context for this in response to #27038 by fat. That comment is reproduced here in this commit message. You can see it in it's original contxt here: https://github.com/facebook/react-native/pull/27038

Okay, here is what I think is happening. For context, here is a diagram I have of how focus and blur propagates through the system. This might be interesting to refer back to as you go through the rest of my explanation.

![graphviz (12)](https://user-images.githubusercontent.com/249164/67992345-982c9d80-fbf9-11e9-96ea-b091210dddbe.png)

ScrollView's scrollResponder is responsible for blurring text inputs when a touch occurs in the ScrollView but outside of the currently focused TextInput. The code for that is here:
6ba2769f0f/Libraries/Components/ScrollResponder.js (L301-L314)

This happens on `scrollResponderHandleResponderRelease` aka, touch up.

It checks for what the currently focused textinput is by calling `TextInputState.currentlyFocusedField()`.

That function is a JS variable that is being updated by calls to `TextInputState.focusTextInput` and `TextInputState.blurTextInput`:

6ba2769f0f/Libraries/Components/TextInput/TextInputState.js (L36-L71)

I added some console logs to those methods to see which ones are being called when running your repro (thanks for the repro!). **This is without your fix**

Click on and off:
```
// Click on input 1
focusTextInput input1
TextInput's _onFocus called

// Click on blank space
scrollResponderHandleResponderRelease blur input1
blurTextInput input1
TextInput's _onBlur called
```

Click on input1, then input 2, then off
```
// Click on input 1
focusTextInput input1
TextInput's _onFocus called for input1

// Click on input 2
focusTextInput input2
TextInput's _onBlur called for input1
TextInput's _onFocus called for input2

// Click on blank space
scrollResponderHandleResponderRelease blur input2
blurTextInput input2
TextInput's _onBlur called for input2
```

And now for the bug. Click on input 1, tab to 2, then off
```
// Click on input 1
focusTextInput input1
TextInput's _onFocus called for input1

// Tab to input 2
TextInput's _onBlur called for input1
TextInput's _onFocus called for input2

// Click on blank space
scrollResponderHandleResponderRelease blur input1
blurTextInput input1
```

Notice how `focusTextInput` was never called with input2 in the last example. Since this is the function that sets the `currentlyFocusedField` when we click on the blank space RN is trying to blur the first input instead of the second.

# The root cause
We are tracking the state of which field is focused in JS which has to stay in sync with what native knows is focused. We [listen to _onPress](6ba2769f0f/Libraries/Components/TextInput/TextInput.js (L1103-L1107)) and call `TextInputState.focusTextInput` in that handler. However, we don't currently have anything listening to other ways for an input to become focused (like tabbing) so it doesn't end up updating the `currentlyFocusedField`.

We have the same problem with blur that we actually fixed the same way you did here in this PR:
6ba2769f0f/Libraries/Components/TextInput/TextInput.js (L1182-L1189)

If you look back at my diagram at the beginning of this post, you'll notice the missing edge from `TextInput._onFocus` to `TextInputState.focusTextInput`. That's the problem. :)

The reason this solution works is because this function **is** the notification from native that an input was focused or blurred. This solution is *fine* because this updates the `currentlyFocusedID` but isn't great because it both sets that value and **calls the native code to focus or blur again**. Luckily the native code doesn't send an event back to JS if you try to blur an already blurred TextInput otherwise we'd have an infinite loop.

# The correct solution
The correct thing would probably be to have all of this tracking in native code and not in JavaScript code. That's a pretty big change though and very out of scope. Something for our team to keep in mind for the future.

A short term term solution would be to refactor `focusTextInput` and `blurTextInput` to pull out the part that sets the `currentlyFocusedID` that we could call from `TextInput` directly from `_onFocus` and `_onBlur`.

# ^This short term term solution is what this commit is doing.

Changelog:
[General][Changed] TextInput no longer does an extra round trip to native on focus/blur

Reviewed By: RSNara

Differential Revision: D18278359

fbshipit-source-id: 417566f25075a847b0f4bac2888f92fbac934096
2019-11-04 14:42:44 -08:00
Peter Argany dfba3129f4 CoreFoundation memory management in RCTImageStoreManager
Summary:
I recently learned that CoreFoundation object lifecycle is not managed automatically by ARC.

RN appears to be leaking a few refs, this small stack of diffs cleans them up.

Changelog: [Internal][Fixed] Fixed memory management of CF objects in RCTImageStoreManager

Reviewed By: fkgozali

Differential Revision: D18308313

fbshipit-source-id: 35c1152753578825871c28e1070599cd409b3a34
2019-11-04 14:42:43 -08:00
Luna Wei 8e55e9ab1b TouchableNativeFeedback.android use codegenNativeCommands
Summary: Changelog: [Internal] Use `findHostInstance_DEPRECATED` for TouchableNativeFeedback

Reviewed By: TheSavior

Differential Revision: D18285029

fbshipit-source-id: 1c19c35e660519bee450e4fd37f18c03ec1883e0
2019-11-04 12:31:20 -08:00
Eli White 0799910705 React partial sync for 15ed22757...2cfa5ea92
Summary:
This sync includes these changes:

- **[2cfa5ea92](https://github.com/facebook/react/commit/2cfa5ea92 )**: Types: findHostInstance_DEPRECATED returns React.ElementRef<HostComponent<mixed>> (#17265) //<Eli White>//

Changelog:
[General][Changed] React partial sync for 15ed22757...2cfa5ea92

Reviewed By: lunaleaps

Differential Revision: D18302477

fbshipit-source-id: a8198ec7f39ab86aed2a1d3077187fc50d0f38e9
2019-11-04 12:22:53 -08:00
Eli White 88f64a5782 Slider: Inline default props
Summary:
Instead of defining the default props as a property on the forwardRef, we can just inline it into the destructure.

Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D18296180

fbshipit-source-id: c9e85a9869648983a01d84c36a5c581b357b427f
2019-11-04 12:16:38 -08:00
Eli White f19112f46f Tighten Slider Flow type
Summary:
Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D18295806

fbshipit-source-id: b2cb4d84bbcddbac83baaab9ea2af3e1c87150a9
2019-11-04 12:16:37 -08:00
Samuel Susla 1cfa1e6fa2 Remove -Wno-unguarded-availability from ReactInternal
Summary:
This will allow us to catch cases where we use iOS 10-only APIs on iOS 9

Changelog: [Internal]

Reviewed By: TheSavior, mmmulani

Differential Revision: D18275225

fbshipit-source-id: dc9c515415208db40750be997173ce5bd6eb494f
2019-11-04 12:03:10 -08:00
Eli White 8f6fa42503 TextInput: Remove legacy iOS implementation
Summary:
This implementation was replaced in January of 2018 by shergin. I believe everyone should have `RCTVirtualText` at this point, which should make this safe to remove.

Changelog:
[Internal][TextInput] Remove deprecated and unused legacyIOS implementation

Reviewed By: shergin

Differential Revision: D18296981

fbshipit-source-id: b5d5756e7bbc8141f1b826ab07c76a781ab03edc
2019-11-04 11:51:12 -08:00
Eli White 1804e7cbea Remove TextInput's `inputView` prop
Summary:
This if statement is older than June 2015. This prop is undocumented, not part of the flow type, not on our public docs, not in the flow type, not in typescript types, and I can't find any blog posts about it.

Changelog:
[Breaking][TextInput] Removing undocumented `inputView` prop. Use children instead.

Reviewed By: yungsters

Differential Revision: D18296894

fbshipit-source-id: 95373d24659e6f06e212095b57e8f6d713323c11
2019-11-04 11:51:12 -08:00
Peter Argany dc3b5ad275 Remove unneeded NSNotification center removeObserver
Summary:
A very common pattern I've seen in RN codebase:

     - (instancetype) init {
        [[NSNotificationCenter defaultCenter] addObserver:self ...]
      }

    - (void) dealloc {
       [[NSNotificationCenter defaultCenter] removeObserver:self ...]
     }

From Apple:

https://developer.apple.com/documentation/foundation/nsnotificationcenter/1413994-removeobserver?language=objc

> If your app targets iOS 9.0 and later or macOS 10.11 and later, you don't need to unregister an observer in its dealloc method.

RN targets iOS9+

Changelog: [Internal][Cleanup] Remove unneeded NSNotification center removeObserver

Reviewed By: shergin

Differential Revision: D18264235

fbshipit-source-id: 684e5f5555cec96b055b13cd83daaeb393f4fac9
2019-11-04 10:19:30 -08:00
Samuel Susla 56c7ae729a Migrate Picker from setNativeProps to Commands API
Summary:
We are moving away from `setNativeProps` in favour of commands API.

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D17765031

fbshipit-source-id: fcfe3fe68abb3e49e2dd7a102db598ade749acde
2019-11-04 08:29:52 -08:00
Samuel Susla 4eb8a951ff Use Switch command from JavaScript
Summary: Changelog: Switch on iOS now uses command instead of `setNativeProps`.

Reviewed By: lunaleaps

Differential Revision: D17714895

fbshipit-source-id: 0e8784fc1d0a57c563b0a4c038febdc0320af11e
2019-11-04 07:44:10 -08:00
Samuel Susla b6a23d8793 Add excludedPlatform option to CodeSchema
Summary:
Currently we generate Java ViewManager interfaces and C++ classes for iOS regardless whether the component is supported on platform or it isn't. This adds an option to exclude either iOS to Android in order to avoid this.

Changelog: In codegen it is now possible to exclude one or the other platform

Reviewed By: rickhanlonii

Differential Revision: D18217185

fbshipit-source-id: 1c569b92c92a5b991c96b0abdff6b8ed395e449f
2019-11-04 04:36:55 -08:00
Tim Yung e22946c25a Animated: Update Abstract Component Flow Type
Summary:
Updates the return type of `createAnimatedComponent` to reflect the new behavior (where we forward the ref to the internal component).

I also improved the type annotation for `Props` so that we can still enforce that only valid prop names are supplied. (We still do not check the prop values because we do not currently have a good strategy for typing the "animated versions" of those.)

Changelog:
[General] [Changed] - Flow types for Animated components now validates prop names and yields the new component instance.

Reviewed By: TheSavior

Differential Revision: D18290473

fbshipit-source-id: 8c629ab6aff009ebe6dabca1683c99a357869977
2019-11-03 18:02:00 -08:00
Tim Yung 66e72bb4e0 Animated: Forward Ref to Component
Summary:
Changes `createAnimatedComponent` so that a `ref` assigned to an Animated component will now be forwarded to the internal component. Previously, a ref to the internal component was accessed using the `getNode` method. The `getNode` method is now deprecated and will return the same `ref` but show a deprecation error.

Changelog:
[General] [Changed] - Refs on an Animated component are now the internal component. The `getNode` call has been deprecated.

Reviewed By: TheSavior

Differential Revision: D18290474

fbshipit-source-id: 5849809583a17624a89071db8be1282a12caedf3
2019-11-03 18:02:00 -08:00
Tim Yung 86d90c03eb Animated: Minor `createAnimatedComponent` Cleanup
Summary:
Some minor cleanup to `createAnimatedComponent`:

- Remove deprecated `propTypes`.
- Reorder lifecycle methods in rough order of execution.

Changelog:
[General] [Removed] - Removed `propTypes` from Animated components.

Reviewed By: TheSavior

Differential Revision: D18289773

fbshipit-source-id: f97d9ee4a2a42d210726267506de3b6b78860e8c
2019-11-03 11:59:53 -08:00
Tim Yung dcd63078bd Animated: Delete `__skipSetNativeProps_FOR_TESTS_ONLY`
Summary:
Deletes `__skipSetNativeProps_FOR_TESTS_ONLY` in favor of a `process.env_NODE_ENV` check (which will be eliminated from production builds).

Changelog:
[General] [Removed] Removed `__skipSetNativeProps_FOR_TESTS_ONLY` from Animated components.

Reviewed By: TheSavior

Differential Revision: D18289739

fbshipit-source-id: 7c1f7a29f2b88821d358227a07eec778773e418a
2019-11-03 11:59:53 -08:00
Tim Yung 25041142e5 RN: Cleanup Testing Output
Summary:
Cleans up all the Jest tests to minimize spurious console output.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D18289690

fbshipit-source-id: cdcecca879b3b85d3dccf9e0ab617ea7dc1e0777
2019-11-03 11:59:52 -08:00
Tim Yung a70987cee2 Animated: Remove `defaultProps` Parameter
Summary:
Simplifies `Animated` by removing `defaultProps` in favor of composition and a more isolated fix for scroll components.

Changelog:
[Breaking] Removed second defaultProps argument from createAnimatedComponent.

Reviewed By: TheSavior

Differential Revision: D18289648

fbshipit-source-id: 4e91c34297c3231f2bf691da74a7a624ca0b4f29
2019-11-03 11:59:52 -08:00
Tim Yung e802bd0ea9 RN: Prepare More Touchable Experiments
Summary:
Expands `TouchableWithoutFeedbackInjection` as `TouchableInjection` for use in testing out new implementations of all five `Touchable.Mixin` components.

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D18278876

fbshipit-source-id: d511bdecefe38579f03a9d5ad52011f7cd71f4c0
2019-11-02 16:56:09 -07:00
Tim Yung 654d9d07c3 RN: View Type Refinement for Events
Summary:
Adds some missing props to the type definition for `View`.

Also, changed some of the callbacks to return `mixed`. (Sometime in the near future, we should align on this for event callbacks.)

Changelog:
[Changed] Revised View Event Callback Types

Reviewed By: TheSavior

Differential Revision: D18278877

fbshipit-source-id: a36d5c1c9b9aed6718bd2abb024700a08a9deaeb
2019-11-02 16:56:09 -07:00
Rick Hanlon 5a943ec235 LogBox - Fix for buttons forcing refresh on fatals
Summary:
Fixes an issue in LogBox that allowed users to try to dismiss warnings/errors when there was a fatal or syntax error up.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18285678

fbshipit-source-id: 9d137fab63405c28b2bfa94a35c11c2f63b6d085
2019-11-01 21:42:42 -07:00
Ramanpreet Nara 38678f75b4 Fix podspecs
Summary:
I kept on running `USE_FRAMEWORKS=1 update-pods && open RNTesterPods.xcworkspace` and adding missing dependencies until `RNTesterPods` started compiling without failure.

**Note:** I made sure to only commit the podfile changes from `update-pods`, **without** `USE_FRAMEWORKS=1`.

Changelog:
[iOS][Fixed] - Fix all RN Podspecs

Reviewed By: fkgozali

Differential Revision: D18284535

fbshipit-source-id: 44d288ae0e52dd2cbbe26bebe7df73ce05644b5d
2019-11-01 19:34:46 -07:00
Rick Hanlon 62c79206ef Fast Refresh - Dismiss LogBox syntax errors
Summary:
This diff adds Fast Refresh support for dismissing LogBox syntax errors. We don't dismiss all errors because once a syntax error is fixed you'll still want to see the covered fatals, errors, and warnings.

If you actually full reload, then it falls back to the native redbox.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18278889

fbshipit-source-id: f109ca1d6c34aa3eda6e434deca66f8ce5e02ce0
2019-11-01 16:08:49 -07:00
Rick Hanlon 0825c2b2e7 LogBox - Add syntax error handling
Summary:
This diff adds handling for syntax errors.

## Strategy
To do this we introduce a new log level type syntax, giving us these levels with semantics:
- `warn` - console warns, show collapsed, dismissible
- `error` - console errors, show collapsed, dismissible
- `fatal` - thrown exceptions, show expanded, not dismissible
- `syntax` - thrown exceptions for invalid syntax, show expanded, not dismissible

Syntax errors shows expanded, covers all other errors, and are only dismissible when the syntax error is fixed and updated with Fast Refresh. Once the syntax error is fixed, it reveals any previously covered fatals, errors, or warnings behind it

In many ways, this makes syntax errors the highest level error.

## Visuals
Syntax errors also have their own display formatting. Stack traces for syntax errors don't make sense, so we don't show them. Instead, we show the syntax error message and a code frame for the error.

The code frame is also updated so that is doesn't wrap and is horizontally scrollable, making it easier to read.

## Detecting syntax errors

To detect syntax errors we've updated `LogBoxData.addException` to call the parse function `parseLogBoxException`. This method will perform a regex on the error message to detect:

- file name
- location
- error message
- codeframe

If this regex fails for any reason to find all four parts, we'll fall back to a fatal. Over time we'll update this regex to be more robust and handle more cases we've missed.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18278862

fbshipit-source-id: 59069aba38a27c44787e5248b2973c3a345c4a0a
2019-11-01 16:08:49 -07:00
Rick Hanlon eefece4be6 Hide stack frames when they're empty
Summary:
In the next diff we'll introduce syntax errors, which we don't show stackframes for since they don't make sense. This diff removes the Stack Frame section when there are no stack frames available.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18278831

fbshipit-source-id: 0a6ad5c3b7fed76123b6ad3ccfc8f3f0b044bda2
2019-11-01 16:08:49 -07:00
Rick Hanlon f6b1fa3197 Add fatal handling
Summary:
This diff adds handling to fatal errors such as thrown exceptions by popping them full screen and not allowing the user to dismiss them. They say that they're "Fatal Errors" and explain that "Fatal errors require a reload".

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18257185

fbshipit-source-id: ca051027b19c3cd2410ae59764d7b98a78f08dca
2019-11-01 16:08:48 -07:00
Samuel Susla a1c5e884ef Fix order of calls on Picker
Summary:
In previous implementation, `setNativeProps` was called before `render`. These two methods can change value of `selectedIndex` and it matters in which order they arrive in native.

This was fine in Paper because 1st selectedIndex is set from `setNativeProps` with wrong value and then correct value comes from props.

However in Fabric, 1st selectedIndex comes from props (this is the correct one), and 2nd comes from command which has the incorrect value.

changelog: [internal]

Reviewed By: TheSavior

Differential Revision: D18240118

fbshipit-source-id: dca897306d3e858b9175b2f81356c76f5a0f79e2
2019-11-01 12:11:54 -07:00
Ramanpreet Nara 7233ae4f11 Make RCTAppState TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTAppState TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18142253

fbshipit-source-id: 5bd8afa6e3ee98f92aac3b2ebdfe63b9f7afc775
2019-11-01 12:06:21 -07:00
Ramanpreet Nara dc12676e3a Make RCTStatusBarManager TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTStatusBarManager TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18130374

fbshipit-source-id: 3ec226bcff17e47ffd9eba05e32c1eb68d6135b2
2019-11-01 12:06:20 -07:00
Ramanpreet Nara a257083d2b Split NativeStatusBarManager into NativeStatusBarManager{Android,IOS}
Summary:
The `StatusBarManager` NativeModule does not have a uniform API on iOS and Android. In particular, the `setStyle` and the `setHidden` methods have an additional parameter on iOS:

```
/**
 *  - statusBarStyles can be:
 *    - 'default'
 *    - 'dark-content'
 *    - 'light-content'
 */
+setStyle: (statusBarStyle?: ?string, animated: boolean) => void;
/**
 *  - withAnimation can be: 'none' | 'fade' | 'slide'
 */
+setHidden: (hidden: boolean, withAnimation: string) => void;
```

If we keep the NativeModule spec the same between the two platforms, we'd have to keep the second parameter optional for both methods. This works for `setHidden`, because the second parameter is a string, and optional strings are allowed. However, for `setStyle`, the second parameter is a number, and we don't support optional numbers/booleans on Android in the NativeModule system. If we keep the optional number, then the following check triggers in our RedBox tests on iOS, which makes them fail: https://fburl.com/diffusion/b7adezd9.

So, since the two specs are sufficiently different, I figured that the easiest path forward is to split them apart.

Changelog:
[iOS][Changed] - Separated NativeStatusBarManager into NativeStatusBarManager{IOS,Android}

Reviewed By: PeteTheHeat

Differential Revision: D18214161

fbshipit-source-id: 6fd8b8c5f576244b5b90ee47faa7f50508c5e1d3
2019-11-01 12:06:20 -07:00
Tim Yung 548aad4ff1 RN: Delete Apple TV Props
Summary:
With tvOS (Apple TV) now residing in a separately maintained fork, this removes the residual props from React Native. This only includes the JavaScript changes. The Objective-C changes will come later.

Specifically, the following props have been removed:

- `isTVSelectable`
- `tvParallaxProperties`
- `tvParallaxShiftDistanceX`
- `tvParallaxShiftDistanceY`
- `tvParallaxTiltAngle`
- `tvParallaxMagnification`

Note that `hasTVPreferredFocus` is still being used by Android TV, so it remains.

Changelog:
[Removed] Apple TV View Props

Reviewed By: TheSavior

Differential Revision: D18266278

fbshipit-source-id: 9d1448bf2f434a74e6eb23c70d3a37971e406768
2019-11-01 08:49:26 -07:00