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

18899 Коммитов

Автор SHA1 Сообщение Дата
Ramanpreet Nara b7f49a84d5 Implement TurboModule eager initialization
Summary:
The TurboModuleManagerDelegate now supports a `getEagerInitModuleNames()` method, which is supposed to return a `java.util.List` containing the names of all NativeModules that require eager initialization. The NativeModuels are created when the `TurboModuleManager` is created. This happens inside `ReactInstanceManager.createReactContext` slightly after the NativeModuleRegistry is created, which is when our legacy NativeModules are eagerly initialized.

All NativeModules declared in `TurboReactPackages` that are wired into the `TurboModules` infra via `ReactPackageTurboModuleManagerDelegate` can use the `ReactModule(needsEagerInit = true)` annotation. Our build pipeline should correctly process the annotation into a `ModuleInfo`, and `ReactPackageTurboModuleManagerDelegate` should correctly forward the eagerly initialized module names to TurboModuleManager.

Changelog:
[Android][Added] - Implement TurboModule eager initialization support

Reviewed By: mdvacca

Differential Revision: D18819552

fbshipit-source-id: b2009a3b8f4e064362d2abeb5281637962531678
2019-12-05 13:24:43 -08:00
Joshua Gross b9491b7c51 TextInput: support editing completely empty TextInputs
Summary:
Before this change, C++ couldn't propagate changes that updated TextInputs that were completely empty. In C++ the AttributedString cannot contain Fragments with empty text, so a completely empty TextInput would have no Fragments; this breaks the C++ state value updating infra since it relies on copying over existing fragments.

Instead, now we propagate default TextAttributes and ShadowView through State, so that State updates can use them to construct new Fragments.

Changelog: [Internal]

Reviewed By: shergin, mdvacca

Differential Revision: D18835048

fbshipit-source-id: 58ac94c5454c8610c6287b096b62199045e5879b
2019-12-05 13:20:30 -08:00
Joshua Gross 0556e86d09 TextInput: support modifying TextInputs with multiple Fragments (Cxx side)
Summary:
Support for modifying AndroidTextInputs with multiple Fragments was added on the Java side in a previous diff.

This diff adds support on the C++ side for the following scenario:

A <TextInput> is initially given contents via children <Text> notes, which represents multiple Fragments (that could have different TextAttributes like color, font size, backgroundcolor, etc). The Android EditText view must get this initial data, and then all updates after that on the Android side must flow to C++ so that the C++ ShadowNode can perform layout and measurement with up-to-date data.

At the same time, the <TextInput> node could be updated from the JS side. All else equal, this would cause the native Android EditText to be replaced with the old, original contents of the <TextInput> that may not have been updated at all from the JS side.

To mitigate this, we keep track of two AttributedStrings with Fragments on the C++ side: the AttributedString representing the values coming from <TextInput> children, from JS (`treeAttributedString`); and the AttributedString representing the current value the user is interacting with (`attributedString`). If the children from JS don't change, we don't update Android/Java with that AttributedString. If the children from JS do change, we overwrite any user input with the tree from JS.

Changelog: [Internal]

Reviewed By: shergin, mdvacca

Differential Revision: D18785976

fbshipit-source-id: a1f3a935e02379cabca8ab62a39cb3c0cf3fbca5
2019-12-05 13:20:30 -08:00
Joshua Gross 0bae47434e TextInput: keep C++ state in-sync with updated AttributedStrings in Java
Summary:
When the TextInput is updated on the Java side, make sure C++ State gets updated. We do this by making sure that the AttributedString data-structured in mirrored in Java and in C++.

In practice, the AttributedString is copied into Java a few times during initialization, and then after then, 99% of the time Java is writing without receiving updates from C++. This means that we should optimize the Java-to-C++ update path most aggressively in the future.

However, it turns out that for now, at least, we can't reuse NativeWritableMaps/NativeWritableArrays because they're consumed on the C++ side and can't be modified after that. This is a perf improvement for the future.

This allows us the user to edit any fragments, and the changes will flow through C++ State. This also allows us to edit across multiple Fragments.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18785960

fbshipit-source-id: 97b283ec411081eca4d2d7a4cce2b31b5e237c42
2019-12-05 13:20:30 -08:00
Joshua Gross 2a46980535 AttributedString equality: only check tags of parentShadowView; ShadowViews are never equal otherwise
Summary:
For future diffs, we need to check AttributedStrings for equality.
It turns out that any time props or state change, two `parentShadowView`s will never be equal to each other, even if we'd consider them equal for our use-cases here for AttributedStrings. Just compare the tags instead of the whole object.

NOTE: I don't have any strong opinions about how we should be comparing them. It just isn't working currently for AndroidTextInput. Comparing tags seems convenient and reasonably correct for now.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D18786004

fbshipit-source-id: 13c0e881cd8d2c2a207e8891309b3c9b880b827f
2019-12-05 13:20:29 -08:00
Joshua Gross 25ce622683 Fix TextInput example with `text` attribute and child Text node: `text` background shouldn't be same as TextInput background
Summary:
Currently the TextInput background is same as the background of the `text` value's attributes, because of the way we're parsing props and using the TextInput's props both for the background of the TextInput, and for the AttributedString/background color of the `text` prop node's attributes. If the background color has opacity, the `text` prop node will not have the correct background because it will be applied twice. Fix it.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18760384

fbshipit-source-id: 0cdcc8dd8839dd47e8fe0f593b4696bc16a62333
2019-12-05 13:20:29 -08:00
Joshua Gross a09346f129 TextInput: support text value+child Text nodes
Summary:
Fix and simplify `AndroidTextInputShadowNode::getAttributedString` so that it (1) works, and (2) is aligned with the equivalents in the old Java code.

The issue is that we weren't picking up `text` attributes since we're only traversing children and not the TextInput node itself. If a `text` attribute is present it needs to be treated as its own Text node.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18739830

fbshipit-source-id: 4b3bc81dbe8c241c2e06fe5be1f9b50e49132890
2019-12-05 13:20:29 -08:00
Joshua Gross 7590d9f8f4 Support creating AndroidTextInputState from previous state + folly::dynamic
Summary:
This is necessary for allowing TextInput updates from Java.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18739831

fbshipit-source-id: 0ba2d7eac96cac7471c5e46cc1e03a4d065229f5
2019-12-05 13:20:28 -08:00
Joshua Gross 48c69af3e0 Throw non-crashing SoftException when ViewCommand is sent to non-existent tag
Summary:
Motivation: TextInput.js frequently sends commands to views as they're disappearing (`blur`, for instance).

We should fix that in the future, if possible. For now, just log the issue and continue. It shouldn't cause any user-facing issues since 1) it appears that TextInput knows the underlying view is gone; 2) the View has already disappeared so the user can't interact with it, so commands can go safely into the void.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18821448

fbshipit-source-id: 980dbbce8cdb2cc0bb4bf60b3bccc90869208f01
2019-12-05 13:20:28 -08:00
Jordan Brown 5ff82b7094 Error on implicit inexact objects in xplat/js
Summary:
This will ensure we don't get any more implicit inexact objects in xplat/js. Before we turn on exact-by-default we are going to make an announcement post, so this diff will hold the line until that's out.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D18785892

fbshipit-source-id: caeb662f08b44cebe34b9e1b52bdd5842fe06176
2019-12-05 09:03:03 -08:00
Dulmandakh 2fd50882b5 fix build failure due to duplicate libc++_shared.so (#27417)
Summary:
This PR fixes build failure caused by duplicate libc++_shared.so, because dependencies (like Flipper) might include one in addition to RN.

## Changelog

[Android] [Changed] - fix build failure due to duplicate libc++_shared.so
Pull Request resolved: https://github.com/facebook/react-native/pull/27417

Test Plan: Create a project from master, then build and run. Build will fail without the patch, and succeed with the patch.

Differential Revision: D18827583

Pulled By: mdvacca

fbshipit-source-id: 1272cedd299278403f87215c36aaf58217eae3c5
2019-12-04 23:25:47 -08:00
Jordan Brown 90ab8b89e8 Last pass over non-generated files for explicit inexact object rollout
Summary:
The flow team is rolling out exact-by-default object types to xplat/js. In order to do that, we need to take all inexact objects `{}` and turn them into explicitly inexact objects `{...}`.

This codemod does not change any type checking behavior. Prettier was run on all of the modified files with `format`.

drop-conflicts

Changelog: [Internal]

Reviewed By: zackargyle

Differential Revision: D18785076

fbshipit-source-id: c89c7fcc9eabe69859c8a488e03185fba5d06f80
2019-12-04 21:41:16 -08:00
Valentin Shergin 42f2ded900 Fabric: Returning zero size on attempt to measure an empty string in RCTTextLayoutManager
Summary:
Sometimes, very irregularly, measuring an empty string crashes/freezes iOS internal text infrastructure. This is our last line of defense.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC, mdvacca

Differential Revision: D18802308

fbshipit-source-id: addf523b31b78b0777be7eeaeee140ac8416393b
2019-12-04 18:36:49 -08:00
Valentin Shergin d12385cae6 Fabric: Support for AttributedStringBox::Mode::OpaquePointer in RCTTextLayoutManager
Summary:
Now RCTTextLayoutManager (and TextLayoutManager) not only accept `AttributedStringBox`  but also is capable to measure such kind of string when it contains a pointer to NSAttributedString.
The same can be implemented for Android when/if needed.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18670791

fbshipit-source-id: f19089de64d00e1290767310a500ade4cede4685
2019-12-04 18:36:49 -08:00
Valentin Shergin c4876d0313 Fabric: Introducing `AttributedStringBox`
Summary:
The diff implements a new class called `AttributedStringBox` that represents an object storing a shared `AttributedString` *or* a shared pointer to some opaque platform-specific object that can be used as an attributed string. The class serves two main purposes:
- Represent type-erased attributed string entity (which can be platform-specific or platform-independent);
- Represent a container that can be copied with constant complexity.

Why? Several reasons:
- Sometimes it makes sense to keep an attributed string as a shared resource. This way we don't need to pay for expensive copying and we also implement a copy-on-write semantics on top of that if needed.
- We need to extend a TextLayoutMeasure API to support measuring some platform-specific attributed string implementation to remove the necessity of converting a string back and forth between representations. That's especially important for TextInput because we will need to measure that very efficiently (and the source of measuring, in this case, is a platform attributed string).

In other words, we need something to store inside TextInputState to measure and update very efficiently. The source of this data might be a native TextInput control or a data from React, to represent that kinda object we need this data structure (and interfaces that deal with it).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18670793

fbshipit-source-id: bc0164f801f28642f7c6da340af12acf33b85d24
2019-12-04 18:36:48 -08:00
jeswinsimon 70ec7e2add Share - title is not a valid attribute in iOS (#27351)
Summary:
Code document incorrectly indicates that the `title` property is supported in both iOS and Android.
https://github.com/facebook/react-native/issues/27306

## Changelog

[iOS] [Changed] - Changed doc.
Pull Request resolved: https://github.com/facebook/react-native/pull/27351

Test Plan: NA - Only code comments have been changed.

Differential Revision: D18770026

Pulled By: hramos

fbshipit-source-id: af51c0b08bdf534d5e2c861b10e22d969d6f80f9
2019-12-04 15:49:22 -08:00
talhaazhar 3c4b1d6c4f adding tests for the processColorArray mapping (#27344)
Summary:
The following pull-requests adds test for the `processColorArray` function. This ensures that the mapping is respected even in the `processColor` file changes. It also ensures that the mapping follows the basic expected functionality

## Changelog
[General] [Added] - Add test for the `processColorArray` to make sure it maps correctly
Pull Request resolved: https://github.com/facebook/react-native/pull/27344

Test Plan:
- Run `npm run test Libraries/StyleSheet/__tests__/processColorArray-test.js` to ensure tests pass
- Run `npm run lint` to make sure there are no styling conflicts.

<img width="454" alt="Screen Shot 2019-11-26 at 3 24 44 PM" src="https://user-images.githubusercontent.com/31664059/69680816-e8641780-1060-11ea-89ca-336c5534eb16.png">

Differential Revision: D18770069

Pulled By: hramos

fbshipit-source-id: 1a8647931818360b9912dc6fb50c339a91b9d4ea
2019-12-04 15:27:54 -08:00
Héctor Ramos 97dd8cedc5 Bump RNTester OS target to iOS 12.4 (#27414)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/27414

The version of Xcode used in tests does not have a iOS 12.2 simulator by default. Bumping to 12.4 should fix iOS test failures.

Changelog:

[iOS] [Fixed] - Fix iOS tests by using 12.4 iOS Simulator

Reviewed By: mhorowitz

Differential Revision: D18802712

fbshipit-source-id: 0f0ea9982c8a9cf17e17ca473ed1c480751e3515
2019-12-04 14:56:28 -08:00
Emily Janzer 476a336e36 Convert NetworkingModule to TurboModule
Summary: Making the open source NetworkingModule TM-compatible.

Reviewed By: mdvacca

Differential Revision: D18770987

fbshipit-source-id: 64966f91308e31bdcf9bfa959381d4e40ccb2753
2019-12-04 11:26:39 -08:00
Emily Janzer de6aa10bdd Use registerLazyCallableModule to register HMRClient
Summary:
Right now we use `BatchedBridge.registerLazyCallableModule` for all JS modules except for `HMRClient`, which uses `registerCallableModule` instead (takes the module itself instead of a function that returns it). I'm standardizing on `registerLazyCallableModule` so that it will be easier to swap out the implementation later for bridgeless mode.

The only reason I could think why we wouldn't want to do this is if we're relying on some side effect of `require('HMRClient')` when setting up JS, but there don't seem to be any side effects in that module that I can see.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18798870

fbshipit-source-id: a5c950bdbfd998bb12e4843ee28ece08a26c84bf
2019-12-04 10:52:06 -08:00
Tim Yung 37d8440a8e Touchable: Restore `underlayColor={null}` Behavior
Summary:
The former implementations of `TouchableHighlight` used `defaultProps` for `underlayColor`. However, the newly landed implementations use `??` which falls back to the default behavior if the prop is `null`.

This restores the former behavior so that, for example, supplying `underlayColor={null}` to `TouchableHighlight` will not fallback to black. (It probably should always have, but the intention of my rewrite was not to introduce a breaking change.)

Changelog:
[General] [Fixed] - Restore behavior for `underlayColor={null}` in `TouchableHighlight`.

Reviewed By: zackargyle

Differential Revision: D18806494

fbshipit-source-id: 4d33810e2f754f980385d76d81dc0f34006f4337
2019-12-04 09:35:46 -08:00
George Zahariev 15e2dcfff9 Release 0.113 to xplat
Summary:
Release 0.113 to xplat

Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D18790262

fbshipit-source-id: ac3ad40c24010aab1c0d43947843dd581a17d3cf
2019-12-04 09:17:34 -08:00
Rick Hanlon dbf6113937 Add requiresMainQueueSetup YES to top offenders
Summary:
Adds requiresMainQueueSetup YES to top 16 components warning to help clean up the console. This should cut down ~50% of native warnings from React Native.

This should not change any behavior, just make the existing behavior explicit.

Changelog: [Internal]

Reviewed By: mmmulani

Differential Revision: D18774349

fbshipit-source-id: 5a74967280812ebfd859d7d976487d264b5820c7
2019-12-04 07:48:54 -08:00
Amir Shalem 505a2167f5 Allow redex to optimize more of yoga by removing unneeded @DoNotStrip marks
Summary:
There are multiple `DoNotStrip` in Yoga java binding, they aren't needed.

##Changelog:
[Internal][Yoga] Allow redex to optimize more of yoga by removing unneeded DoNotStrip marks

Reviewed By: SidharthGuglani

Differential Revision: D17519844

fbshipit-source-id: 8b26800d720f34cae87754d85460abf88acbe713
2019-12-04 01:34:19 -08:00
Isabel B d3980dceab moved normalizeColor and changed dependencies (#27372)
Summary:
Originally, normalizeColor.js was in Library/Color/ however, I noticed that its tests were in a completely different directly (Library/StyleSheet/__tests__) which was confusing. The other files such as processColor.js, setNormalizedAlphaColor.js had their tests in Library/StyleSheet/__tests__ as well.

## Changelog

[Internal] [Changed] - Moved normalizeColor.js to a more appropriate directory where its tests live.
Pull Request resolved: https://github.com/facebook/react-native/pull/27372

Test Plan: I simply moved a file and changed dependencies. The code should still function as is.

Reviewed By: rickhanlonii, mdvacca

Differential Revision: D18760210

Pulled By: yungsters

fbshipit-source-id: 4c2400acabab35ccbb2533faa5c1d6487c9bf48e
2019-12-03 16:05:22 -08:00
Sidharth Guglani 71cb0d8392 create global ref properly in YogaJNIException
Summary:
##Changelog:
[Internal][Yoga] create global ref properly in YogaJNIException

Reviewed By: astreet

Differential Revision: D18775982

fbshipit-source-id: ee529d6178d40b5f887fa1327fe156fa466f154f
2019-12-03 16:01:15 -08:00
Ramanpreet Nara a6a34ba1d1 Add codegen specs as dependencies of NativeModules
Summary:
## Step 1
I'm going to make every Java NativeModule type-safe and TurboModule-compatible. The first step is to make sure that every type-unsafe NativeModule has a dependency on its spec's codegen target.

## Input
Module -> owner(Module): P123320255
Module -> name(Module): P123320256
Module -> owner(spec(name(Module))): P123320257

### Excluded NativeModules
NativeModules without Specs: P123320644
Java only NativeModules: P123320645

Changelog:
[Internal] - Add buck dependencies for NativeModule specs

Reviewed By: mdvacca

Differential Revision: D18781629

fbshipit-source-id: 89f39017b8224355d9d7b43bf6c162b0957760ee
2019-12-03 15:37:30 -08:00
Valentin Shergin 7368f79169 Fabric: Introducing AttributedString::Range
Summary:
We need this type to work with string ranges (e.g. working with selection ranges). This diff implements parsing and printing that as well.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18607656

fbshipit-source-id: f2cfd7c5b7ba9f225a9a0c5a078947a220b2f30d
2019-12-03 14:19:52 -08:00
Riley Dulin 0a21cca9a2 Remove tripwire cooldown
Summary:
Changelog: [Internal] Remove Hermes heap tripwire cooldown parameter.

Delete all references to the cooldown parameter for Hermes's GCConfig, it is no longer
used (instead, the tripwire callback is called at most once per Runtime).

Reviewed By: JoshuaGross

Differential Revision: D18768200

fbshipit-source-id: e7a02ed59ad45e8e4d1b32b37d752076c40caf0b
2019-12-03 13:29:25 -08:00
Emily Janzer 3963c7aa56 Clean up unused functions on ReactContext
Summary: Removing the methods I recently added for storing/retrieving an instance key on a ReactContext.

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D18710637

fbshipit-source-id: d34683ec660bd999db8112865e15392606fc9237
2019-12-03 11:33:00 -08:00
Kacie Bawiec bde1d63c85 Add getNativeScrollRef to FlatList
Summary:
Add a method to get the underlying host component of `FlatList`. Fix flow types in `FlatList` and `VirtualizedList`. Add test cases to test the behavior of the new function in all cases.

Changelog: [General] [Added] - Add getNativeScrollRef method to FlatList component

Reviewed By: TheSavior

Differential Revision: D18302202

fbshipit-source-id: 7005a2bc1dab207434be3f1f4d8fde0b11b3bb4d
2019-12-03 10:17:15 -08:00
Oleksandr Melnykov 8cb66e3202 Integrate RCTMap into Fabric on Android
Summary:
This diff integrates RCTMap into Fabric on Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18762933

fbshipit-source-id: 6e3e02e0e8101f94fe0c6582e1a63a66fb2f70f9
2019-12-03 09:07:38 -08:00
Valentin Shergin f697836cfa Fabric: Disabling ScrollView's contentOffset propagation to ShadowNode tree
Summary:
This diff disables the feature that propagates ScrollView's content offset to ShadowNode hierarchy making measuring content-offset-aware.
Seems that feature breaks FlatList because it does not expect measure calls to be content-offset-aware. We need to validate which legacy `measure*` calls should be content-offset-aware and which should not, and then verify that actual feature works (it's not clear why it worked with FlatList before) well before re-enabling this.

For now, the most safer choice is to disable this feature because I don't think some call sites actually rely on it now.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18777939

fbshipit-source-id: 20d6c1081e7d2cc3b5a7a172ed947a9ae9cdfaab
2019-12-03 08:12:13 -08:00
Ramanpreet Nara 4d9e5f8481 Delete com.facebook.react.modules.debug.NativeSourceCodeSpec
Summary:
When SourceCode was converted to a TurboModule in D17586276, we had to check in `NativeSourceCodeSpec` into the codebase. Since all the OSS NativeModule base classes are now checked into `react-native-github`, it's no longer necessary to keep `NativeSourceCodeSpec`. So, I'm deleting it.

Changelog:
[Android][Removed] - Delete com.facebook.react.modules.debug.NativeSourceCodeSpec

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D18732997

fbshipit-source-id: 6026b4bcb9ebb9c4d7ba556bc644698eb550a9de
2019-12-03 06:29:58 -08:00
Andy Huang fa9ff07017 Pass disabled prop down to native implementation
Summary:
Changelog:
[iOS] [Fixed] - Slider is now disabled properly on iOS if the disabled prop is set.

Reviewed By: yungsters

Differential Revision: D18758835

fbshipit-source-id: 4850ebf05380f241d49d40107de61fd840049779
2019-12-02 14:21:16 -08:00
Dulmandakh 7a42596438 MainActivity launchMode is singleTask (#27373)
Summary:
Most RN apps have single activity, and developers expect to resume application from background when app icon pressed. But Android default configuration creates a new activity instance, which confuses developers, see https://github.com/facebook/react-native/issues/27370 and https://github.com/facebook/react-native/issues/27368.

This PR changes template manifest so that when app icon pressed, background app will resume instead of creating a new activity, therefore match developers expectations. Also it's required to make Linking work.

## Changelog

[Android] [Changed] - MainActivity launchMode is singleTask
Pull Request resolved: https://github.com/facebook/react-native/pull/27373

Test Plan: RNTester will resume background app, instead of creating a new instance when app icon pressed

Differential Revision: D18766373

Pulled By: mdvacca

fbshipit-source-id: 697e9c5bf92ec958de265b060dffb50f7b74d157
2019-12-02 11:39:55 -08:00
Héctor Ramos 7e6fae2a20 Fix test-ios by bumping Xcode version (#27356)
Summary:
iOS tests have been failing due to iOS 12.4 not being supported by Xcode 10.2.1. Bumping to 10.3 solves it.

Ideally, we'd bump to Xcode 11.2.1 and iOS 13.2.2. We can do this once all of our internal CI machines have Xcode 11.2.1 available.

## Changelog

[iOS] [Fixed] - Fix CI iOS tests by bumping Xcode version used in Circle CI
Pull Request resolved: https://github.com/facebook/react-native/pull/27356

Test Plan: Circle

Differential Revision: D18765501

Pulled By: hramos

fbshipit-source-id: 1a1ca78c5d8f8596476b0e56740ea1bdf7422161
2019-12-02 10:49:37 -08:00
Moti Zilberman 60b4ba16c0 Always return 0-based columns from parseErrorStack
Summary:
Fixes a bug where we were skewing some stack traces by sending 1-based column numbers to the Metro symbolication endpoint, which expects them to be 0-based. This is achieved by subtracting 1 from the column numbers we find in textual stack traces, which are almost universally 1-based in current JS engines.

The bug is only noticeable in *some* cases, namely where the column immediately following the correct one is in a different function.

NOTE: The behaviour under Hermes was fixed separately, in a previous commit. This fix applies to other engines (e.g. JSC).

Changelog: [General] [Fixed] - Fix stack traces showing the wrong function name in some cases

Reviewed By: cpojer

Differential Revision: D18628230

fbshipit-source-id: 5677803500e45a41c1005496d19c150526af2d07
2019-12-02 06:02:25 -08:00
Moti Zilberman 75d03b56fa Implement a dedicated Hermes stack trace parser
Summary:
Makes stack trace parsing return a consistent representation of column numbers when using Hermes, whether we're executing bytecode (in prod) or source code (in dev). This is achieved by creating a new full-fidelity stack trace parser for Hermes.

NOTE:  We still use the `stacktrace-parser` package for other engines, so this fix applies only to Hermes and not to JSC - that will be fixed separately in an upcoming diff.

This fixes a bug where we were skewing some stack traces by sending 1-based column numbers to the Metro symbolication endpoint, which expects them to be 0-based. The bug is only noticeable in *some* cases, namely where the column immediately following the correct one is in a different function.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18627930

fbshipit-source-id: abd80846f00f24428670b2c92153564fb4bb2aff
2019-12-02 06:02:25 -08:00
Sidharth Guglani aee646f1c1 Add defensive check for result returned after JNI function calls
Summary:
Added method which checks if value(methodId, fieldId, class ...) returned by JNI functions (getMethod, getField, getClass ...) is valid or not and throw exception if they are not valid

##Changelog:
[Internal][Yoga] Add defensive check for result returned after JNI calls

Reviewed By: astreet

Differential Revision: D18745718

fbshipit-source-id: 2af26eda15fbe7834e1c9b274deeed4f106274ab
2019-12-02 05:24:37 -08:00
Sidharth Guglani cd1e0e527a Use YogaJniException in jni call exception handling
Summary:
##Changelog:
[Internal][Yoga] Use YogaJniException in jni call exception handling

Reviewed By: astreet

Differential Revision: D18745615

fbshipit-source-id: 5fcf4c31f04fade94ef98a5349782ed3d43805b0
2019-12-02 05:24:37 -08:00
Sidharth Guglani 36aaad744d Add YogaJniException class
Summary:
## Changelog:
[Internal][Yoga] Add YogaJniException class to be used later for jni exceptions

Reviewed By: astreet

Differential Revision: D18745609

fbshipit-source-id: 53503b54dbc59e9fe47f599dee6be9cb68134cb2
2019-12-02 05:24:36 -08:00
Samuel Susla 6803cd7546 Add codegen for core components + land blocking tests
Summary: Changelog: [Internal]

Reviewed By: fkgozali, mdvacca

Differential Revision: D18505903

fbshipit-source-id: 9de45c3f8591efaf1be7e2a21fe7d6c77965dc8f
2019-12-02 03:07:45 -08:00
Samuel Susla 01a3edcc7a Reland: [RN][iOS] Extend Fabric iOS plugins to include Core components
Summary: Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D18638769

fbshipit-source-id: bc27de0ebfd3689aa427f3aef7e194f3938d893c
2019-12-02 03:07:45 -08:00
Valentin Shergin bb1f9b23e7 Fabric: Using better::map instead of std::unordered_map in ShadowTreeRegistry
Summary:
Becasue better one is more efficient.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18626666

fbshipit-source-id: 143dab1dd4c2e168368d2ca14bf2ffc8367d71ea
2019-12-01 19:23:26 -08:00
Valentin Shergin 58f69ca504 New delegate method in RCTBackedTextInputDelegate and its implementation
Summary:
This is a more feature-full replacement for `textInputShouldChangeTextInRange:replacementText:` that allows implementing things like limiting text input content length without hacks and compromising the order of events. The new version of the TextInput will rely on that. The existing TextInput will use that as exacly like the previous version (because the new API is a superset of the the old one).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18670792

fbshipit-source-id: 0c434b351dfc8ab42404eb9aea0ede70bedaa9dc
2019-12-01 19:09:49 -08:00
Will Holen 33f82c569c Allow enumerating local variables
Summary:
Our current lazy compilation parent scope issue caused us to only have a
single lexical scope, which was taken to be the global scope. This
effectively hid all local variables. Additionally, the variables were
not marked as enumerable, so Chrome didn't show them.

As further improvements, 'this' is now included, and we more correctly
tag parent scopes as closures.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D18671527

fbshipit-source-id: cbbf9fbd319e433b9f681bd23e4ad7b4bb4a3d74
2019-12-01 05:05:50 -08:00
Valentin Shergin a69c18cfbc Fabric: Moving ScrollView's delegate splitter to RCTEnhancedScrollView
Summary:
This diff moves the delegate splitter from RCTScrollViewComponentView class to RCTEnhancedScrollView. Now, it's a key feature of RCTEnhancedScrollView.
We need this to make `delegate` property of our UIScrollView subclass as resilient to any abuse as possible. E.g., if some other part of the app, unrelated to RN (e.g. BottomSheet component), nils the property, all dependent RN specific infra should continue to work. To make it possible, we make an exposed property to use the internal delegate splitter instead of providing direct access to the property of a superclass.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18752886

fbshipit-source-id: 04ec4758afefb8e17481d69471d53c61ab396698
2019-11-30 12:31:42 -08:00
Valentin Shergin 4350132932 Fabric: Storing a pointer to a ComponentView in ActiveTouch
Summary:
Surprisingly, `UITouch::view` property might be nil in some cases (the documentation does not specify in which ones), and that actually happens. That breaks the calculation of a touch position relative to a view on which the touch began. This diff implements storing the view inside ActiveTouch, so we always can access it when we need it. That's similar to how it's implemented in Paper's TouchHandler.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18752887

fbshipit-source-id: b412047132238ab4fc265e6c4fbcfb732ed27518
2019-11-30 12:31:42 -08:00
Ramanpreet Nara 7ce8babfef Make ExceptionsManagers extend ReactContextBaseJavaModule
Summary:
Eventually, we want these to extend the abstract base class code-generated from the NativeModule spec. That base class extends `ReactContextBaseJavaModule`. So, this is a step in the right direction.

Changelog:
[Internal] Make ExceptionsManagerModule extend ReactContextBaseJavaModule

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D18718061

fbshipit-source-id: 70ba5c45b3ef1dd7602e1186763c8bc7ab5d4f42
2019-11-27 16:27:36 -08:00