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

21435 Коммитов

Автор SHA1 Сообщение Дата
Peter Argany 251d5e1bbe Fabric Picker onChange event
Summary:
Implements `onChange` prop for `<Picker/>`.

Changelog: [iOS][Fabric] Fabric Picker support

Reviewed By: sammy-SC

Differential Revision: D23975689

fbshipit-source-id: 7aa81c203d420a8971e4309911a41ecfd377a318
2020-10-13 11:19:29 -07:00
Peter Argany c2e7ac1b35 Fabric picker item parsing
Summary:
This builds on previous diff to properly parse `<Picker.Item/>` into a cpp struct.

This fixes the dummy text and text color TODOs.

Changelog: [iOS][Fabric] Fabric Picker support

Reviewed By: sammy-SC

Differential Revision: D23964557

fbshipit-source-id: f42c6c9cf410bfc5e66ff078645b6378548481de
2020-10-13 11:19:29 -07:00
Peter Argany 38cb06cbd3 Initial commit for Fabric Picker
Summary:
This is a starting point for the handwritten Fabric Picker component. It is incomplete, and needs to be landed with the rest of the stack above it.

In general, this creates a new `ComponentView`, `ComponentDescriptor`, `ShadowNode`, `Props` and a few other boilerplate classes for Picker. A bunch of the logic in `ComponentView` was copied over from the Paper `RCTPicker` and `RCTPickerManager`.

What works in this diff:
- A `<Picker>` with items can be created in JS, and a corresponding `UIPicker` is created in native with placeholder text, default styling and the correct amount of items

What doesn't work yet (implemented in later diffs):
- Parsing items to use correct text and styling in native
- Events/commands

Reviewed By: sammy-SC

Differential Revision: D23941821

fbshipit-source-id: e049ca6004757fbd1361985644d5dbb8f53e1ce6
2020-10-13 11:19:29 -07:00
Joshua Gross 71bb19827b NativeAnimatedModule: fix crash that can occur when animated node setup races with NativeAnimatedModule setup
Summary:
When switching between non-Fabric and Fabric screens, I believe that `initializeEventListenerForUIManagerType` is not always being called on the NativeAnimatedNodesManager if
`NativeAnimatedModule.initializeLifecycleEventListenersForViewTag` is being called before the NativeAnimatedNodesManager ivar has been set. This should occur very infrequently, but logs
indicate that it /does/ happen in some marginal cases. Protecting against these cases should be trivial, by using the `getNodesManager` method which is responsible for returning a nodes manager or creating a new one.

The existing uses of the `NativeAnimatedNodesManager` ivar also occur on different threads and we were not protecting against this, so I'm changing it to an atomic. It's very likely that
the inconsistency issues in the past were caused not by ordering errors, but thread races.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24267118

fbshipit-source-id: 68abbff7ef3d0b2ecc9aa9977165663ad9447ab8
2020-10-12 22:53:40 -07:00
Nick Gerleman 4d247fe058 Avoid Repo Structure Assumptions in RNTester Imports (#30141)
Summary:
RNTester has some imports left over that operate on directory traversal, assuming it is contained within react-native sources. This change makes these imports relative to react-native, enabling usage outside of the RN repo.

Relates to https://github.com/microsoft/react-native-windows/issues/6210

## Changelog

[Internal] [Fixed] - Avoid File Structure Assumptions in RNTester Imports

Pull Request resolved: https://github.com/facebook/react-native/pull/30141

Test Plan: Validated we can bundle and flow-check both iOS + Android

Reviewed By: cpojer

Differential Revision: D24259628

Pulled By: appden

fbshipit-source-id: 0c21b5d354b01785d8402599da3b0a5be81b4c6d
2020-10-12 19:56:09 -07:00
Peter Argany 760c10a5aa Fix new RCTDeviceInfo assert to work in bridgeless mode
Summary:
shergin added a new assert to dimensions calculations in D24038911 (e853722981). This crashes in bridgeless mode b/c no bridge.

 This diff uses `turboModuleRegistry` as a bridge workaround.  The registry is a [weak property](https://www.fburl.com/diffusion/sunv3bx9) so retain cycles shouldn't be an issue here, let me know if that's incorrect.

As a nice bonus, this fixes dynamic font sizing in bridgeless mode. It was broken before since it relied on the bridge.

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D24256338

fbshipit-source-id: 141d36239ac6a6e9e87ca96eea7aeec56729095d
2020-10-12 12:49:29 -07:00
simek b7167c23fc PlatformColors: add missing clearColor for iOS (#30054)
Summary:
This small PR adds missing [`clearColor`](https://developer.apple.com/documentation/uikit/uicolor/1621945-clearcolor?language=objc) to the avaiable PlatformColors on iOS.

**Please let me know** if you would like to see ["Fixed colors"](https://developer.apple.com/documentation/uikit/uicolor/standard_colors?language=objc) added to the `PlatformColors`. I can address this within this PR or create a separate one.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Added] - PlatformColors: add missing `clearColor`

Pull Request resolved: https://github.com/facebook/react-native/pull/30054

Test Plan:
[(I had to disable the Dark Mode to fix the RNTester readability problems)](https://user-images.githubusercontent.com/719641/94453196-b35cb000-01b0-11eb-8d7d-73d48ceecf53.PNG)

Transparent/clear color has been added to the RNTester PlatformColors API example:
![IMG_6782](https://user-images.githubusercontent.com/719641/94453172-ae97fc00-01b0-11eb-9bef-1a1a387ac009.PNG)

Reviewed By: shergin

Differential Revision: D24241160

Pulled By: sammy-SC

fbshipit-source-id: 41fb51677329cc3b3f915d5d08694c07b4ef2cf3
2020-10-12 02:14:42 -07:00
Samuel Susla eb7701c1ec Search for Fabric managed view when creating Touch
Summary:
Changelog: [Internal]

If `uiTouch.view` isn't managed by Fabric, go up the view hierarchy to find first view that is.

This is important for host views wrapped by <Touchable>, otherwise touches are not delivered to the component.

Reviewed By: yungsters

Differential Revision: D24219223

fbshipit-source-id: 17b4e3460735371553ee0d30b41776a977f8eafb
2020-10-12 01:59:49 -07:00
Mark Sinkovics 748aa13747 fix: crash when insert nil value into a dictionary (#30066)
Summary:
This PR attempts to fix issue https://github.com/facebook/react-native/issues/28278 and https://github.com/facebook/react-native/issues/29525

On Crashlytics, the following error occurs in file `RCTWebSocketModule.m` at method `-[RCTWebSocketModule webSocket:didFailWithError:]` when a nil value is inserted into a dictionary as a value.

```
Fatal Exception: NSInvalidArgumentException
*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
```

This PR is following the suggestion of this: https://github.com/facebook/react-native/issues/28278#issuecomment-597461650 and it replaces the values of any property if it is nil. In detail:
- it converts `error` to empty NSString if the original value is nil
- it converts `socketID` to a NSNumber object, which stores `-1` if the original value is nil

## Changelog

[iOS] [Fixed] - A crash in WebSocket module

Pull Request resolved: https://github.com/facebook/react-native/pull/30066

Test Plan: We were not able to reproduce the crash, but the report itself provided enough information to find a solution for this issue.

Reviewed By: shergin

Differential Revision: D24241147

Pulled By: sammy-SC

fbshipit-source-id: d5d632b49ca77b5d8be8b9c32358bef68f17d30a
2020-10-12 01:47:49 -07:00
Janic Duplessis 6685aba462 Update template to xcode 12 (#30150)
Summary:
This makes a few change to the template xcodeproj

- Update to recommended settings for Xcode 12
- Remove the main.jsbundle file that doesn't exists, this file is included automatically in the app bundle and doesn't need to be in xcode (it won't even be at that path).
- Add -e to the bundle images script. It seems like Xcode doesn't fail the build on script errors anymore so this makes it so the build stop. If it doesn't stop the app will launch and crash because the bundle doesn't exist (note this is only if running the app in release mode since in debug we don't generate the bundle).

## Changelog

[iOS] [Added] - Update template to xcode 12

Pull Request resolved: https://github.com/facebook/react-native/pull/30150

Test Plan: Made the same changes in an app and made sure it ran well.

Reviewed By: cpojer

Differential Revision: D24237481

Pulled By: sammy-SC

fbshipit-source-id: 2b06a24c510c423eb45a1a840ea365b64506321b
2020-10-12 01:28:32 -07:00
Riley Dulin d8b0e9d9ab Add HeapProfiler.lastSeenObjectId and HeapProfiler.heapStatsUpdate to inspector
Summary:
When taking a heap timeline, Hermes wasn't showing any data until the timeline
was written to disk and then reloaded.

Turns out we were missing support for two events:
* `HeapProfiler.lastSeenObjectId`: This event reports the most recently
allocated object ID. Used to know when objects were allocated in the
timeline.
* `HeapProfiler.heapStatsUpdate`: Report how many objects and bytes
exist for a "time fragment", represented by a fragment index. Later updates
to the same index can decrease the amount of live memory, which show up
as grey spikes instead of blue spikes

Previously, we only supported these by writing out to a file, and they didn't work
with a "live" profiling view. To fix this, I changed the periodic sampling thread
to instead be a periodic flush of a sample every few allocations. The performance
impact is tucked away only when profiling is turned on, and it's very non-invasive to
the rest of the GC. The flush calls a callback with the relevant information if the
inspector is on, and the inspector sends a message back to the browser.

Changelog: [Internal] Fix for Hermes heap timeline profiling

Reviewed By: neildhar

Differential Revision: D23993363

fbshipit-source-id: 8e0b571130cbb7e839dfb009b04f584f5179085d
2020-10-10 13:26:13 -07:00
Ramanpreet Nara 9a7f2b590e Log QPL Events from TM + NM, when Perf. Logging is enabled
Summary:
## Previously
- When TurboModules system was on, we'd only log events from the TurboModules system.
- When TurboModules system was off, we'd only log events from the NativeModule system.

This ultimately gives us less data to analyze both systems in production.

## Changes in This Diff
When perf. logging is on, we'll log events from both systems. Each QPL event now include an annotation of which system the event is coming from. Concretely, this will allow us to see how much of the NativeModule system is being exercised in the TurboModule test group.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D24232594

fbshipit-source-id: 7dff57bd74fc7ef744d3e06ff174304f25790456
2020-10-10 02:51:59 -07:00
Luna Wei f9dec99284 Introduce multi-flush logger
Summary:
Changelog:
[Internal][Changed] - export types of performance logger

Reviewed By: rubennorte

Differential Revision: D24099293

fbshipit-source-id: 023459baa3754fb8bfaf6bf7a9061873af5756f9
2020-10-10 02:06:06 -07:00
Joshua Gross f40cdcdfe7 LayoutAnimations: remove "ConsecutiveMetadata" adjustment concept, adjust immediate and delayed mutation indices at the same time
Summary:
Index adjustment is tricky. Seems more reliable to adjust each immediate mutation, and then immediately adjust delayed mutations based on it, rinse and repeat.

Previously it was possible to construct examples where the UI would get into a weird state because index adjustment caused items to be inserted in the wrong location.

Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D24232926

fbshipit-source-id: f8c445213528c2d2aedacf3e0c73c5bbeb62bc3d
2020-10-09 19:02:19 -07:00
Samuel Susla fa20f25480 Enable multitouch on RCTViewComponentView
Summary:
Changelog: [internal]

RCTViewComponent view should have multipleTouchEnabled set to YES.
Paper has it enabled by default as well.

Reviewed By: JoshuaGross, yungsters

Differential Revision: D24219076

fbshipit-source-id: 74c18632457147b944a8abbacdbecb57e57f62ef
2020-10-09 17:11:43 -07:00
Panagiotis Vekris 254d455103 Add type annotations to prevent issues with planned Flow changes
Summary:
We're planning a fix in Flow (D24112595) that uncovers some existing errors that were
previously suppressed. Adding these annotations prevents them from surfacing during the
deploy of the fix.

Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D24147994

fbshipit-source-id: fef59a9427da6db79d4824e39768dd5ad0a8d1a3
2020-10-09 15:52:21 -07:00
Joshua Gross 3aa4de7912 Add debugging mode to non-Fabric NativeViewHierarchyManager
Summary:
Just helpful for debugging sessions.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D24207622

fbshipit-source-id: 904cbaa4512c03581d6a5c3efd69ebfca7972d42
2020-10-09 12:16:50 -07:00
George Zahariev 0c438be6c7 Clean up other Xplat .flowconfigs
Summary:
Types First and the various esproposal flags are on by default as of 0.135

Clean up flowconfigs that have to be in sync with the main one

Changelog: [Internal]

Reviewed By: jimmy623

Differential Revision: D24221995

fbshipit-source-id: 5da2867e2f013ad729a436ada192ecab690cb413
2020-10-09 11:20:41 -07:00
Joshua Gross 0d02c60bae Don't call FabricUIManager.stopSurface from ReactRootView with invalid ID
Summary:
There are cases under investigation where unmountReactApplication is called before the ReactRootView gets an ID; in some or all of those cases, UIManagerBinding.stopSurface cannot get the ReactFabric JSI module and crashes there.

It's still unclear why `unmountReactApplication` is being called in these circumstances - maybe another crash causing React Native teardown?

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D24214712

fbshipit-source-id: 796594653f4ff6d87088c4841b89f06cc873b46f
2020-10-09 03:15:35 -07:00
Héctor Ramos b581bcaae0 TurboModule iOS: Use react-native-codegen FBReactNativeSpec output
Summary:
Use the ObjC++ native modules files generated by `react-native-codegen` for the FBReactNativeSpec library.

People working with the core native modules may now re-generate these ObjC++ files using `USE_CODEGEN=1 pod install` or `scripts/generate-native-modules-specs.sh`.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D22249978

fbshipit-source-id: a12db23defacdba36099a24ce0b8475c8973bd6d
2020-10-09 00:15:16 -07:00
Valentin Shergin 7ebb71a32f Back out "Align multi-line TextInput onSubmitEditing behavior"
Summary:
This is a revert of D22488870 (521b16730d). (https://github.com/facebook/react-native/pull/29177)
We have to revert it because we realized that it's a breaking change without a very good reason. We have to figure out a better way to unify platform behaviors.

Changelog:
[iOS][Fixed] - Reverted recent change in TextInput (#29177)

Reviewed By: fkgozali

Differential Revision: D24200517

fbshipit-source-id: af0e561a6b8d9ade487be6b197a5d79d326442b6
2020-10-08 16:08:24 -07:00
simek 38bc5dff36 Remove 'qs' dependency, update yarn lock (#30125)
Summary:
This PR removes unused `qs` package (query string parser) from the main `package.json` file.

I was not able to find any explicit usage of this package in the repository. Looking at the commit which introduced this package it is not clear why it has been added, query string is not processed in any way.

I have also run ` yarn update-lock` to clean up lock after latest dependencies bumps. There are no `qs` package entry removal in yarn lock, because it is already required by `request` package.

Refs: b4785e5144

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Removed] - remove unused `qs` dependency

Pull Request resolved: https://github.com/facebook/react-native/pull/30125

Test Plan: This change should not affect the code base.

Reviewed By: appden

Differential Revision: D24184372

Pulled By: cpojer

fbshipit-source-id: 4f159f3c554c48ed21839370c8370848df181046
2020-10-08 01:28:19 -07:00
Joshua Gross c547757913 Perf improvement: don't call uiManager.updateRootLayoutSpecs on every ReactRootView.onLayout
Summary:
In D23640968 (78b42d7fb7) I introduced a mechanism to update offsetX/offsetY whenever onMeasure/onLayout were called, to ensure that `measureInWindow` had the correct metrics and would work properly.

However, now `uiManager.updateRootLayoutSpecs` gets spammed and is called too often. For example, whenever a TextInput is focused/blurred, `uiManager.updateRootLayoutSpecs` may be called 5+ times even though
the measure specs/offsets may only change once.

Thus, we just compare with previous values before calling into the UIManager. This should give us a very small perf improvement.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24176867

fbshipit-source-id: f0dcc816e651a843607e9e5d40d8f3489894d4ba
2020-10-07 23:12:55 -07:00
Joshua Gross 7c2f46ce3f Collect extra logging if ReactViewGroup.dispatchDraw crashes
Summary:
dispatchDraw,  dispatchGetDisplayList, updateDisplayListIfDirty, recreateChildDisplayList, etc, can all crash internally for a variety of reasons and it can be very tricky to track down the root cause. This isn't a fix, this just adds extra logging to hopefully make debugging easier.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24166149

fbshipit-source-id: 1bbaf34a92a9bcac5a594a25522c66e6e0cc80ca
2020-10-07 23:12:55 -07:00
Ramanpreet Nara 8e943d8f5a Remove reliance on util.inspect in snapshot tests
Summary:
According to Node's documentation: https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors

> The util.inspect() method returns a string representation of object that is intended for debugging. **The output of util.inspect may change at any time and should not be depended upon programmatically.**

Therefore, this diff switches over our RN Codegen snapshot tests to use a `JSON.stringify` call, followed by a replace of `"` with `'`. This gets the job done without compromising readability.

**Question:** Why do we not use `"`? A: Jest escapes all `"` in the snapshots, which makes reading the snapshots/using them in the console harder.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D24157056

fbshipit-source-id: 2f1aa2df28ac3ed4aa17bcdbcd23846ddbf804cf
2020-10-07 14:28:20 -07:00
Dulmandakh 1015194ba1 fix ReadableNativeMap.getNullableValue to match signature (#30121)
Summary:
This PR changes ReadableNativeMap.getNullableValue to return null if key not found, instead of throwing exception. This matches method signature and nullable annotation.

## Changelog

[Android] [Changed] - fix ReadableNativeMap.getNullableValue to match signature

Pull Request resolved: https://github.com/facebook/react-native/pull/30121

Test Plan: RNTester app builds and runs as expected, and getNullableValue will return null instead of throwing exception.

Reviewed By: JoshuaGross

Differential Revision: D24164302

Pulled By: fkgozali

fbshipit-source-id: 572c1d4ae5fd493aa0018c2df1dfc7fc91cb4b6b
2020-10-07 13:20:24 -07:00
Dulmandakh d76556543f fix ReadableArray annotations (#30122)
Summary:
Fix ReadableArray annotations, because these methods throw ArrayIndexOutOfBoundsException instead of null if index is not found.

## Changelog

[Android] [Changed] - fix ReadableArray null annotations. Possibly breaking change for Kotlin apps.

Pull Request resolved: https://github.com/facebook/react-native/pull/30122

Test Plan: RNTester app builds and runs as expected, and show correct type in when used with Kotlin code.

Reviewed By: JoshuaGross

Differential Revision: D24164326

Pulled By: fkgozali

fbshipit-source-id: 0c3f8fa9accbd32cc71c50befe9330e5201643f6
2020-10-07 11:28:30 -07:00
Christoph Nakazawa 4d4992c790 Upgrade to Jest 26.5.2.
Summary: Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D24154865

fbshipit-source-id: 04d637a3944b6f030fee342c4e8a181eb4b14458
2020-10-07 02:14:55 -07:00
Ramanpreet Nara 5535031ba4 Gate TurboModule block copy behind an MC
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24145506

fbshipit-source-id: 7e374c3bd2378cc1dcd9372d7cbb10ae445a2582
2020-10-06 18:40:20 -07:00
Christoph Nakazawa fd9787ecc0 Remove `fbjs-scripts` in favor of `@jest/create-cache-key-function`
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D24129817

fbshipit-source-id: fe1c4a8abdb1cc73b031120b1f8f9722d04ba620
2020-10-06 18:22:58 -07:00
Neil Dhar dffb61dcbb Remove capture of instance_
Summary:
The captured `instance_` will result in a call to JVM code to release the reference when the lambda is destroyed. However, Hermes may destroy the lambda in a non-JVM background thread.

Since `instance_` is a member of the class, and `this` is already captured, there is no need to capture it.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24141179

fbshipit-source-id: e3b268485ed229ee933281a80e5dbe2feba55719
2020-10-06 17:33:05 -07:00
Luna Wei 88174991d9 Close globalLogger when creating scopedLogger
Summary:
# Changelog:
[Internal][Changed] - Close the global perf logger when we create the scoped performance logger and absorb the global perf logger into the scoped logger

Reviewed By: rubennorte

Differential Revision: D23898621

fbshipit-source-id: 0d9bfd95175e660c0bd0bc74974126f92fe409b2
2020-10-06 12:31:31 -07:00
Tim Yung 291668a40c RN: Omit Unused Platform-Specific Code
Summary:
Our Babel plugin that strips irrelevant platform-specific code does not currently know how to deal with early return statements.

This minor change to a couple call sites enables the output bundle for Android to omit code specific to iOS.

Changelog:
[Internal]

Reviewed By: ejanzer

Differential Revision: D24139922

fbshipit-source-id: 467c0c38dd45679b889a8a94d85f73fd969e5b36
2020-10-06 11:19:00 -07:00
Héctor Ramos 4eb8bd5084 trivial: Remove whitespace in generated output
Summary:
Remove extraneous newlines before and after structs, before copyright headers, and other locations.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24117137

fbshipit-source-id: 194996019b4cadef9239a78334f31c0bc89e3901
2020-10-06 01:44:20 -07:00
Nick Gerleman d1ff2572d0 Publish Custom Flow Library Definitions (#30102)
Summary:
react-native has moved more code to be flow-strict. Part of this move involved adding custom flow-typed definitions for some third-party dependencies where not previously present. These definitions are not currently published, which prevents type-checking some parts of react-native externally.

This change publishes these type definitions as part of the react-native NPM package. Impact to package size is pretty negligible.

## Changelog

[Internal] [Fixed] - Publish Custom Flow Library Definitions

Pull Request resolved: https://github.com/facebook/react-native/pull/30102

Reviewed By: TheSavior

Differential Revision: D24099502

Pulled By: cpojer

fbshipit-source-id: bf3942aa973df4cfc2843ec3e7dbec82623f0447
2020-10-06 01:03:07 -07:00
Christoph Nakazawa eca3066291 Upgrade Jest to 26.4.2
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D24107283

fbshipit-source-id: 91a72ae7e06133998fefa490584477166c874685
2020-10-05 20:04:19 -07:00
Joshua Gross e41ee42967 Add more off-by-default logging options for debug-mode builds: ReactEditText, TextLayoutManager
Summary:
Put more logging behind debug-build-only build flags.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24120153

fbshipit-source-id: 3b33db3e701a2bd3304c7c6502d58eb84e6bdc7f
2020-10-05 18:57:02 -07:00
Chris Dinh 77f7658e4e Export FlowId type
Summary:
The UserFlow API takes in a FlowId as a parameter on all of its calls. However, this type is currently not exported so consumers cannot store a generated FlowId without creating their own matching type.

Changelog: [Internal]

Reviewed By: dmitry-voronkevich

Differential Revision: D24115983

fbshipit-source-id: 63afbca01343a31aa60042db3693a96a6b854939
2020-10-05 16:28:42 -07:00
Joshua Gross 02005973ee Fix sloppy boolean error that breaks certain Fabric TextInputs
Summary:
When I landed D24042677 (030d2c1931), I had the right idea in spirit but forgot to negate the if statement. Oops.

This means that in non-Fabric, the cached spannable will be updated (potentially causing a crash) and the cached spannable will *never* be updated, meaning that most TextInputs will be measured as 0 in Fabric.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D24119952

fbshipit-source-id: dc86137956535e1f2b147bb432d050b3561e2658
2020-10-05 14:37:25 -07:00
Héctor Ramos d4937b925b Use correct var name for element when handling arrays of type aliases
Summary:
Fixes an issue where, if a spec uses an array of elements where the element is a type alias, the generated code would use the wrong variable name.

An example of such a spec can be found in `NativeExceptionsManager.js`:
```
  +reportSoftException: (
    message: string,
    stack: Array<StackFrame>,
    exceptionId: number,
  ) => void;
```

The fix ensures the local variable name is passed through, ensuring that either p or itemValue_N is used when appropriate.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24116429

fbshipit-source-id: f39b75adb604c751d70a284a11a7fa6649b1344d
2020-10-05 12:57:34 -07:00
Christoph Nakazawa 43624dd193 Update Babel to 7.11.6
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D24039996

fbshipit-source-id: 26ec2a988faadf24ea76d9124052d9397682787b
2020-10-05 05:46:31 -07:00
hy.harry.yu@gmail.com 12a50c0a44 Fixed TextInput not being selectable in removeClippedSubviews FlatLists (#28852)
Summary:
This is a resubmit of D21499015. It resolves https://github.com/facebook/react-native/pull/28852 and https://github.com/facebook/react-native/issues/27787.

From Harry Yu's original PR (too old to merge now):

Text in TextInputs can't be selected by long press. This happens only when they're inside of FlatLists that are rendered with removeClippedSubview prop set to true on Android.

Fixes https://github.com/facebook/react-native/issues/27787

Issue https://github.com/facebook/react-native/issues/6085 2 years ago had fixed this issue with a quick fix, but the code has since disappeared in another change. It has a longer explanation for why it's fixed, but essentially - the text is assumed to be not selectable since the TextInput is initialized without being attached to the window. We need to explicitly set the text to be selectable on attachment. This change redoes that change with a 1-line fix.

Changelog: [Android] [Fixed] - Fixed TextInput not being selectable in removeClippedSubviews FlatLists

Pull Request resolved: https://github.com/facebook/react-native/pull/28852

Test Plan:
This can be tested with a new toggle in RNTesterApp.
Go to the FlatList in RNTesterApp
Toggle on "removeClippedSubviews"
Try selecting some text in the list header. It should fail without this comment but succeed with it

Reviewed By: sammy-SC

Differential Revision: D24043533

Pulled By: JoshuaGross

fbshipit-source-id: c8e60f8131ccc5f6af31ed976c4184d0a16eb3af
2020-10-04 22:13:07 -07:00
Valentin Shergin 7c83eaba80 Fabric: Fixed crash in `[RCTParagraphComponentView accessibilityElements]`
Summary:
Now we check for `_state` being nullptr before dereferencing this.

`accessibilityElements` (as a bunch of other methods that have the same check) can be called by OS any moment (we cannot predict when), so at some very rare moments, it can be called when the view is not fully initialized yet. To prevent crashing we just need to return some default value indicating that the view is empty.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24095654

fbshipit-source-id: d8a37f269c5bf7718acb0b512e7a9313e199398e
2020-10-04 19:12:22 -07:00
Valentin Shergin 03e120daa9 Back out "Use ConcreteStateTeller in RCTParagraphComponentView"
Summary:
RCTParagraphComponentView does not need to have the state teller because it does not change the state.
Also, we are thinking about removing State Teller, so to simplify a fix coming in the next diff, we are backout the introducing a state telled in RCTParagraphComponentView.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24095655

fbshipit-source-id: 90bd21cb8b01056c0db902a604b4088bf8c7750e
2020-10-04 19:12:22 -07:00
Valentin Shergin a977ad0071 Removing outdated warning from View Config infra
Summary:
In theory, view configs can be hierarchical (one can depend on another), at least it was semi-supported on iOS once. And AFAIK there is only one component that seems to use this feature - `RCTComponentHostingView`, all other components essentially inherit RCTView or nothing. At the same time, RCTComponentHostingView does not really need it because RCTComponentHostingView itself does not expose any props.

Changelog: [Internal] Removed outdated warning

Reviewed By: kacieb

Differential Revision: D24095348

fbshipit-source-id: 5629c7433f151b72aae8201c58dd42062990b77e
2020-10-04 11:22:40 -07:00
Riley Dulin 7b7c9f2309 Change the memory warning forced GC to use the level name
Summary:
We're seeing that GCs caused by memory warnings on Android are barely collecting
any memory and are operating on much smaller heaps than natural GCs.

This is likely due to some of the TRIM_MEMORY_* events firing too often.
Log which event name it was, instead of the generic "memory warning", to narrow
down the cases where the memory warning was helpful. Unhelpful warnings will
later be moved to not force a GC.

Note that this diff changes Venice, but we don't see any Venice heaps in production,
so it won't matter much other than making the code match up.

Also note that iOS has a similar memory warning in `RCTCxxBridge.mm`, but it hasn't
been called in production. Perhaps iOS is less trigger-happy for memory warnings than
Android.

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D24093394

fbshipit-source-id: 03304f0f79083133c4d9b730559aef291319b6eb
2020-10-03 10:11:06 -07:00
Héctor Ramos 5fae86fb96 Remove license header from third-party code
Summary:
The `flow-typed/npm` path contains third-party code. The propietary Facebook license header should not be included in these files.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24082894

fbshipit-source-id: 34928c7a6a3d1fdf8d91b4cdd86eb72ca6341545
2020-10-02 18:04:21 -07:00
Dustin Shahidehpour 1511bfa028 Do another passthrough of labeling.
Summary:
At this point, I think we are ready to enable validation

Changelog: [INTERNAL]

Differential Revision: D24062829

fbshipit-source-id: c82dcd2c376e5cdeb164451e16b6fb3a666106f4
2020-10-02 08:49:06 -07:00
Dmytro Voronkevych 923b77aef9 Renaming UserFlow methods
Summary: Renaming methods in UserFlow to match other APIs

Reviewed By: swillard13

Differential Revision: D24078270

fbshipit-source-id: c3a65d440e389d7b3c76de7706372265584353c8
2020-10-02 08:09:05 -07:00
Dmytro Voronkevych 2c6d010a50 Adding UserFlow.compleWithFail to RN
Summary: Adding method UserFlow.completeWithFail.

Reviewed By: swillard13

Differential Revision: D24052851

fbshipit-source-id: 1baa30a2d7dfb9ef4e457a74b66fd24e4ffbf21f
2020-10-02 08:09:05 -07:00