Commit Graph
233 Commits
Author SHA1 Message Date
Sebastian MarkbågeandGitHub 96e5d57d2f Move some files out of /shared and rename to upper case (#18363)
* Rename lower case isomorphic default exports modules to upper case named exports

We're somewhat inconsistent here between e.g. ReactLazy and memo.

Let's pick one.

This also moves the responder, fundamental, scope creators from shared
since they're isomorphic and same as the other creators.

* Move some files that are specific to the react-reconciler from shared

Individual renderers are allowed to deep require into the reconciler.

* Move files specific to react-dom from shared

react-interactions is right now dom specific (it wasn't before) so we can
type check it together with other dom stuff. Avoids the need for
a shared ReactDOMTypes to be checked by RN for example.

* Move ReactWorkTags to the reconciler

* Move createPortal to export from reconciler

Otherwise Noop can't access it since it's not allowed deep requires.
2020-03-21 15:22:01 -07:00
Dominic GannawayandGitHub 251bdbfbab ReactDOM.useEvent: wire to event system to the hook (#18304) 2020-03-16 21:46:17 +00:00
Dominic GannawayandGitHub 5e0aedd107 Address feedback for accumulateTwoPhaseListeners (#18289) 2020-03-12 21:48:29 +00:00
Dominic GannawayandGitHub 43935eb2ea ReactDOM.useEvent: more scaffolding changes (#18282) 2020-03-12 09:12:06 +00:00
Sebastian Markbage dc58c42bc5 Revert "[React Native] Add getInspectorDataForViewAtPoint (#18233)"
This reverts commit 58f211efdd.
2020-03-11 10:05:26 -07:00
RickyandGitHub 58f211efdd [React Native] Add getInspectorDataForViewAtPoint (#18233) 2020-03-11 16:12:41 +00:00
Dominic GannawayandGitHub b4b497e930 ReactDOM.useEvent: Add more scaffolding for useEvent hook (#18271) 2020-03-10 20:31:12 +00:00
Sebastian MarkbågeandGitHub 46e7629f67 Refactor Host Config Infra (getting rid of .inline*.js) (#18240)
* Require deep for reconcilers

* Delete inline* files

* Delete react-reconciler/persistent

This no longer makes any sense because it react-reconciler takes
supportsMutation or supportsPersistence as options. It's no longer based
on feature flags.

* Fix jest mocking

* Fix Flow strategy

We now explicitly list which paths we want to be checked by a renderer.
For every other renderer config we ignore those paths.

Nothing is "any" typed. So if some transitive dependency isn't reachable
it won't be accidentally "any" that leaks.
2020-03-06 16:20:42 -08:00
Eli WhiteandGitHub 473aa8c5e0 [Native] Enable and remove targetAsInstance feature flag. (#18182) 2020-02-28 13:45:42 -08:00
71e4780c72 [Fabric] Fix targetAsInstance dispatchEvent "cannot read property of null" (#18156)
* Fix Fabric targetAsInstance dispatchEvent: targetFiber stateNode is null in some cases

Co-authored-by: Dan Abramov <[email protected]>
2020-02-27 17:23:25 -08:00
Dan AbramovandGitHub 4e59e9ba18 Remove runtime dependency on prop-types (#18127)
* Remove runtime dep on prop-types

* Fix test
2020-02-28 01:21:54 +00:00
Sebastian MarkbågeandGitHub 9ed991380c Convert React Native builds to named exports (#18136)
These don't need any forks because we always export the same things atm.
2020-02-27 11:33:44 -08:00
Sebastian MarkbågeandGitHub ad1819c135 Export React as Named Exports instead of CommonJS (#18106)
* Add options for forked entry points

We currently fork .fb.js entry points. This adds a few more options.

.modern.fb.js - experimental FB builds
.classic.fb.js - stable FB builds
.fb.js - if no other FB build, use this for FB builds
.experimental.js - experimental builds
.stable.js - stable builds
.js - used if no other override exists

This will be used to have different ES exports for different builds.

* Switch React to named exports

* Export named exports from the export point itself

We need to re-export the Flow exported types so we can use them in our code.

We don't want to use the Flow types from upstream since it doesn't have the non-public APIs that we have.

This should be able to use export * but I don't know why it doesn't work.

This actually enables Flow typing of React which was just "any" before.
This exposed some Flow errors that needs fixing.

* Create forks for the react entrypoint

None of our builds expose all exports and they all differ in at least one
way, so we need four forks.

* Set esModule flag to false

We don't want to emit the esModule compatibility flag on our CommonJS
output. For now we treat our named exports as if they're CommonJS.

This is a potentially breaking change for scheduler (but all those apis
are unstable), react-is and use-subscription. However, it seems unlikely
that anyone would rely on this since these only have named exports.

* Remove unused Feature Flags

* Let jest observe the stable fork for stable tests

This lets it do the negative test by ensuring that the right tests fail.

However, this in turn will make other tests that are not behind
__EXPERIMENTAL__ fail. So I need to do that next.

* Put all tests that depend on exports behind __EXPERIMENTAL__

Since there's no way to override the exports using feature flags
in .intern.js anymore we can't use these APIs in stable.

The tradeoff here is that we can either enable the negative tests on
"stable" that means experimental are expected to fail, or we can disable
tests on stable. This is unfortunate since some of these APIs now run on
a "stable" config at FB instead of the experimental.

* Switch ReactDOM to named exports

Same strategy as React.

I moved the ReactDOMFB runtime injection to classic.fb.js

Since we only fork the entrypoint, the `/testing` entrypoint needs to
be forked too to re-export the same things plus `act`. This is a bit
unfortunate. If it becomes a pattern we can consider forking in the
module resolution deeply.

fix flow

* Fix ReactDOM Flow Types

Now that ReactDOM is Flow type checked we need to fix up its types.

* Configure jest to use stable entry for ReactDOM in non-experimental

* Remove additional FeatureFlags that are no longer needed

These are only flagging the exports and no implementation details so we
can control them fully through the export overrides.
2020-02-25 13:54:27 -08:00
Eli WhiteandGitHub 87bf5810be [Native] Migrate focus/blur to call TextInputState with the host component (#18068) 2020-02-19 11:33:40 -08:00
Dominic GannawayandGitHub 4f4af686a8 Refactor DOM plugin system to single module (#18025) 2020-02-14 08:10:42 +00:00
Eli WhiteandGitHub b2c103652d [Native] Delete NativeComponent and NativeMethodsMixin (#18036)
* [Native] Delete NativeComponent and NativeMethodsMixin

* Remove more files
2020-02-13 15:09:25 -08:00
Dan AbramovandGitHub f49e5bfacb Fix Flow type for React Native (#17992) 2020-02-06 18:31:13 +00:00
Nicolas GallagherandGitHub 77f7835a5f Update to [email protected] (#17842) 2020-01-22 10:02:30 -08:00
EmilyandBrian Vaughn a2677e9133 Create ReactFabric.stopSurface and use that for bridgeless mode binding (#16164) 2020-01-10 10:21:32 -08:00
Dan AbramovandGitHub fe1bbbae20 Update Flow to 0.84 (#17805)
* Update Flow to 0.84

* Fix violations

* Use inexact object syntax in files from fbsource

* Fix warning extraction to use a modern parser

* Codemod inexact objects to new syntax

* Tighten types that can be exact

* Revert unintentional formatting changes from codemod
2020-01-09 14:50:44 +00:00
Dan AbramovandGitHub 6e9c0d3038 Bump Prettier (#17811)
* Bump Prettier

* Reformat

* Use non-deprecated option
2020-01-09 13:54:11 +00:00
Eli WhiteandGitHub 17844ca3b8 Revert "Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232)" (#17799)
* Revert "Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232)"

This reverts commit c443904b55.

* Clean up another __DEV__ warning check
2020-01-07 16:47:19 -08:00
Eli WhiteandDan Abramov f7fe9fc238 Make HostComponent inexact (#17412) 2019-12-18 18:21:42 +00:00
Dominic GannawayandGitHub c711197b36 [react-interactions] Rename Flare APIs to deprecated and remove from RN (#17644) 2019-12-18 10:24:46 +00:00
Dan AbramovandGitHub 0809ba8020 Rename toWarnDev -> toErrorDev, toLowPriorityWarnDev -> toWarnDev (#17605)
* Rename toWarnDev -> toErrorDev in tests

* Rename toWarnDev matcher implementation to toErrorDev

* Rename toLowPriorityWarnDev -> toWarnDev in tests and implementation
2019-12-16 12:48:16 +00:00
Dan AbramovandGitHub d90d691d4a Use console directly instead of warning() modules (#17599)
* Replace all warning/lowPriWarning with console calls

* Replace console.warn/error with a custom wrapper at build time

* Fail the build for console.error/warn() where we can't read the stack
2019-12-14 18:09:25 +00:00
Dan AbramovandGitHub 9463b12510 Add component stacks to (almost) all warnings (#17586) 2019-12-12 23:47:55 +00:00
Dominic GannawayandGitHub 78238afe96 [react-interactions] Remove responder root event types + revert commit phase change (#17577) 2019-12-11 16:48:46 +00:00
Laura bunsandDan Abramov 96b5edde35 Remove the condition argument from warning() (#17568)
* prep for codemod

* prep warnings

* rename lint rules

* codemod for ifs

* shim www functions

* Handle more cases in the transform

* Thanks De Morgan

* Run the codemod

* Delete the transform

* Fix up confusing conditions manually

* Fix up www shims to match expected API

* Also check for low-pri warning in the lint rule
2019-12-11 03:28:14 +00:00
Laura bunsandDan Abramov 0cee996ff7 Replace wrap-warning-with-env-check with an eslint plugin (#17540)
* Replace Babel plugin with an ESLint plugin

* Fix ESLint rule violations

* Move shared conditions higher

* Test formatting nits

* Tweak ESLint rule

* Bugfix: inside else branch, 'if' tests are not satisfactory

* Use a stricter check for exactly if (__DEV__)

This makes it easier to see what's going on and matches dominant style in the codebase.

* Fix remaining files after stricter check
2019-12-06 18:25:54 +00:00
Dominic GannawayandGitHub bba3bf6191 [react-interactions] Refine custom active element blur logic (#17354) 2019-11-13 20:46:00 +00:00
Eli WhiteandGitHub 25765919c4 [Native] If statement cleanup for null targets (#17346) 2019-11-11 12:58:30 -08:00
Eli WhiteandGitHub 4fa3f1fc48 [Native] Add FeatureFlag to dispatch events with instance currentTarget (#17345)
* [Native] Add FeatureFlag to dispatch events with instance targets

* Prettier

* [Native] Change currentTarget to be an instance behind a flag 2/2
2019-11-11 12:42:06 -08:00
Eli WhiteandGitHub b89260af5a [Native] Add FeatureFlag to dispatch events with instance targets (#17323)
* [Native] Add FeatureFlag to dispatch events with instance targets

* Prettier
2019-11-11 11:35:29 -08:00
Eli WhiteandGitHub 2c8430f1fd Change legacy-events plugin nativeEventTarget to allow null (#17344) 2019-11-11 11:22:41 -08:00
Moti ZilbermanandDan Abramov a7778dcb38 [RN] Hoist static deepDiffer options object (#17303) 2019-11-07 16:03:55 +00:00
Moti ZilbermanandGitHub 53c7208c33 Update deepDiffer usage in React Native renderer (#17282)
* Add RN prop diffing test with function values

* Update RN deepDiffer mock

* Explicitly ignore functions in RN prop differ
2019-11-07 04:00:20 -08:00
Eli WhiteandGitHub c72d0433bf Types: findHostInstance_DEPRECATED returns React.ElementRef<HostComponent<mixed>> (#17265)
* Types: findHostInstance_DEPRECATED returns React.ElementRef<HostComponent<mixed>>

* Prettier
2019-11-04 10:14:01 -08:00
Eli WhiteandGitHub c443904b55 Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232)
This reverts commit a90e32d1c2.
2019-10-30 18:03:37 -07:00
Eli WhiteandTimothy Yung f7f390580f Rename findHostInstance_deprecated to findHostInstance_DEPRECATED (#17228) 2019-10-30 13:10:16 -07:00
Eli WhiteandGitHub edc84bcbb0 Add findHostInstance_deprecated to the React Native Renderer (#17224) 2019-10-30 11:42:37 -07:00
Eli WhiteandGitHub a90e32d1c2 Dispatch commands to both UIManagers from both renderers (#17211)
* Dispatch commands to both UIManagers from both renderers

* Merge test files
2019-10-29 18:16:23 -07:00
Andrew ClarkandGitHub 1d8fcd7e8e Pass prod error messages directly to constructor (#17063)
* Remove "Invariant Violation" from dev errors

When I made the change to compile `invariant` to throw expressions, I
left a small runtime to set the error's `name` property to "Invariant
Violation" to maintain the existing behavior.

I think we can remove it. The argument for keeping it is to preserve
continuity in error logs, but this only affects development errors,
anyway: production error messages are replaced with error codes.

* Pass prod error messages directly to constructor

Updates the `invariant` transform to pass an error message string
directly to the Error constructor, instead of mutating the
message property.

Turns this code:

```js
invariant(condition, 'A %s message that contains %s', adj, noun);
```

into this:

```js
if (!condition) {
  throw Error(
    __DEV__
      ? `A ${adj} message that contains ${noun}`
      : formatProdErrorMessage(ERR_CODE, adj, noun)
  );
}
```
2019-10-11 09:10:40 -07:00
Eli WhiteandGitHub 82c9b97f6d Stop warning about setNativeProps being deprecated (#17045)
* Stop warning about setNativeProps being deprecated

* Remove ReactNative.setNativeProps

* Remove more Fabric tests
2019-10-08 11:21:20 -07:00
Dominic GannawayandGitHub 177752a7b3 [react-interactions] Adds more experimental Scope API methods (#17042) 2019-10-08 19:32:53 +02:00
Dominic GannawayandGitHub 95abd39733 [react-interactions] Remove context.setTimeout & context.clearTimeout (#17000) 2019-10-03 13:37:37 +02:00
Eli WhiteandGitHub 5771116472 Remove unused canonical check in fiber host component (#16914) 2019-10-02 11:07:20 -07:00
Nicolas GallagherandGitHub 47595258f0 Move eventSystemFlags to last argument in event plugin extractors (#16978)
Fix for necolas/react-native-web#1443
2019-10-02 10:31:15 -07:00
Sebastian MarkbågeandGitHub 3441db83f9 Remove enableUserBlockingEvents flag (#16882)
Seems like this worked out. We can clean up the flag now.
2019-09-27 19:46:56 -07:00
Eli WhiteandGitHub aa1db09ab5 Add HostComponent type to ReactNative (#16898)
* Add HostComponent type to ReactNative

* Use type alias imports instead of wildcard

* Fix forgotten Object in measureLayout type
2019-09-26 14:42:18 -07:00