Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37069
changelog: [internal]
To create initial C++ state, nothing beside props is needed from `ShadowNodeFragment` and this diff removes it.
It makes creation of state easier as we will no longer need to check if props are nullptr.
Reviewed By: mdvacca
Differential Revision: D45183692
fbshipit-source-id: 81ab8eb3c57f6ff64aaed7c5b395555dce6b60b2
Summary:
[Codegen 94] This PR attempts to extracts the logic of `extendsForProp` function from the following locations :
- `parsers/flow/components/extends.js`
- `parsers/typescript/components/props.js`
since they are the same and move the function to `parsers/parsers-commons.js` as requested on https://github.com/facebook/react-native/issues/34872
## Changelog:
[Internal] [Changed] - Move `extendsForProp` to parser-commons and update usages.
Pull Request resolved: https://github.com/facebook/react-native/pull/37052
Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green
Reviewed By: cipolleschi
Differential Revision: D45225880
Pulled By: rshest
fbshipit-source-id: 45199089746d58d9e9494b28040b34c2a0eb31fe
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37103
Re backout the fix as there are some edge cases not handled properly internally.
## Changelog:
[iOS][Fixed] - Revert change in URL escaping
Reviewed By: javache, sammy-SC, rshest
Differential Revision: D45309232
fbshipit-source-id: d9f473d1f6409beb1069d9af7e649ee5b1b06d6e
Summary:
Adds changelog for new patch.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - add changelog entry for 0.69.10
Pull Request resolved: https://github.com/facebook/react-native/pull/37082
Test Plan: N/A
Reviewed By: rshest
Differential Revision: D45277997
Pulled By: GijsWeterings
fbshipit-source-id: eb64c8b6b9f0d5c59140e12eb70f16a57eae5f82
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37083
`React.ElementConfig<a polymophic type>` will result in unpredictable behavior in Flow due to some types being unresolved. Since the type is already broken in most cases, I use $FlowFixMe as the type for those type arguments that are currently inferred as empty.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D44774275
fbshipit-source-id: bb950379102d41e729593af644d25670d9071ab4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37085
changelog: [internal]
Props and event emitter does not need to use JSI_EXPORT. Therefore we can remove include of jsi.h as well.
Reviewed By: cortinico, rshest
Differential Revision: D45274824
fbshipit-source-id: dd756258767f787e49d86dc31e18ce581f444362
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37087
changelog: [internal]
Surface props can change during life cycle of a surface. This was supported before the new renderer as well. AppRegistry has a corresponding method for this: `AppRegistry.setSurfaceProps`.
To add support for this, we just need to call into `UIManager::setSurfaceProps`.
Reviewed By: rshest
Differential Revision: D45272046
fbshipit-source-id: d138b57d5c83f554839b0db0e6721045b8dc81ef
Summary:
Insert temporary input node to polyfill submitter argument in FormData.
This works for buttons too and fixes a bug where the type attribute
wasn't reset.
I also exclude the submitter if it's a function action. This ensures
that we don't include the generated "name" when the action is a server
action. Conceptually that name doesn't exist.
DiffTrain build for commit https://github.com/facebook/react/commit/5e5342b10059bf90738a8d9171fcf0af9d9d5d51.
Changelog: [Internal]
Reviewed By: kassens
Differential Revision: D45240323
fbshipit-source-id: 3e9a8076942abdc24cf25b9dd9f130727ec3c0fd
Summary:
The Promise as a child case seems buggy. It ends up throwing the Promise
as fatal when used in Sync rendering.
DiffTrain build for commit https://github.com/facebook/react/commit/9c58a0b6475509f9124da578207aa0d3b7364035.
Changelog: [Internal]
Reviewed By: kassens
Differential Revision: D45239545
fbshipit-source-id: 1b377ec87bc3d1bbe07d7fd9f68235629adff764
Summary:
JSON.stringify isn't the right thing here. Luckily this doesn't look to have any security impact.
DiffTrain build for commit https://github.com/facebook/react/commit/9ee796430278c6f6e8acec4f54fd9be7f7868c0d.
Changelog: [Internal]
Reviewed By: poteto
Differential Revision: D45238390
fbshipit-source-id: 04e8ce20ae1b7a86fea538f032bc9dc34d41219c
Summary:
Fizz can emit whatever it wants for the SSR version of these fields when
it's a function action so they might not align with what is in the
previous props. Therefore we need to force them to update if we're
updating to a non-function where they might be relevant again.
DiffTrain build for commit https://github.com/facebook/react/commit/2fa632381839c8732dad9107b90911163b7f2b7a.
Changelog: [Internal]
Reviewed By: poteto
Differential Revision: D45238365
fbshipit-source-id: b75b4779bd3759362d69f96994ba781982f650a0
Summary:
Use the Blob constructor + append with filename instead of File
constructor. Node.js doesn't expose a global File constructor but does
support it in this form.
Queue fields until we get the 'end' event from the previous file. We
rely on previous files being available by the time a field is resolved.
However, since the 'end' event in Readable is fired after two
micro-tasks, these are not resolved in order.
I use a queue of the fields while we're still waiting on files to
finish. This still doesn't resolve files and fields in order relative to
each other but that doesn't matter for our usage.
DiffTrain build for commit https://github.com/facebook/react/commit/a21d1475ffd7225a463f2d0c0c9b732c8dd795eb.
Changelog: [Internal]
Reviewed By: poteto
Differential Revision: D45238341
fbshipit-source-id: d4ce8cf0201a231263c753989267e85f92908b9e
Summary:
Stacked on #26557
Supporting Float methods such as ReactDOM.preload() are challenging for
flight because it does not have an easy means to convey direct
executions in other environments. Because the flight wire format is a
JSON-like serialization that is expected to be rendered it currently
only describes renderable elements. We need a way to convey a function
invocation that gets run in the context of the client environment
whether that is Fizz or Fiber.
Fiber is somewhat straightforward because the HostDispatcher is always
active and we can just have the FlightClient dispatch the serialized
directive.
Fizz is much more challenging becaue the dispatcher is always scoped but
the specific request the dispatch belongs to is not readily available.
Environments that support AsyncLocalStorage (or in the future
AsyncContext) we will use this to be able to resolve directives in Fizz
to the appropriate Request. For other environments directives will be
elided. Right now this is pragmatic and non-breaking because all
directives are opportunistic and non-critical. If this changes in the
future we will need to reconsider how widespread support for async
context tracking is.
For Flight, if AsyncLocalStorage is available Float methods can be
called before and after await points and be expected to work. If
AsyncLocalStorage is not available float methods called in the sync
phase of a component render will be captured but anything after an await
point will be a noop. If a float call is dropped in this manner a DEV
warning should help you realize your code may need to be modified.
This PR also introduces a way for resources (Fizz) and hints (Flight) to
flush even if there is not active task being worked on. This will help
when Float methods are called in between async points within a function
execution but the task is blocked on the entire function finishing.
This PR also introduces deduping of Hints in Flight using the same
resource keys used in Fizz. This will help shrink payload sizes when the
same hint is attempted to emit over and over again
DiffTrain build for commit https://github.com/facebook/react/commit/36e4cbe2e918ec9c8a7abbfda28898c835361fb2.
Changelog: [Internal]
Reviewed By: poteto
Differential Revision: D45238328
fbshipit-source-id: 9b4233def44ffb47a6c4321e01f740586b89fe33
Summary:
In React DOM, we use HostContext to represent the namespace of whatever
is currently rendering — SVG, Math, or HTML. Because there is a fixed
set of possible values, we can switch this to be a number instead. My
motivation is that I want to start tracking additional information in
this type, and I want to pack all of it into a single number instead of
turning it into an object. For better performance.
(In dev, the host context type is already an object that includes
additional information, but that's dev so who cares.)
Technically, before this change, the host context could be any namespace
URI string, but any value other than SVG or Math was treated the same
way. Only SVG and Math have special behavior. So in the new structure,
there are three enum values: SVG, Math, or None, which represents the
HTML namespace as well as all other possible namespaces.
DiffTrain build for commit https://github.com/facebook/react/commit/8f42196892847a3dd1ab4c84eda0c8d52508ecf6.
Changelog: [Internal]
Reviewed By: poteto
Differential Revision: D45238312
fbshipit-source-id: acf5033808ce81c4854ce2b962b4e7f5140e8c0d
Summary:
Errors in form actions are now rethrown during render (#26689), so we
can handle them using an error boundary.
DiffTrain build for commit https://github.com/facebook/react/commit/967d46c76cf9f7f35cf659a6a47c9ad456c685a8.
Changelog: [Internal]
Reviewed By: poteto
Differential Revision: D45238297
fbshipit-source-id: e2db3d9a55671f9f72cf8966e75fe8010e708835
Summary:
This is stable and appears to build w/o problem. I don't see why we
should disallow it.
DiffTrain build for commit https://github.com/facebook/react/commit/5d7ebb4b784cb7e41e28653d89054cfe65637a93.
Changelog: [Internal]
Reviewed By: kassens
Differential Revision: D45238282
Pulled By: gaearon
fbshipit-source-id: c1189aaaf211349a0ad919eaca59dd8e8224e5ac
Summary:
This is the next step toward full support for async form actions.
Errors thrown inside form actions should cause the form to re-render and
throw the error so it can be captured by an error boundary. The behavior
is the same if the `<form />` had an internal useTransition hook, which
is pretty much exactly how we implement it, too.
The first time an action is called, the form's HostComponent is
"upgraded" to become stateful, by lazily mounting a list of hooks. The
rest of the implementation for function components can be shared.
Because the error handling behavior added in this commit is just using
useTransition under-the-hood, it also handles pending states, too.
However, this pending state can't be observed until we add a new hook
for that purpose. I'll add this next.
DiffTrain build for commit https://github.com/facebook/react/commit/fd3fb8e3c5d1c977f4bfa73d715143804c69d4b0.
Changelog: [Internal]
Reviewed By: poteto
Differential Revision: D45238266
Pulled By: kassens
fbshipit-source-id: 93fe8581172522f955278918bf97a0eb54daeeed
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37070
This diff fixes an issue where codegened native commands are not able to be triggered, as codegen adds command handling to the delegate. This also brings how receiveCommand is handled into parity with how setProperties is called on the delegate.
Changelog:
[Fixed][Android] - Modify ViewManager.receiveCommand to call into delegate
Reviewed By: javache
Differential Revision: D45236213
fbshipit-source-id: 78f232f288f0a9c5f444e680a9cc49dca1d6af9b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36949
This change is a second attempt at fixing URL encoding and escaping that was already tried [here](https://github.com/facebook/react-native/commit/2b4e1f5ece7d160935b19d4862af8706a44cee59).
We had to roll it back due to some internal tests failing as it looks like Jest is manipulating the URL somehow.
We manage to replicate the issue, which occur when we pre-decode a url even if it is not partially encoded (we were too aggrsssive).
This fix ensure that we pre-decode the urls only if they present some `%` characters.
The problem here was that the e2e tests sends some urls with some `%` symbol which does not belongs to an escape sequence. For example: `anna://launch?height=25%`.
The previous code (v1) was trying to unescape this case. V2 fixes this.
This change should also fix#28508 for good.
## Changelog:
[iOS][Fixed] - Properly escape URLs
Reviewed By: mdvacca
Differential Revision: D45078923
fbshipit-source-id: 010a5c173784f8341a1a08bcbd06a6ad14299c75
Summary:
Cleans up some of the changes to UseWebDefaults that were made in the interest of moving it outside of YGConfig. It still exists in YGConfig, but also exists on the node.
We also assert on null config, or when someone tries to change UseWebDefaults after creating a node (since right now YGStyle does not know the difference between unset vs set explicitly to what would normally be default).
Removes a peculiar constructor which was added to avoid config setting.
Reviewed By: rshest
Differential Revision: D45133644
fbshipit-source-id: 2b5e2baeb826653133df9b1175cf5c194e342e3e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37074
I am exploring ways of cleaning up the React Native Jest `setup.js` logic so that we can enable Flow and make it easier to maintain.
This does a few things:
- Create a new Jest test to verify that mocking works as expected (i.e. `jest.mock(X)` and `import ... from 'X'` does the right thing).
- Move the mock implementation for `NativeExceptionsManager` into a `__mocks__` directory that Jest can find automatically.
- Add `flow strict` and fill out the missing implementation details of the `NativeExceptionsManager` mock.
Changelog:
[General][Added] - Added missing methods to `NativeExceptionsManager` mock in Jest
Reviewed By: fkgozali
Differential Revision: D45244175
fbshipit-source-id: 0f4c8f873f93304509b80a13ed52e96265d10a42
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37072
Deletes this call to `jest.setMock` for `ErrorUtils`. There is no such manual mock in `__mocks__` adjacent to `ErrorUtils` and this call does nothing.
Changelog:
[Internal]
Reviewed By: fkgozali
Differential Revision: D45234899
fbshipit-source-id: 51a41061761705e4f55120be0dbb77c6515e6a0a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37046
Changes React Native's `jest/setup.js` so that globals (e.g. `__DEV__`, `performance`, `window`) are defined using `Object.defineProperties` instead of using object property assignment.
This makes the setup logic more resilient to Jest environments (e.g. [`jsdom`](https://github.com/jsdom/jsdom/blob/master/lib/jsdom/browser/Window.js#L422-L424)) where the globals are defined without a setter (i.e. `set` is undefined) or without `writable: true`, because object property assignment to such properties throws an error in strict mode.
Changelog:
[General][Changed] - Jest globals are now defined using `Object.defineProperties` instead of object property assignment
Reviewed By: motiz88
Differential Revision: D45202142
fbshipit-source-id: 5511e374ac6ba051ad0c224b902fb6f20960e9be
Summary:
[Codegen 102] This PR is subtask of umbrella https://github.com/facebook/react-native/issues/34872. It extracts the code to compute the `extendsProps` and the props properties in Flow in a `getProps() -> {extendsProps, props}` function into the same `index.js` file. This will help unifying the `buildComponentSchema` functions between Flow and TS so we can factor it out in a later step.
## Changelog:
[INTERNAL][CHANGED] - merge `getExtendsProps` & `getProps` fns into `getProps` fn - Flow.
Pull Request resolved: https://github.com/facebook/react-native/pull/36891
Test Plan: - `yarn flow && yarn test react-native-codegen` --> *should be green.*
Reviewed By: rshest
Differential Revision: D45044653
Pulled By: cipolleschi
fbshipit-source-id: 9fcdaef60dfbc3332d880b19c6e575d948d21986
Summary:
Throws and captures the overloading class as well as the component name to help us track.
[Android][Changed] - Added an exception, which will be removed shortly.
Reviewed By: cortinico
Differential Revision: D45185598
fbshipit-source-id: 222a38be12c0a41774c83b657a4e4134ce9c197f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37004
Currently in RN Android when re-creating the context we don't unmount the underlying React application. This violates ViewManager and React hooks contracts, who are no longer able to properly unmount views, and instead the view hierarchy is forcefully torn down by Android UI. This differs from iOS, where we do unmount the application on reloads.
This is a trade-off with performance, as we'll keep the JS thread alive slightly longer to complete shutdown, but it's the right call for correctness. It also only mainly affects development, as recreating the context is rare in production.
Repro steps:
```
useEffect(() => {
console.log('Playground useEffect invoked');
return () => {
console.log('Playground useEffect destructor invoked');
};
}, []);
```
Validate that when reloading the application, the second console.log is printed.
Changelog: [Android][Changed] React trees will be unmounted when the application is reloaded
Reviewed By: luluwu2032
Differential Revision: D45145520
fbshipit-source-id: a4dcd2ff4a8fc14cb0f276a5ef9afe21d1104735
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37039
ReactInstance is not meant to be used outside of bridgless package, this diff reduces its visibility.
changelog: [internal] internal
Reviewed By: fkgozali
Differential Revision: D45197462
fbshipit-source-id: e2fa8ed145a05882d8f5384d4e4e17a3d6d984ac
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37042
BridgelessAtomicRef is only used in com.facebook.react.bridgeless, we reduce visibility to package only
changelog: [internal] internal
Reviewed By: NickGerleman
Differential Revision: D45192193
fbshipit-source-id: 12253a2a8acd3c2edd550650f5f04a0346694b3e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37047
We're seeing scenarios where `onRequestPermissionsResult` is being invoked but the current activity does not implement `PermissionAwareActivity`. This should not crash the app.
Changelog:
[Android][Fixed] - Fix crash when Android requests permission with activity that does not implement `PermissionAwareActivity`
Reviewed By: mdvacca
Differential Revision: D45203319
fbshipit-source-id: 4a6eb67ad67ae5c731c27301967b837b1286ccbb
Summary:
In the TurboModule interop layer, several modules are appearing as null. It's unclear why. We landed a few module resolution simplification diffs, to *attempt* to mitigate the problem: D45131297. But we're not sure if those diffs will be 100% successful.
So, this diff inserts two logs into the TurboModule system, for scenarios we know could lead to TurboModules being null. The hope: this helps us understand the actual problem, in case our earlier fix attempt (i.e: D45131297) fails.
Notes:
- These logs are temporary.
- These logs will only run in the TurboModule interop's test group.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D45197703
fbshipit-source-id: 4401a6111492444cc4b405c52183d02df94c3828
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37032
Before, calling into global.turboModuleProxy would kickstart the module creation algorithm, **even if the module wasn't registered.**
Now, if the module isn't registered, TurboModuleManager will just early return null.
NOTE: When an unregistered module is requested from Java via TurboModuleManager.getModule(moduleName), the module algorithm will **still** run.
This fixes a bug:
- global.**native**ModuleProxy will no longer kickstart **turbo** module creation.
- global.**turbo**ModuleProxy will no longer kickstart **legacy** module creation.
NOTE: This **might** improve fb4a performance **a bit**: The TurboModule creation algorithm is *probably* expensive to run. 44 NativeModules are loaded at startup by Fb4a; 8 of them aren't registered with the app: [pastry](https://www.internalfb.com/phabricator/paste/view/P701125588?lines=2%2C4%2C5%2C7%2C9%2C16%2C18%2C24). Those 8 NativeModule creates will now shortcircuit to null faster.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D45195578
fbshipit-source-id: cb09bdc059b3651b02447b7c2e37ef3f4ca2f92b