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

17 Коммитов

Автор SHA1 Сообщение Дата
Joshua Gross 6abbef1200 CustomEvent and Event polyfills for React Native
Summary:
In preparation for upcoming changes, it is useful / necessary to have a CustomEvent and Event polyfill for React Native.

In browser environments, both of those are expected to be accessible in the global scope, so we do the same here.

Changelog: [Added][JS] Event and CustomEvent W3C-compatible polyfills

Reviewed By: necolas

Differential Revision: D34462447

fbshipit-source-id: 5efdad6f24c268a6d248d4e3351fc96715ee3fdf
2022-03-02 11:39:00 -08:00
Joshua Gross 271b9132bc Rename RawEventTelemetryEventEmitter to RawEventEmitter
Summary:
This event listener does nothing by default and will do nothing if (developer) users don't explicitly create some telemetry system for their own app.

This EventEmitter makes that easier but isn't necessarily tied to telemetry, especially since it does nothing at all by default.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D34060116

fbshipit-source-id: 9345a52f502e0225358fdaa1431c052a70fa54ce
2022-02-07 18:19:53 -08:00
Joshua Gross 1f15a64028 Add RawEventTelemetryEventEmitter interface to ReactNativePrivateInterface
Summary:
This will be used from the React JS renderer in a followup PR.

Changelog: [Added][JS] New event telemetry mechanism exposed from JS to supercede the Pressability-specific telemetry mechanism

Reviewed By: ryancat

Differential Revision: D33986916

fbshipit-source-id: 912d0b351869348f0ca6e5f6a882fc0501c2c7f0
2022-02-07 15:44:17 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Rubén Norte eccbf9b5cb Back out "Re-apply: [RN] Make runtime initialization from React renderers a no-op"
Summary:
Changelog: [internal]

This change had to be reverted because it caused some issues internally at Facebook. After we solved those we re-applied the changes but this also has issues in OSS apps. Specifically, the option in Metro to inject modules to execute before the EntryPoint (in this case `InitializeCore`) doesn't work if those modules aren't part of the bundle in the first place.

This reverts again so we can think about a long-term solution for this.

Original commit changeset: ba145a30ead5

Reviewed By: ShikaSD

Differential Revision: D31825736

fbshipit-source-id: 393b3d5d2a726951a9ac386dc2b1c19ef4a916a5
2021-10-21 04:29:07 -07:00
Rubén Norte 1486b31b2b Re-apply: [RN] Make runtime initialization from React renderers a no-op
Summary: Changelog: [internal]

Reviewed By: yungsters

Differential Revision: D31760907

fbshipit-source-id: ba145a30ead52abeb8affca84c3dec21dfefe30c
2021-10-20 04:06:20 -07:00
Oleksandr Melnykov f788aab45b Back out "Make runtime initialization from React renderers a no-op"
Summary: Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D31552508

fbshipit-source-id: 1821f97393e3b9c40bd484a0831eb8fbdfc4bb82
2021-10-11 15:51:54 -07:00
Rubén Norte b14b34b232 Make runtime initialization from React renderers a no-op
Summary:
This module is imported by all flavors of the React Native renderers (dev/prod, Fabric/Paper, etc.), which itself imports `InitializeCore`. This is effectively a no-op in most React Native apps because Metro adds it as a module to execute before the entrypoint of the bundle.

This import would be harmless if all React Native apps included all polyfills and globals, but some of them don't want to include everything and instead of importing `InitializeCore` they import individual setup functions (like `setupXhr`). Having this automatic import in the renderer defeats that purpose (most importantly for app size), so we should remove it.

The main motivation for this change is to increase the number (and spec-compliance) of Web APIs that are supported out of the box without adding that cost to apps that choose not to use some of them (see https://github.com/facebook/react-native/pull/30188#issuecomment-929352747).

Changelog: [General][Removed] Breaking: Removed initialization of React Native polyfills and global variables from React renderers.

Note: this will only be a breaking change for apps not using the React Native CLI, Expo nor have a Metro configuration that executes `InitializeCore` automatically before the bundle EntryPoint.

Reviewed By: yungsters

Differential Revision: D31472153

fbshipit-source-id: 92eb113c83f77dbe414869fbce152a22f3617dcb
2021-10-08 07:39:11 -07:00
Evan Yeung afe0c1daea Remove existential types from xplat/js
Summary: Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D29724915

fbshipit-source-id: 97cbeefbba2ddc2e1088dfe19db14fa545213549
2021-07-21 16:52:22 -07:00
Tim Yung ebc89bfb78 RN: Cleanup `ReactFiberErrorDialog`
Summary:
Minor cleanup of `ReactFiberErrorDialog` with no behavior changes.

Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D28423265

fbshipit-source-id: 796777ca2c26d6d7cfae956299786151c74e937f
2021-05-17 01:04:32 -07:00
Luna Wei bac2c2c801 Update FlowFixMes to use error codes in react-native-github
Summary:
Changelog:
[Internal] - Add error codes to existing FlowFixMe's

Reviewed By: kacieb

Differential Revision: D27445689

fbshipit-source-id: 2b19692e1cb822ab6785efcc5f93ee33e7dce1e5
2021-03-31 18:21:47 -07:00
Joshua Gross 99b7052248 Implement sendAccessibilityEvent in the React(Fabric/non-Fabric) renderer
Summary:
`sendAccessibilityEvent_unstable` is a cross-platform, Fabric/non-Fabric replacement for previous APIs (which went through UIManager directly on Android, and a native module on iOS).

Changelog: [Added] sendAccessibilityEvent_unstable API in AccessibilityInfo and sendAccessibilityEvent in React renderer

Reviewed By: kacieb

Differential Revision: D25821052

fbshipit-source-id: 03f7a9878c95e8395f9102b3e596bfc9f03730e0
2021-01-27 17:37:38 -08:00
Tim Yung 7e7527e7db RN: Preserve Style Type in `flattenStyle`
Summary:
Refactors `flattenStyle` so that it preserves the style type of the argument. This lets us avoid using `DangerouslyImpreciseStyleProp` where we can.

Changelog:
[Internal]

Reviewed By: JoshuaGross, nadiia, kacieb

Differential Revision: D25097227

fbshipit-source-id: df6af6fefab25dbb62e3c81897c3cef98619a9c7
2020-11-19 15:55:23 -08:00
Nick Gerleman 161b910494 Do not explicitly include ".js" in Library imports (#28311)
Summary:
A few recent imports have explicitly added ".js" to the end of their path. This prevents Metro from resolving platform-specific JS files, e.g. "Foo.android.js" or "Foo.windows.js" instead of "Foo.js".

React Native Windows provides its own implementation of files in a few cases where stock React Native will share them between Android and iOS. We hope to reduce/eliminate these long term, but requiring explicit ".js" files currently breaks us in a couple of places where we have custom implementations.

This change is a quick regex replace of ES6 and CommonJS imports in 'Libraries/" to eliminate ".js".

## Changelog

[General] [Fixed] - Do not explicitly include ".js" in Library imports
Pull Request resolved: https://github.com/facebook/react-native/pull/28311

Test Plan: I haven't done any manual validation of this, but `flow-check` should catch any issues with this during CI.

Reviewed By: cpojer

Differential Revision: D20486466

Pulled By: TheSavior

fbshipit-source-id: 31e1ccc307967417d7d09c34c859f0b2b69eac84
2020-03-17 02:11:53 -07:00
Logan Daniels 08daad4427 Add annotations to ReactNativePrivateInterface
Reviewed By: panagosg7

Differential Revision: D16946424

fbshipit-source-id: 90f13dd8bb25aac7ed8b2bebe6d7e49fa97958ff
2019-08-22 17:50:36 -07:00
Moti Zilberman a9cab21010 Add ReactFiberErrorDialog from React + tests (#25671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/25671

Moves the RN-specific `ReactFiberErrorDialog` implementation from React to RN for easier iteration. Also adds new unit tests.

This current change is additive, so we're compatible with the current React renderer which still uses `ExceptionsManager` and not the file added here. After the corresponding React update we can remove `ExceptionsManager` from the RN private interface entirely.

Reviewed By: cpojer

Differential Revision: D16278938

fbshipit-source-id: 0c2c0c3e65e524e079730ae3b0cc23e0c0bdc5fd
2019-07-16 03:21:07 -07:00
James Ide 9cd88251a3 ReactPrivate, an explicit interface between the renderer and RN (#24782)
Summary:
This introduces a new library named "ReactPrivate" that defines an explicit interface between the React renderers generated by the React repo and the code within RN. Previously, the React renderers would reach into RN internals via Haste wormholes. With this commit, there is now an explicit module (`ReactNativePrivateInterface`) that the renderers use to access RN internals.

Motivation: The main goal is to move one step closer to turning off Haste for RN (https://github.com/facebook/react-native/issues/24316). Since the generated renderers currently use Haste, this commit sets the foundation for giving them a path-based interface to access RN internals.

Additionally, this approach inverts abstraction control since RN needs to intentionally export its internals via the private interface instead of React reaching in via Haste.

There will also need to be a corresponding commit to the React repo to make the renderers use this new interface. This RN commit needs to land before the React commit.

## Changelog

[General] [Changed] - Add a private interface (do not use) between the renderer and RN
Pull Request resolved: https://github.com/facebook/react-native/pull/24782

Differential Revision: D15413477

Pulled By: cpojer

fbshipit-source-id: 3766ad4cf129fad0c82f0ddc7a485a4ba313b2c4
2019-05-20 07:16:57 -07:00