Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37316
In Fabric, a ShadowNode may re-initialize YGConfig several times throughout the lifetime of a perpetually cloned Yoga Node.
RN sets `pointScaleFactor` lazily, when laying out the rootview. So right now it initializes a config to `pointScaleFactor` of 1.0, sets it, sets a new `pointScaleFactor` on the config, then repeats. This cycles the config between two `pointScaleFactor` values and will excessively dirty the node now that `YGNodeSetConfig` dirties on config change (D45505089)
This change makes it so that we retain previously used `pointScaleFactor` when cloning the Yoga nodes.
Changelog: [Internal]
Reviewed By: rozele
Differential Revision: D45669878
fbshipit-source-id: bfd2e185d9264a1cda64e59132960060385e16f1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37320
Changelog: [Internal]
this is just my personal taste, but here's what i did, would love to hear others' opinions (and maybe get these eventually codified):
- private methods preprended with underscore
- pragma mark groupings in this order: public, overrides, protocols, then private
Reviewed By: cipolleschi, dmytrorykun
Differential Revision: D45582491
fbshipit-source-id: 76c80955422ea7f29e7307ce2c08f70e7e8a5188
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37314
Turns out we never transitioned fbsource to an API change we made for FlatList, due to mismatched `.js` and `.js.flow` files.
Inside of RN, `$ArrayLike` in Flow, unlike `ArrayLike` in TypeScript, treats `length` as writable. So we wrap that in `$ReadOnly`. Another option might be to inline our own version, since it is not the only [case where they differ](https://fb.workplace.com/groups/flow/permalink/24328911383397481/).
In product code, the changes end up impacting:
1. `getItemLayout` is no longer typed to receive a mutable array. I changed all of the incompatible explicit type parameters from `Array<ItemT>` to `Iterable<ItemT>`.
2. Flow has a harder time inferring destructured `data` in examples that were passing `any` to FlatList, so I needed to give some type hints where `data` was previously untyped
3. Replace some `$FlowFixMe[incompatible-type]` with `$FlowFixMe[incompatible-type-arg]`
Changelog: [Internal]
Reviewed By: lunaleaps
Differential Revision: D45665199
fbshipit-source-id: 59aa908e277a27f7ca88acb48de493d2782517a9
Summary:
It's just a code improvement, with postponement of best practices.
## Changelog:
[Android] [Added] - Code improvement.
Pull Request resolved: https://github.com/facebook/react-native/pull/37297
Test Plan: The new code does not change existing logic.
Reviewed By: NickGerleman
Differential Revision: D45658400
Pulled By: yungsters
fbshipit-source-id: dcbe4b732d665a0c3c26ee2cf28843f951c3979d
Summary:
- The whole project root is included by default anyway, the include
section should be redundant and just misleading.
- The generated ignore paths ignore more than intended as they didn't
escape the `.` for regex.
Changelog: [Internal]
Reviewed By: mofeiZ
Differential Revision: D45658874
Pulled By: kassens
fbshipit-source-id: fd1ec59eeffa3ac1cb39c190e17f018951fafbe7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37307
This should no longer log to `console.error()` after the latest prop-types update.
Changelog: [Internal]
Reviewed By: yungsters
Differential Revision: D45654389
fbshipit-source-id: c3d04c6a74b335e300137aa67bd7fb3640ba0303
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37207
X-link: https://github.com/facebook/yoga/pull/1274
Yoga exposes public APIs for dirtying Nodes, but will itself perform dirty marking when changing bits which invalidate layout. E.g. changing the style of a Node will invalidate it along with every parent Node.
Because config setting is newly public to the C ABI, this makes a similar change so that replacing a Node's config will dirty the tree above the node if there is a layout impacting config change (I don't think children need to be invalidated since child output shouldn't change given the same owner dimensions).
One quirk of this is that configs may be changed independently of the node. So someone could attach a config to a Node, then change the live config after the fact. The config does not currently have a back pointer to the Node, so we do not invalidate in that case of live config edits. The future work to rectify this would be to make configs immutable once created.
There are also currently some experimental features here which should maybe be compared, but these should be moved to YGErrata anyway.
Reviewed By: javache
Differential Revision: D45505089
fbshipit-source-id: 72b2b84ba758679af081d92e7403750c9cc53cb5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37290
This diff removes an assertion that was causing a crash in production.
The root cause of the bug is that there's a race condition on viewState.mEventEmitter, the value of this field changes while the method is being executed.
In this diff I'm avoiding the crash by dispatching the event as soon as possible and unblock the fix in production
changelog: [internal] internal
Reviewed By: fkgozali
Differential Revision: D45622656
fbshipit-source-id: a6ea64e38189676885366931de84dc5433834fff
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37246
Changelog: [Internal]
since no one is using this outside of RCTInstance, let's clean this up!
Reviewed By: sammy-SC
Differential Revision: D45553212
fbshipit-source-id: 959fb454ff403c89ec5005b9a602986769cec388
Summary:
## Summary
We have a case:
1. Open components tab
2. Close Chrome / Firefox devtools window completely
3. Reopen browser devtools panel
4. Open components tab
Currently, in version 4.27.6, we cannot load the components tree.
This PR contains two changes:
- non-functional refactoring in
`react-devtools-shared/src/devtools/store.js`: removed some redundant
type castings.
- fixed backend manager logic (introduced in
https://github.com/facebook/react/pull/26615) to activate already
registered backends. Looks like frontend of devtools also depends on
`renderer-attached` event, without it component tree won't load.
## How did you test this change?
This fixes the case mentioned prior. Currently in 4.27.6 version it is
not working, we need to refresh the page to make it work.
I've tested this in several environments: chrome, firefox, standalone
with RN application.
DiffTrain build for commit https://github.com/facebook/react/commit/377c5175f78e47a3f01d323ad6528a696c88b76e.
Changelog: [Internal]
<< DO NOT EDIT BELOW THIS LINE >>
Reviewed By: sammy-SC
Differential Revision: D45573294
Pulled By: tyao1
fbshipit-source-id: 42a8e4a54cd367080fdb7e1c357c48ae3564b7f0
Summary:
This automatically exposes `$$FORM_ACTIONS` on Server References coming
from Flight. So that when they're used in a form action, we can encode
the ID for the server reference as a hidden field or as part of the name
of a button.
If the Server Action is a bound function it can have complex data
associated with it. In this case this additional data is encoded as
additional form fields.
To process a POST on the server there's now a `decodeAction` helper that
can take one of these progressive posts from FormData and give you a
function that is prebound with the correct closure and FormData so that
you can just invoke it.
I updated the fixture which now has a "Server State" that gets
automatically refreshed. This also lets us visualize form fields.
There's no "Action State" here for showing error messages that are not
thrown, that's still up to user space.
DiffTrain build for commit https://github.com/facebook/react/commit/aef7ce5547c9489dc48e31f69b002cd17206e0cb.
Changelog: [Internal]
<< DO NOT EDIT BELOW THIS LINE >>
Reviewed By: christophpurrer
Differential Revision: D45548613
Pulled By: tyao1
fbshipit-source-id: 0d4206c18c4818fa410e8b18f3a0f0942237c91b
Summary:
E.g. if we suspend (throw a promise) in pushStartInstance today we might
have already pushed some chunks (or even child segments potentially). We
should revert back to where we were.
This doesn't usually happen because when we suspend in a component it
doesn't write anything itself, it'll always defer to som host instance
to do the writing.
There was a todo about this already but I'm not 100% sure it's always
safe when suspending. It should be safe when suspending just regularly
because it's just a noop. We might not even want "throwing a promise" in
this mechanism to be supported longer term but for now that's how a
suspend in internals.
DiffTrain build for commit https://github.com/facebook/react/commit/c10010a6a00911fe99452bc561dd47c3e15f4eb8.
Changelog: [Internal]
<< DO NOT EDIT BELOW THIS LINE >>
Reviewed By: christophpurrer
Differential Revision: D45547661
Pulled By: tyao1
fbshipit-source-id: 69654c95f06bc0f056fc8231e41aa395931af228
Summary:
Usually we don't have to do this since we only set these in the loop but
the ReactCustomFormAction props are optional so they might be undefined.
Also moved it to a general type since it's a semi-public API.
DiffTrain build for commit https://github.com/facebook/react/commit/fa7a447b9ce5a4f0be592fc2946380b0fa3b29c0.
Changelog: [Internal]:
<< DO NOT EDIT BELOW THIS LINE >>
Reviewed By: sammy-SC
Differential Revision: D45537647
Pulled By: tyao1
fbshipit-source-id: 15aa00347467e424e3fa7d509139b2f87cdcdb69
Summary:
Drop the "state". Just "useOptimistic". It's cleaner.
This is still an experimental API. May not be the final name.
DiffTrain build for commit https://github.com/facebook/react/commit/b7972822b5887d05ae772ef757a453265b4b7aec.
Changelog: [Internal]:
<< DO NOT EDIT BELOW THIS LINE >>
Reviewed By: sammy-SC
Differential Revision: D45537245
Pulled By: tyao1
fbshipit-source-id: e31f77c4a55e8931c9671d13fc43d6ff32e25dbb
Summary:
Forgot this allowlist existed. It's an extra safeguard, in case we mess
up the configuration somehow.
DiffTrain build for commit https://github.com/facebook/react/commit/388686f291afb2362fdc813c49f75b4132bc1314.
Changelog: [Internal]:
<< DO NOT EDIT BELOW THIS LINE >>
Reviewed By: sammy-SC
Differential Revision: D45532426
Pulled By: tyao1
fbshipit-source-id: e81a2efe340bfa1f8397c5b1301956a0e94e5357
Summary:
## Summary
Fixes#26756.
DevTools is failing to inject `__REACT_DEVTOOLS_GLOBAL_HOOK__` hook in
incognito mode. This is not happening straight-forward, but if extension
is toggled on and off, the next time I try to open it I am receiving an
error that content script was already registered.
<img width="676" alt="Screenshot 2023-05-02 at 14 36 53"
src="https://user-images.githubusercontent.com/28902667/235877692-51c5d284-79d9-4b00-b62e-d25d5bb5e056.png">
- Unregistering content scripts before attempting to register them
again. We need to inject `__REACT_DEVTOOLS_GLOBAL_HOOK__` on each page,
so this should be expected behaviour.
- Fixed error logging
## How did you test this change?
Local build of extension for Chrome, trying the same steps, which
resulted in an error.
No regression in performance, tested on react.dev, still the same.
DiffTrain build for commit https://github.com/facebook/react/commit/8a25302c668d6f9a24f6680fb4947e9b388bb7d9.
Changelog: [Internal]:
<< DO NOT EDIT BELOW THIS LINE >>
Reviewed By: sammy-SC
Differential Revision: D45532160
Pulled By: tyao1
fbshipit-source-id: d021721a4aee3e052512006f61cfdf72df56dbda
Summary:
The "next" prerelease channel represents what will be published the next
time we do a stable release. We publish a new "next" release every day
using a timed CI workflow.
When we introduced this prerelease channel a few years ago, another name
we considered was "canary". But I proposed "next" instead to create a
greater distinction between this channel and the "experimental" channel
(which is published at the same cadence, but includes extra experimental
features), because some other projects use "canary" to refer to releases
that are more unstable than how we would use it.
The main downside of "next" is someone might mistakenly assume the name
refers to Next.js. We were aware of this risk at the time but didn't
think it would be an issue in practice.
However, colloquially, we've ended up referring to this as the "canary"
channel anyway to avoid precisely that confusion.
So after further discussion, we've agreed to rename to "canary".
This affects the label used in the version string (e.g.
`18.3.0-next-a1c2d3e4` becomes `18.3.0-canary-a1c2d3e4`) as well as the
npm dist tags used to publish the releases. For now, I've chosen to
publish the canaries using both `canary` and `next` dist tags, so that
downstream consumers who might depend on `next` have time to adjust. We
can remove that later after the change has been communicated.
DiffTrain build for commit https://github.com/facebook/react/commit/2c2476834a7c739ca239750b73f74aa1df144a93.
Changelog: [Internal]:
<< DO NOT EDIT BELOW THIS LINE >>
Reviewed By: sammy-SC
Differential Revision: D45531681
Pulled By: tyao1
fbshipit-source-id: 27ebe14eabad5c92fe6e5aa4944ff798b808ec33
Summary:
This key was only valid during the 2.0 beta period so we can remove it.
DiffTrain build for commit https://github.com/facebook/react/commit/fa4314841e7fdeef6e6bc5a7722fe74dc8e9fd89.
Changelog: [Internal]:
<< DO NOT EDIT BELOW THIS LINE >>
Reviewed By: sammy-SC
Differential Revision: D45531656
Pulled By: tyao1
fbshipit-source-id: e2e3c9e5463c39e301361e18364d22dcec428c8a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37284
Changelog: [iOS][Removed]
in the past, we had this protocol so we could decorate the `RCTDevSplitBundleLoader`, which was removed by motiz88. now that doesn't exist anymore, we should delete this protocol. i did a quick grep on github and this protocol was only used by `RCTDevSplitBundleLoader`, so i don't think this will be a major breaking change
Reviewed By: christophpurrer
Differential Revision: D45591882
fbshipit-source-id: 23656d0c04fa4e1c4cfc65b1052d4c3614ba8708
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37245
in general, userland has no reason to know about RCTInstance. this is the first step in starting to decouple consumers from the implementation details of bridgeless mode.
Changelog: [Internal]
Reviewed By: RSNara
Differential Revision: D45542678
fbshipit-source-id: e3b3c2ea9a913b2a2329f305aebbb6b0235d2a0e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37281
This is an small unit test to setup how we are going to be testing stable APIs in RN Android + kotlin.
The test itself doesn't do much and it will refactor as I iterate on ReactInstanceDelegate interface
changelog: [internal] internal
Reviewed By: luluwu2032
Differential Revision: D45551424
fbshipit-source-id: 2cf7b8eb1795e9d3f2eba611b9ee3ce28edf9ee0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37280
In this diff I'm introducing the ReactInstanceDelegate.Builder class that will be used to initialize ReactHost in Android
This class is still under development, it is missing:
- Tests
- Documentantion for class and methods
- Default objects for optional fields on ReactInstanceDelegate.Builder
The goal of this diff is to introduce the class, test UnstableReactNativeAPI annotation and create a diff stack that shows the process to create a stable API in Android.
bypass-github-export-checks
changelog: [internal] internal
Reviewed By: cortinico
Differential Revision: D45509432
fbshipit-source-id: 7ae12f6b146491953a78edf02acf0e1ee8f8fce5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37262
Fix compile errors on Windows as
```
stderr:react-native-github\packages\react-native\ReactCommon\react\renderer\componentregistry\componentNameByReactViewName.cpp(18,12): error: no member named 'mismatch' in namespace 'std'
if (std::mismatch(rctPrefix.begin(), rctPrefix.end(), viewName.begin())
~~~~~^
```
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D45597108
fbshipit-source-id: e9e1439fe35727e6c4b956e7ec03236758910b60
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37266
This class is full of warnings and other issues which I'm doing a pass on it since I touched it:
- Missing `NonNull` annotations
- Try with resources missing
- Unused inner Interfaces that can be removed
Technically a breaking change for users as we do have some public interfaces that have been removed, though not sure why people would depend on those.
Changelog:
[Android] [Removed] - Polish DevServerHelper (remove unused Interfaces)
Reviewed By: motiz88
Differential Revision: D45600284
fbshipit-source-id: 6274ae29ff3384d7409764fd6474da68d777958a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37265
DevServerHelper was having a constructor parameter as `DevInternalSettings` which is effectively internal. This should not be the case as that class is Internal as was bleeding out of the public API.
I've updated the primary constructor to take instead:
```
public DevServerHelper(
DeveloperSettings settings,
String packageName,
InspectorPackagerConnection.BundleStatusProvider bundleStatusProvider,
PackagerConnectionSettings packagerConnectionSettings) {
```
This is breaking change for users that were depending on the Internal class.
Changelog:
[Android] [Removed] - DevServerHelper should not depend on internal ctor parameter
Reviewed By: mdvacca
Differential Revision: D45600283
fbshipit-source-id: e73139dbdf5f2505201b2d2c8b5a9143b7e207ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37264
Instead of disabling one test at a time, I've suppressed all the measure* related tests on Windows
with the hope to make the Windows CI less flaky.
Changelog:
[Internal] [Changed] - Disable all the measure* tests on Windows as they're flaky
Reviewed By: cipolleschi
Differential Revision: D45601448
fbshipit-source-id: 010905e1dbebd9c9da9d6710ea6ca0b99c4a2d5f
Summary:
The [React Native TV repo](https://github.com/react-native-tvos/react-native-tvos) shares most of the same Android code as the core repo. Beginning in 0.71, it needs to also publish Android Maven artifacts for the `react-android` and `hermes-android` libraries.
In order to avoid conflicts, it needs to publish the artifacts to a different group name. However, `react-native-gradle-plugin` uses a hardcoded group name (`com.facebook.react`).
Solution: read the group name from the existing `GROUP` property in `ReactAndroid/gradle.properties`.
## Changelog:
[Android] [Fixed] - read GROUP name in gradle-plugin dependency code
Pull Request resolved: https://github.com/facebook/react-native/pull/37204
Test Plan:
- Android unit tests have been added for the new code and new method in `DependencyUtils.kt`.
- Existing tests should pass
- The new code defaults to the correct group (`com.facebook.react`) so no functional change is expected in the core repo.
Reviewed By: luluwu2032
Differential Revision: D45576700
Pulled By: cortinico
fbshipit-source-id: 6297ab515b4bdbb17024989c7d3035b0a2ded0ae
Summary:
Changelog: [Internal] - Noticed when I was cutting 0.72 types there was some types not exported and also some duplicate.
I'm not sure why our lint didn't catch this, I can look into that next
bypass-github-export-checks
Reviewed By: NickGerleman
Differential Revision: D45294027
fbshipit-source-id: addf5a5d7af10e3087edaaf660ff99e46932bc3e