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

20095 Коммитов

Автор SHA1 Сообщение Дата
Moti Zilberman b4785e5144 Forward all bundle URL params through HMR and bundle splitting
Summary:
Forwards any extra parameters set on the main bundle URL (in development) to the derived bundle URLs used in hot reloading and bundle splitting.

Changelog: [General] - Forward URL parameters from main bundle to hot reloaded bundles

Reviewed By: cpojer

Differential Revision: D21455592

fbshipit-source-id: e1c375e3b6a0f3387372f1d96498dbf7d5237a09
2020-05-12 07:35:51 -07:00
Moti Zilberman 9b5359133b Add package name / bundle ID to bundle URL in development
Summary:
Adds the package name (Android) / bundle ID (iOS) as a new URL parameter named `app` in the bundle URL. This currently has no effect on Metro, which will ignore it for bundling / caching purposes.

Changelog: [General] - Add package name / bundle ID to bundle URL in development

Reviewed By: cpojer

Differential Revision: D21429764

fbshipit-source-id: 394fe50dba72219f7594ebeac9486a8264a836a6
2020-05-12 07:35:50 -07:00
Lulu Wu 63099c40e6 Migrate Android view managers to type-safe commands generated by JS codegen
Summary:
## Changelog:

[General] [Changed] - Migrate Android view managers to type-safe commands generated by JS codegen.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D21406461

fbshipit-source-id: 93584b240314254675a36a58c4d0c0880d6889fb
2020-05-12 04:37:44 -07:00
Samuel Susla 8f90ce26a5 Break retain cycle in RCTLegacyViewManagerInteropCoordinator
Summary: Breaks retain cycle by having weak reference to bridge.

Reviewed By: shergin

Differential Revision: D21501419

fbshipit-source-id: 7526ceefceb59e296c6f4944cac5069cb62b33a5
2020-05-12 03:48:30 -07:00
Janic Duplessis d30c920749 Mention using bundler to install cocoapods in RNTester README (#28873)
Summary:
This makes sure the proper version of cocoapods gets used, this will avoid noise in diffs if someone ends up updating pods with a different version.

## Changelog

[Internal] [Changed] - Mention using bundler to install cocoapods in RNTester README
Pull Request resolved: https://github.com/facebook/react-native/pull/28873

Test Plan: N/A

Differential Revision: D21519862

Pulled By: shergin

fbshipit-source-id: 3dc555bc3aee6bee10127ba5b5862302a63346c4
2020-05-11 23:28:59 -07:00
Emily Janzer 6c4224ea9b Use UIManagerHelper to access EventDispatcher in ReactViewManager
Summary:
ReactViewManager uses the bridge (CatalystInstance) to access the UIManagerModule in its onClick method. This doesn't work in bridgeless mode, so I'm replacing this callsite with the new API, which uses UIManagerHelper + the reactTag to look up the appropriate UIManager (Paper or Fabric), and get the EventDispatcher from that.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21510243

fbshipit-source-id: c2c6111e73c49ca6bf873819db8ece71c66417e4
2020-05-11 18:59:05 -07:00
Joshua Gross dba588741c Always run the momentum scroll Runnable so scroll position is updated on Fabric
Summary:
This early return is a very minor perf optimization, and it complicates things on Fabric: if scroll perf logging is disabled, the scroll position in C++ (State) doesn't get updated for the scrollview.

Just remove it. Always run the Runnable, no matter what.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D21503695

fbshipit-source-id: 13dfe232d692ff544bff725a2344a66b572f5444
2020-05-11 11:14:17 -07:00
Kevin Gozali 3c9013402e xplat code ownership
Summary:
For internal code attribution.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D21496969

fbshipit-source-id: 9fa27a758df19c16fd2087ce964132eaa70dc91f
2020-05-11 10:24:35 -07:00
Samuel Susla cde82b55fc Add comments to a test case in LayoutableShadowNodeTest
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21500371

fbshipit-source-id: daec07f82f43aae9cdc31f67599e30873ca108b9
2020-05-11 09:27:40 -07:00
Samuel Susla dd7b67168f Move SegmentedControl components to separate file and make them function based
Summary: Changelog: [Internal] Separate SegmentControl examples into separate file and make them functional based

Reviewed By: mdvacca

Differential Revision: D21475596

fbshipit-source-id: 19165232f2a8edefa66f122944621f93265ff704
2020-05-11 09:01:35 -07:00
Samuel Susla b87d67ef06 Use plugins for View component
Summary:
Leverage plugin infra for `View`

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21407611

fbshipit-source-id: d72d1e75bbd9d06c79544437bdd88f890086c587
2020-05-11 09:01:35 -07:00
Samuel Susla 5223127abc Use plugins for TextInput component
Summary:
Leverage plugin infra for `TextInput`

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21407584

fbshipit-source-id: 48b1a69aa834ab956724e6617197da57ccf99aa7
2020-05-11 09:01:34 -07:00
Samuel Susla 03ccb633a0 Use plugin architecture for Paragraph component
Summary:
Leverage plugin infra for `Paragraph`

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21404704

fbshipit-source-id: 7565014f1d88c4a0a47e0f10fdb3656b8276b1d0
2020-05-11 09:01:34 -07:00
Valentin Shergin 51740f8bb3 Fabric: Support for sync `RuntimeExecutor` in `executeSynchronouslyOnSameThread_CAN_DEADLOCK`
Summary:
The approach is quite simple: we check the thread id, and if it matches the caller thread id, we unlock mutexes which lead to the normal uninterrupted execution flow.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: RSNara

Differential Revision: D21328313

fbshipit-source-id: 4290b8a0357dbad3563d7da9464c03ecce5ded7c
2020-05-11 09:01:34 -07:00
Manvir Singh d54113d8c4 implemented showSoftInputOnFocus for iOS (#28834)
Summary:
`showSoftInputOnFocus` was added in https://github.com/facebook/react-native/issues/25028, but it was only added for Android. There was a lot of discussion on the original issue being addressed (https://github.com/facebook/react-native/issues/14045), that there is a need for this on iOS as well. The issue with iOS was brought up again on https://github.com/facebook/react-native/issues/27243.

On a related note, when searching this repo's issues for `showSoftInputOnFocus`, it appears that there are several closed issues that claim that the Android implementation doesn't work (https://github.com/facebook/react-native/issues/25685, https://github.com/facebook/react-native/issues/25687, https://github.com/facebook/react-native/issues/26643). So perhaps the Android implementation needs to be looked at as well (I myself have not gotten around to confirming whether it works or not)

## Changelog

[iOS] [Added] - Add showSoftInputOnFocus to TextInput
Pull Request resolved: https://github.com/facebook/react-native/pull/28834

Test Plan:
You'd use this just like you would in the Android implementation:
```jsx
<TextInput showSoftInputOnFocus={false} />
```

## GIFs
### Before change
![May-04-2020 20-52-49](https://user-images.githubusercontent.com/4932784/81034028-9d89cf80-8e4a-11ea-906c-64f62504f80c.gif)

### After change
![May-04-2020 20-54-27](https://user-images.githubusercontent.com/4932784/81034035-a11d5680-8e4a-11ea-918e-119a1c9e2a19.gif)

Differential Revision: D21418763

Pulled By: shergin

fbshipit-source-id: 561e72fc2cf16b30446132f6b96b8aa2b4a92daf
2020-05-11 09:01:33 -07:00
William Candillon 797367c089 Fix skewX on Android and in the JS decomposition (#28862)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/27649.

By using 2d decomposition that transforms a skewX into a rotate/scale/rotate, the skewX issue on Android was still there which made me suspect that the issue came from the decomposition algorithm. Then I noticed that the bug existed in the JavaScript decomposition as well which led me to a fix on the JS and therefore on the Android side most likely.

## Changelog

[Android] [Fixed] skewX transforms
Pull Request resolved: https://github.com/facebook/react-native/pull/28862

Test Plan:
Check that skewX works on Android.
On JS, making sure that processTransform() doesn't skip, you can try the following sequence:

```tsx
  const matrix = processTransform([{ skewX: `${Math.PI / 3}rad` }]);
  const result = MatrixMath.decomposeMatrix(matrix);
  console.log({ result });
```

Differential Revision: D21493021

Pulled By: shergin

fbshipit-source-id: 89f7aca5fbfd0f0f8c6f90a26bd76bf8550acaa5
2020-05-11 09:01:33 -07:00
William Candillon 4b956fe5a6 Fix skewX/skewY/perspective/matrix on iOS (#28863)
Summary:
See discussion on c68195929b (commitcomment-38965326)

This PR fixes skewX/skewY/perspective/matrix on iOS as seen on this video: https://youtu.be/LK9iOKk62nw?t=115

## Changelog

[iOS] [Fixed] Bug with skewX/skewY/perspective/matrix transforms.
Pull Request resolved: https://github.com/facebook/react-native/pull/28863

Test Plan:
Try that the following transform as been fixed on iOS

```tsx
<View
  style={{ transform: [{ rotateZ: Math.PI / 2}, { skewX: Math.PI/6 }] }}
/>
```

Differential Revision: D21493022

Pulled By: shergin

fbshipit-source-id: 4bf3550941e8acd8fdb87fe1143b21639c95b059
2020-05-11 09:01:33 -07:00
Valentin Shergin f05fff6a68 Fabric: Using `PlatformRunLoopObserver` instead of `MainRunLoopEventBeat` and `RuntimeEventBeat` on iOS (gated)
Summary:
This diff implements iOS-specific `PlatformRunLoopObserver` (and `MainRunLoopObserver`) that then being glued together with `SynchronousEventBeat` replaces `MainRunLoopEventBeat`, and then same thing glued with `AsynchronousEventBeat` replaces `RuntimeEventBeat`.

So, instead of two platform-specific classes we had on iOS (for that needs), now we have only one (that can be reused for a more broad variety of applications).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21341998

fbshipit-source-id: fafde4e678770f7fcf9c1ff87acc02812a37e708
2020-05-11 09:01:33 -07:00
Valentin Shergin ebdd59aff8 Fabric: Initializing EventBeat::OwnerBox with non-null value ahead of time
Summary:
We use `EventBeat::OwnerBox` in the `EventBeat` infra to represent weak ownership of classes that contain that, so those classes can ensure own life-time at some critical points.
Before this diff, we stored a pointer to EventDispatcher right after we create it. However, some components that we build require to have a valid pointer from the beginning (even before the EventDispatcher is created). To satisfy this requirement, we create a dummy pointer first and use it as an owner, then we merge (share control block) the pointer to an EventDispatcher into that. It works because the owner pointer never gets dereferenced (it's `void *`), so it does not matter which object it represents while it represents correct ownership.

In the future, this approach will allow us to remove the concept of `OwnerBox` completely and use just `std::weak_ptr<void>` instead.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21441109

fbshipit-source-id: 7457c77bd31cd577f38a26e28e27eb7e33b6ad24
2020-05-11 09:01:32 -07:00
Valentin Shergin b65b00ab6b Fabric: Fixed incorrect name of the prop value `justifyContent=space-between`
Summary:
The name of the value was incorrect.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21496651

fbshipit-source-id: 464c98436bb8d5f2b6275b7eab1c32d187e2b23c
2020-05-10 18:27:41 -07:00
Kevin Gozali e57a2d80a5 OSS: fixed incorrect license headers on some files
Summary:
de667fffa4 (commitcomment-39068402) had incorrect license headers. This fixed them.

Changelog: [General] [Fixed] - fixed license headers on some files

Reviewed By: cpojer

Differential Revision: D21496796

fbshipit-source-id: f9d6b0cf4af0ecf6caacbae2396d73efbc4975fe
2020-05-10 16:16:30 -07:00
Valentin Shergin 497191601b Fabric: Checks for corner cases in UIManager::getNewestCloneOfShadowNode
Summary:
We should check for corner cases.
Another interesting detail is behavior. Now (and previously) we return nullptr if case we could not find the most recent node. But maybe we should return the given node instead?

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21480874

fbshipit-source-id: bb943c4508ec025316a3665d652e4b5e06dd795c
2020-05-10 13:28:46 -07:00
Valentin Shergin 0d2fcb1ed7 Fabric: Making `UIManager::getNewestCloneOfShadowNode` even more safer
Summary:
We cannot use a raw pointer here because the tree might progress right after we call to `shadowTree.tryCommit` and we will get a dangling pointer as a result.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21464832

fbshipit-source-id: 3998b39d29db672da54d4adcb6be55cd3d44d862
2020-05-10 13:28:46 -07:00
Valentin Shergin 604402678b Fabric: Making `UIManager::getRelativeLayoutMetrics` safer
Summary:
In this method we have to maintain a retaining pointer to the node in order to access it as a raw pointer.
See also a comment in the codee.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D21464834

fbshipit-source-id: 69f6894009509e5feca291fab12c019208933816
2020-05-10 13:28:46 -07:00
Valentin Shergin af1fe62ae0 Fabric: Changes in UIManager::getNewestCloneOfShadowNode to make it safer
Summary:
There is no need to use a raw pointer to a shared pointer as a return value of `UIManager::getNewestCloneOfShadowNode`. If it would be a very hot path, we could you a raw pointer to the node instead but it's not a hot path.
Prooving that using a raw pointer here is safe is quite complex (and I don't know if it's safe or not). So, I changed it to just a shared pointer.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D21464833

fbshipit-source-id: 813a3c9fca0147afb322db6855a0ce8fd2d47909
2020-05-10 13:28:45 -07:00
Joshua Gross 03ef81bfa2 Fix taps not working after scrolling / scroll position not being updated in C++
Summary:
Problem: ScrollView offset was not being reported to the C++ ScrollView side of Fabric.
This results in taps not working correctly, for example if you tap a button inside scroll view after you scrolled, the tap might not trigger anything.
The root cause of this is our implementation of detecting whether scroll view has stopped scrolling.
To make this more robust, I now require that multiple "frames" have not scrolled because it's easy to trigger race conditions by scrolling very fast.
We also explicitly call `updateStateOnScroll` in a couple more places.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21496396

fbshipit-source-id: 2e565dd2fc4fc1ce582daa8a449c520e7cb19be0
2020-05-10 12:58:49 -07:00
Tim Yung a1ac2518a3 TextInput: Default `blurOnSubmit` in JS
Summary:
Consolidates the logic for the default value of `blurOnSubmit` on `TextInput` in the JavaScript component.

This only materially impacts Fabric.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D21491482

fbshipit-source-id: 16d8aba32e7d0321a4583e87e03405ea587e35d4
2020-05-09 17:24:19 -07:00
Valentin Shergin aece57be29 Fabric: Calling JSVM GC on memory pressure event on iOS
Summary:
This change is especially important for Fabric when a lot of objects (mostly `ShadowNode`s) have shared ownership. Without this change, JSVM could not know that bunch of natively allocated objects should be deallocated.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: dulinriley

Differential Revision: D21484773

fbshipit-source-id: 46e32de0f108082e60df346884c9287023156149
2020-05-08 17:34:15 -07:00
David Vacca f535c8b4bb Inject ImagePipeline into FrescoModule
Summary:
This diff refactors the FrescoModule in order to receive an ImagePipeline as a parameter. This is necessary to ensure the same ImagePipeline is used by every RN module

changelog: [Internal][Android]

Reviewed By: JoshuaGross

Differential Revision: D21428346

fbshipit-source-id: 70a6cc57c8585fe74b6d0b0d1fd86c539974ec23
2020-05-08 16:37:41 -07:00
Emily Janzer a4a47b9a1e Expose RuntimeExecutor on CatalystInstance (#28851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28851

This diff creates a RuntimeExecutor that uses the bridge and exposes it on CatalystInstanceImpl.

Changelog: [Internal]

Reviewed By: mdvacca, RSNara

Differential Revision: D21051949

fbshipit-source-id: b3977fc14fa19089f33e297d29cedba0d067526d
2020-05-08 16:13:42 -07:00
Peter Argany 13ee5c4c16 Enable animations in bridgeless mode on iOS
Reviewed By: ejanzer

Differential Revision: D21465166

fbshipit-source-id: b34e8e97330b897e20d9a4b05dba1826df569e16
2020-05-08 16:13:42 -07:00
Samuel Susla 77d1380f17 Remove RCTLogError from RCTScrollViewManager.calculateChildFrames
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21483553

fbshipit-source-id: 0c681979a4988c36cfa6f05aa5bca896590f9e3d
2020-05-08 15:45:37 -07:00
empyrical c67e1fe42f Codegen: Add prepublish script to build Flow files (#28827)
Summary:
*This is a follow-up to https://github.com/facebook/react-native/issues/28645, redone using a build script based off of Metro's build script instead of using `flow-remove-types` and `flow-copy-source`.*

This pull request adds a build step to `react-native-codegen` that builds the Flow-annotated JS files so that users of the NPM module `react-native-codegen` do not need to use require hooks to be able to import it.

A new build script, `scripts/build.js` is added that builds every JS file in `src/` into a `lib/` folder, and also copies over the original Flow annotated files to `lib/` with a `.js.flow` extension, so users of `react-native-codegen` can still typecheck against it using Flow. The shell scripts in `src` are also copied over. It is based off of the [build script from Metro](00867816eb/scripts/build.js)

## Changelog

[General] [Added] - Codegen: Add prepublish script to build Flow files
Pull Request resolved: https://github.com/facebook/react-native/pull/28827

Test Plan:
I am able to make use of the Codegen scripts without needing to use the `flow-node` CLI or the `flow-remove-types/register`
require hook.

Reviewed By: cpojer

Differential Revision: D21412173

Pulled By: hramos

fbshipit-source-id: 26ae67cdd04652ca4700a069a234a25558773cb1
2020-05-08 15:41:35 -07:00
Enes 69ce9c21d4 Update .gitignore (#28789)
Summary:
When you profile your heap and memory allocations with Memory Profiler, files with *.hprof extension are created in /android folder that has big sizes (up to 600 MB for each). These files may be needed to add to gitignore.

## 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
-->

[Android] [Added] - Add *.hprof files to gitignore
Pull Request resolved: https://github.com/facebook/react-native/pull/28789

Differential Revision: D21432927

Pulled By: hramos

fbshipit-source-id: a20f12645de5ca0874c9130094e2f97fe16b2203
2020-05-08 15:36:15 -07:00
Héctor Ramos 91a49d8827 Add script to generate native modules specs with react-native-codegen
Summary:
Adds a script that uses `react-native-codegen` to generate FBReactNativeSpec.
The generated output should not be considered ready for production use at this time.
The goal of adding this script at this time is to demonstrate the current status of native modules specs code generation in open source.

For example, the generated output may be used in RNTester, with some modifications due to some naming differences in react-native-codegen's output when compared to the FBReactNativeSpec files generated by the old codegen.

Usage:

```
./scripts/generate-native-modules-specs.sh ./codegen-out
```

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21471004

fbshipit-source-id: 5ff3c57807d9ba2c91dc7fe32d227d218732b059
2020-05-08 12:23:35 -07:00
Kevin Gozali 164d47f30a label react-native-github targets
Summary:
For internal code attribution.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D21468924

fbshipit-source-id: 59cd2a52e0ae46bedbf54816820a5f40b684da8b
2020-05-08 00:36:17 -07:00
Will Holen bf837d6373 Add support for Debugger.setInstrumentationBreakpoint
Summary:
This diff adds support for the "beforeScriptWithSourceMapExecution" instrumentation
breakpoint via "Debugger.setInstrumentationBreakpoint".

CDP describes it as a breakpoint, but we just set a flag in the inspector. A
fake breakpoint ID is synthesized for optional removal later.

Changelog: [Internal] Add Debugger.setInstrumentationBreakpoint to Hermes Inspector

Reviewed By: mhorowitz

Differential Revision: D21418218

fbshipit-source-id: 90fa49c0954980993815322d3a7effee416ed5db
2020-05-07 21:05:30 -07:00
Will Holen 938aa86013 Remove Hermes.setPauseOnLoad message
Summary:
This removes the Hermes.setPauseOnLoad. It will be replaced by the more standard
Debugger.setInstrumentationBreakpoint's "beforeScriptExecution" event.

ChangeLog: [Internal] Remove Hermes.setPauseOnLoad message (to be replaced)

Reviewed By: mhorowitz

Differential Revision: D21418219

fbshipit-source-id: 93c53801c23487f9336b322c2bd737663ec21b97
2020-05-07 21:05:30 -07:00
David Vacca 14a0f3fdea Eager initialize Fabric Android classes
Summary:
This diff eager initializes Fabric Android classes. This should help load all the Fabric classes at Bridge load time.

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21460507

fbshipit-source-id: 4b8d5c4e2d19e3a7eb3077027071e64ff16f1cbd
2020-05-07 18:04:54 -07:00
Héctor Ramos 6e88ab6bb2 Avoid redefining id when a property is named 'id'
Summary:
Handle properties named 'id' as a special case.

An example of a native module that ran afoul of this is `ExceptionsManager`.

Observe how the ExceptionsManager spec at `Libraries/Core/NativeExceptionsManager.js` defines the ExceptionData type as containing an `id` property:

```
export type ExceptionData = {
  message: string,
  originalMessage: ?string,
  name: ?string,
  componentStack: ?string,
  stack: Array<StackFrame>,
  id: number,
  isFatal: boolean,
  // flowlint-next-line unclear-type:off
  extraData?: Object,
  ...
};
```

Prior to this change, the generated code would redefine id in the SpecReportExceptionData struct...

```
 namespace JS {
   namespace NativeExceptionsManager {
     struct SpecReportExceptionData {
       // ...redacted...
       double id() const; <---
       // ...redacted...

       SpecReportExceptionData(NSDictionary *const v) : _v(v) {}
     private:
       NSDictionary *_v;
     };
   }
 }
```

...which would result in a build time error:

```
 inline double JS::NativeExceptionsManager::SpecReportExceptionData::id() const
 {
   id const p = _v[@"id"];
   ^--- build time error here
   return RCTBridgingToDouble(p);
 }
```

Comparing the above example  with the currently checked in `FBReactNativeSpec.h`, I see the expected output should be:

```
 namespace JS {
   namespace NativeExceptionsManager {
     struct SpecReportExceptionData {
       // ...redacted...
       double id_() const;
       // ...redacted...

       SpecReportExceptionData(NSDictionary *const v) : _v(v) {}
     private:
       NSDictionary *_v;
     };
   }
 }
```

...and...

```
inline double JS::NativeExceptionsManager::SpecReportExceptionData::id_() const
 {
   id const p = _v[@"id"];
   return RCTBridgingToDouble(p);
 }
```

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21395463

fbshipit-source-id: e412648013ff9f70ebd294b6f5f81f1faccb4604
2020-05-07 17:58:00 -07:00
Héctor Ramos 853dc04d23 Handle optional return types/values
Summary:
Use folly to wrap optional return types and values as needed.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21395439

fbshipit-source-id: a0e84e20717887e79a8565332a11fef42ebd3487
2020-05-07 17:57:59 -07:00
David Vacca 11b9bad5b4 Small refactor on text measure method
Summary:
Quick refactor of TextLayoutManager class

changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21446736

fbshipit-source-id: a32bdf534b167e128c8c0054cf6a126131fa740a
2020-05-07 17:11:49 -07:00
David Vacca 561a97f699 Extend Text measurement to support includeFontPadding prop
Summary:
This diff exposes the Text.includeFontPadding prop to java, then it uses the prop to calculate the height of Text components correctly.

changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric

Reviewed By: shergin

Differential Revision: D21446737

fbshipit-source-id: efe73fb6b0d402c3275ac8c012fa8fa06b743bdd
2020-05-07 17:11:48 -07:00
David Vacca 4e59508a8e Extend ParagraphAttribute to store the includeFontPadding prop
Summary:
This diff extends the ParagraphAttribute class to store the value of the includeFontPadding prop.
Note that this is an Android only prop, I'm not creating android blocks to improve "cleanliness" of the code.

changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric

Reviewed By: shergin

Differential Revision: D21446738

fbshipit-source-id: 0543e86aa18ce10f7a56bbaafe111cce0179ea86
2020-05-07 17:11:48 -07:00
João Vieira 16ea9ba813 Support excluding multiple platforms.
Summary:
Currently the schema only allows to exclude a single platform (iOS OR Android). There are cases where we need to exclude multiple. This change converts the previous `excludePlatform` string property into an `excludePlatforms` array.

Changelog:
[Internal][Changed] - Added support to exclude multiple platforms in Codegen.

Reviewed By: sammy-SC

Differential Revision: D21426950

fbshipit-source-id: eff36ffa207109274794b4b300bf6313f8286161
2020-05-07 09:43:52 -07:00
Eloy Durán 7bb1c4e1b8 Enable with CocoaPods `:configuration` (#28796)
Summary:
~~⚠️ Depends on https://github.com/facebook/flipper/pull/1086 and a new Flipper release.~~
Fixes 17f025bc26 (commitcomment-38831234)

Currently user’s are being told to add a definition of the `FB_SONARKIT_ENABLED` macro and examples, including those in stock React Native templates, set this for the user by making use of a `post_install` hook in the user’s `Podfile`. This leads to confusion, fragile code [when a user’s project dir structure deviates from vanilla], and is ultimately not necessary as CocoaPods already has dedicated mechanisms to:

* specify build settings (through the `xcconfig` property);
* and selectively include certain pods only in certain build configurations (e.g. debug).

## 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] [Changed] - Entirely control Flipper being enabled through inclusion in Podfile and optionally limiting to certain build configurations using the `:configuration` directive.
Pull Request resolved: https://github.com/facebook/react-native/pull/28796

Test Plan: Tested using the changes of https://github.com/facebook/flipper/pull/1086 in a new app that uses RN `master`.

Reviewed By: priteshrnandgaonkar

Differential Revision: D21449754

Pulled By: passy

fbshipit-source-id: 9ff7c7f4ffc32b364b1edd82b94e0b80c3997625
2020-05-07 08:36:55 -07:00
Rubén Norte 26c120c632 Handle initialProps as optional in renderApplication
Summary:
Pass a default empty object to `AppContainer` if no `initialProps` were passed to `renderApplication`.

This prevents issues on Android, where we do not pass a default empty `initialProps` from native, as we do on iOS.

Changelog: [General] [Fixed] - Handle nullish `initialProps` correctly in `renderApplication`

Reviewed By: motiz88

Differential Revision: D21448692

fbshipit-source-id: 9630bdc2414532999abf3bf9da25047f0482fcab
2020-05-07 05:02:26 -07:00
Pieter De Baets e566c7ec7b Add virtual destructor to JSError
Summary:
We consume Hermes through multiple .so's, which means we have multiple (weak) typeinfo definitions of facebook::jsi::JSError. Previously we were using gnustl, which would strcmp typeinfo to decide whether a certain exception handler applies, which meant this didn't cause any major issues. However since this is deprecated, we recently switched to libc++, which does not have this by behaviour (or it does, but behind a flag I'm not sure how to enable). This causes any JS exceptions to fall through from our exception handlers and fatal the app.

This problem is actually documented in the common Android NDK problems page: https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md#rtti_exceptions-not-working-across-library-boundaries

The suggested solution is to ensure that any exception types have a key function defined (a non-pure, out-of-line virtual function). The simplest one to add is a virtual destructor. This makes the object file that holds the implementation of the destructor export a non-weak typeinfo definition which will at load time override the other weak versions.

I'm not sure why we're the first to hit this. RN's JSIExecutor doesn't explicitly reference JSError which probably helps (https://github.com/facebook/react-native/blob/master/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp#L256-L258) and they also don't use unguarded callbacks like we do.

Changelog: [Internal]

Reviewed By: mhorowitz

Differential Revision: D21426524

fbshipit-source-id: 474284ada1ca2810045dc4402c420879447f9308
2020-05-07 04:15:14 -07:00
Yuanzhe Bian 851644cfc2 Fix Animated type
Summary:
- Fixed typing of Animated and fixed the callsites

Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D21311870

fbshipit-source-id: 386fb496ab00ef7917273dc3eb65e1ed76a8dd33
2020-05-07 00:06:27 -07:00
Nikita Lutsenko f4815fbad3 third-party | Move glog from xplat/third-party to third-party and create temporary redirect.
Summary:
Move and create an empty rule that redirects as well, to handle //arvr rules
Need to do this way, since ovrsource sync rules are in different repo.

allow_many_files
allow-large-files

Steps:
- [X] Move glog from xplat/third-party to /third-party
- [ ] Update references in ovrsource to translate to //third-party instead of //xplat/third-party
- [ ] Get rid of temporary rule
- [ ] Update fbsource/third-party/glog to 0.3.5 (what we have in ovrsource)

Changelog: [Internal] Update reference for glog from xplat/third-party to /third-party.

Reviewed By: yfeldblum

Differential Revision: D21363584

fbshipit-source-id: c1ffe2dd615077170b03d98dcfb77121537793c9
2020-05-06 19:04:33 -07:00