Compare commits

...
Author SHA1 Message Date
Nicola Corti d01e5ad731 Fix yarn lint 2025-01-15 19:24:57 +00:00
Nicola Corti a97d6185fa No need to invoke 'input keyevent 82' on test-e2e-local 2025-01-15 16:22:43 +00:00
Dawid Małecki 1126bbb149 Add explicit type to supported commands in TextInputNativeCommands (#48688)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48688

Changelog:
[General][Changed] - Added explicit type to supported commands in TextInputNativeCommands

Reviewed By: cortinico

Differential Revision: D68205568

fbshipit-source-id: 53501cdeaf4d790b36156b59f76686e8fef5cc5f
2025-01-15 08:15:37 -08:00
Dawid Małecki f36bfe5dfa Remove redundant {||} syntax (#48686)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48686

Changelog:
[Internal] - Removed redundant `{||}` syntax

Reviewed By: javache

Differential Revision: D68205038

fbshipit-source-id: f7d3271142b6443a5859c3b668b7aebd3ce3ef3f
2025-01-15 07:07:01 -08:00
Fabrizio Cucci e8a64fd638 Migrate rn-tester/IntegrationTests/ImageCachePolicyTest.js to function components (#48701)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48701

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68153254

fbshipit-source-id: 24789c814550cd592cb68a0576c5037088734a75
2025-01-15 06:11:21 -08:00
Fabrizio Cucci 8c64e0868e Migrate rn-tester/IntegrationTests/SimpleSnapshotTest.js to function components (#48700)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48700

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152855

fbshipit-source-id: 121cb5dd65673121a021da12d10c7a7e118bd0dc
2025-01-15 06:11:21 -08:00
Fabrizio Cucci 086e93d227 Migrate rn-tester/IntegrationTests/AppEventsTest.js to function components (#48699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48699

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152557

fbshipit-source-id: 9fa6cad408f6fbd3da513623379b864d0c33c63d
2025-01-15 06:11:21 -08:00
Fabrizio Cucci f864d6b533 Migrate rn-tester/IntegrationTests/ImageSnapshotTest.js to function components (#48698)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48698

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152467

fbshipit-source-id: 0f747f1646be5a3ca010c2c0e0591f13bfcaf2f4
2025-01-15 06:11:21 -08:00
Fabrizio Cucci d1153ff468 Migrate rn-tester/IntegrationTests/PromiseTest.js to function components (#48697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48697

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152416

fbshipit-source-id: 32d6d503ed119f8d7e5b9c139060b61ef44b8768
2025-01-15 06:11:21 -08:00
Fabrizio Cucci 1a1714300e Migrate rn-tester/IntegrationTests/SyncMethodTest.js to function components (#48696)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48696

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152294

fbshipit-source-id: 16b36d4702159528fe99c1a7d54c2c7b58d30349
2025-01-15 06:11:21 -08:00
Fabrizio Cucci c33954c80d Migrate rn-tester/IntegrationTests/GlobalEvalWithSourceUrlTest.js to function components (#48695)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48695

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68152232

fbshipit-source-id: 918236f8c9789efab9cc43b85e53fa398909808c
2025-01-15 06:11:21 -08:00
Tim Yung 00d272fb3b Animated: Fix onUserDrivenAnimationEnded w/ Insertion Effects (#48678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48678

While diagnosing a recent issue in which `AnimatedValue` instances were not being correctly updated as expected, the insertion effects feature flag was identified as a root cause.

Upon further investigation, it appears that this is because the `onUserDrivenAnimationEnded` listener was not implemented the same way in the two feature flag states:

- When `useInsertionEffectsForAnimations` is disabled, `useAnimatedProps` listens to `onUserDrivenAnimationEnded` in a passive effect, after all nodes have been attached.
- When `useInsertionEffectsForAnimations` is enabled, `useAnimatedProps` listens to `onUserDrivenAnimationEnded` in an insertion effect when attaching nodes.

The bugs occurs because `useAnimatedProps` checks whether native driver is employed to decide whether to listen to `onUserDrivenAnimationEnded`. However, we do not know whether native driver will be employed during the insertion effect. (Actually, we do not necessarily know that in a passive effect, either... but that is a separate matter.)

This fixes the bug when that occurs when `useInsertionEffectsForAnimations` is enabled, by moving the listening logic of `onUserDrivenAnimationEnded` into a passive effect. This is the same way that it is implemented when `useInsertionEffectsForAnimations` is disabled.

Changelog:
[Internal]

Reviewed By: javache, sammy-SC

Differential Revision: D68171721

fbshipit-source-id: 50b23348fd4641580581cacebc920959651f96a7
2025-01-15 05:40:15 -08:00
Mateo Guzmán e7378f0d9e Migrate HeaderUtil to Kotlin (#48676)
Summary:
Migrate `HeaderUtil` to Kotlin.

## Changelog:

[INTERNAL] - Migrate `HeaderUtil` to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/48676

Test Plan:
The file had tests:

```bash
yarn test-android
```

Reviewed By: fabriziocucci

Differential Revision: D68205283

Pulled By: javache

fbshipit-source-id: 23ad7726a5e597d5012eec6b194af3b1e10a8b7a
2025-01-15 04:45:02 -08:00
Nicola Corti d90c278672 Reformat MutationObserver test to comply with yarn lint --fix (#48692)
Summary:
Whenever I run `yarn lint --fix` I noticed that this test is not formatted correctly. This fixes it.

## Changelog:

[Internal] [Changed] -

Pull Request resolved: https://github.com/facebook/react-native/pull/48692

Test Plan: CI

Reviewed By: sammy-SC

Differential Revision: D68207001

Pulled By: cortinico

fbshipit-source-id: 2a6c44ca02249f6662b03c87f0c4d4f3eb5a3054
2025-01-15 04:43:50 -08:00
Nicola Corti 9a4b2cecd5 Cleanup prealpha logic from Cocoapods (#48690)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48690

We don't intent to use the prealpha logic in the near future so it makes sense to remove it for
to simplify our already complicated release process. We can always revive it if we wish.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D68205691

fbshipit-source-id: 22a3416335052a4bf6a76faa6e6af622254a6e56
2025-01-15 04:30:37 -08:00
Nicola Corti 63442d3757 RNGP - Cleanup prealpha logic from the Gradle Plugin (#48689)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48689

We don't intent to use the prealpha logic in the near future so it makes sense to remove it for
to simplify our already complicated release process. We can always revive it if we wish.

Changelog:
[Internal] [Changed] - RNGP - Cleanup prealpha logic from the Gradle Plugin

Reviewed By: cipolleschi

Differential Revision: D68205665

fbshipit-source-id: 81d5257544df97b566421164944e3b6e71f06635
2025-01-15 04:30:37 -08:00
Levi c09b71b990 Fabric: Support stylistic sets for fontVariant (#48674)
Summary:
In the old arch, stylistic sets were supported however in the new arch support was not added. It seems that fontVariant support was actually initially missed on iOS fabric however a limited version was added in https://github.com/facebook/react-native/pull/44112 . I referenced that PR and also old arch implementation for these changes.
<img width="480" alt="Screenshot 2025-01-14 at 11 15 18 AM" src="https://github.com/user-attachments/assets/ec32a356-fadd-4281-83b9-15871bbcd18f" />

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL] [ADDED] - Support stylistic sets for fontVariant

Pull Request resolved: https://github.com/facebook/react-native/pull/48674

Test Plan:
- Verified that the "Unsupported FontVariant" native log no longer displays on both platforms
- On iOS was easy to test in the tester app as SF supports stylistic sets by default:
```
<Text>
  Stylistic{'\n'}
  <Text>Normal: ${'\n'}</Text>
  <Text style={{fontVariant: ['stylistic-four']}}>
    Stylistic Four: $
  </Text>
</Text>
```

<img width="391" alt="Screenshot 2025-01-14 at 11 59 29 AM" src="https://github.com/user-attachments/assets/1ede258e-783f-448f-8300-4c8c710796ef" />

- On Android I could not find any system fonts that support stylistic sets by default so I added Raleway and confirmed with a W character
![image](https://github.com/user-attachments/assets/e4b661ba-0013-4e60-90d0-1864be538159)

I did not add font variant example to the tester apps as I felt it could be confusing for people at a glance to understand why there is only a system font example on iOS and why I chose the specific stylistic set.

Reviewed By: cipolleschi

Differential Revision: D68205738

Pulled By: javache

fbshipit-source-id: 03ce572d3c8ecafca71fe00fc0e88eeafc2558bb
2025-01-15 04:23:39 -08:00
Pieter De Baets a18bc58645 Provide default implementation of ViewManager#getDelegate (#48664)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48664

Simplify ViewManager base-class by making `ViewManager`'s delegate non-nullable and using a single path for updating properties.

The ViewManagerDelegate API can map back to the original ViewManagerSetter API transparently, allowing us to remove the codepath from `ViewManagerPropertyUpdater`.

Changelog: [Android][Removed] `ViewManagerPropertyUpdater.updateProps` is deprected, use the related ViewManager APIs instead

Reviewed By: mdvacca, rshest

Differential Revision: D68120420

fbshipit-source-id: cd8b906dc36d4803dbe09ee0283654285eb81fd4
2025-01-15 04:05:47 -08:00
Pieter De Baets 54ac150324 Convert com.facebook.react.uimanager.ViewManagerPropertyUpdater to Kotlin (#48658)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48658

Migrate to Kotlin before I make further changes to this. Generics are really tricky due to our previous usage of raw generics on the Java side, but were worked around by some combination of unchecked cast and `Nothing`

Changelog: [Internal]

Reviewed By: mdvacca, rshest

Differential Revision: D68102210

fbshipit-source-id: 90013f09db0826f571a4e2a84132ae3b49fa299d
2025-01-15 04:05:47 -08:00
Riccardo Cipolleschi 5b1877fb3f Create changelog for 0.78.0-rc.0 (#48685)
Summary:
Add changelog for 0.78.0-rc.0

## Changelog:
[Internal] - Add changelog for 0.78.0-rc.0

Pull Request resolved: https://github.com/facebook/react-native/pull/48685

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D68205113

Pulled By: cipolleschi

fbshipit-source-id: f3f572e1da475ef6229b2432d3fff821ec2f5ae1
2025-01-15 03:06:55 -08:00
Riccardo Cipolleschi 559d070e8e Use RNTester App downloaded from CI instead of building (#48637)
Summary:
This change improves the E2E testing by downloading the iOS RNTesterApp that is built in CI instead of building it locally. This should let us save 10 to 20 minutes when we test a new release.

## Changelog:
[Internal] - Use the RNTester app built in CI for release testing on iOS

Pull Request resolved: https://github.com/facebook/react-native/pull/48637

Test Plan:
- build the app in ci
- run `yarn test-e2e-local -c <my-token>` and `yarn test-e2e-local -h false -c <my-token>` and verify that the iOS app is not built, but run in the simulator

Reviewed By: cortinico

Differential Revision: D68161477

Pulled By: cipolleschi

fbshipit-source-id: 577d110f9ff0197a2d3348a08a60e60a4d0a752b
2025-01-15 01:04:29 -08:00
Joe Vilches 3420eb87b0 Allow text inputs to handle native requestFocus calls (#48547)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48547

For some unknown reason, we have been swallowing [`requestFocus`](https://developer.android.com/reference/android/view/View#requestFocus(int) calls since `TextInput` is a controlled component - meaning you can control this components value and focus state from JS. This decision was originally made pre 2015 and I cannot find the reason why

I do not think this makes sense. We can still request focus from JS, while allowing the OS to request focus as well in certain cases and we would still be controlling this text input.

This is breaking keyboard navigation. Pressing tab or arrow keys will no-op if the next destination is a `TextInput`. This is because Android will call `requestFocus` from [here](https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/view/ViewRootImpl.java;l=7868?q=performFocusNavigation) when handling key events. Notably, Explore By Touch (TalkBack) swiping gestures WOULD focus `TextInputs` since they go through `ExploreByTouchHelper` methods which we override to call the proper `requestFocusInternal()` method.

**In this diff**: I move the logic in `requestFocusInternal()` into `requestFocus`.

Changelog: [Android] [Fixed] - TextInputs can now receive focus via external keyboard

Reviewed By: NickGerleman

Differential Revision: D67953398

fbshipit-source-id: 506006769a7c8a63f0a9b7ce27cfbe8578777790
2025-01-14 16:31:52 -08:00
Rayner Kristanto 0f1d4704df Revert D68017325: Migrate StyleSheet/*.js to use export statements
Differential Revision:
D68017325

Original commit changeset: 3c5b94742f10

Original Phabricator Diff: D68017325

fbshipit-source-id: d7ea1edfe9cca151560e9c0e5554a07153cdb8da
2025-01-14 15:22:26 -08:00
Riccardo Cipolleschi b3648be84f Bump maestro to see if it improves stability (#48677)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48677

E2E tests are flaky again.
Let's bump maestro to see if stability improves.

This will also remove some noise from the logs, make them easier to read.

## Changelog
[Internal] - Bump maestro version

Reviewed By: cortinico

Differential Revision: D68160005

fbshipit-source-id: 40a25f974dfda75785bf08d8d236e771b44d13cf
2025-01-14 13:32:51 -08:00
Fabrizio Cucci 9d1e24cb2f Migrate rn-tester/IntegrationTests/IntegrationTestHarnessTest.js to function components (#48671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48671

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D68151272

fbshipit-source-id: 5d42da93ab4fe8aaf34b8916a6d0a234f51c235a
2025-01-14 12:18:41 -08:00
Samuel Susla 2204ec94d4 fix Pressable when transform style is animated (#48672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48672

## Changelog:

[General] [Fixed] - Buttons becoming unresponsive when transform is animated

# The problem

D67872307 changes when `ensureUpdateSubscriptionExists`  is called to in `__attach`. This breaks the functionality because `__attach` is called before flag `__isNative` is set and subscriptions are never setup.

# Fix

The diff sets up subscriptions in `__makeNative` method.

Reviewed By: yungsters

Differential Revision: D68154908

fbshipit-source-id: e2ac108b064a66dda08902653d6bd20286f92458
2025-01-14 11:05:07 -08:00
Luna Wei e3c63cfd34 Remove native optionality (#48653)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48653

Changelog:
[General][Changed] - Mark intersectionRect required in NativeIntersectionObserverEntry

Reviewed By: rubennorte

Differential Revision: D68120751

fbshipit-source-id: 196b3d48cf33721031a0c2a9fa0a55d250926cbe
2025-01-14 09:58:50 -08:00
Dawid Małecki 48cafc0b69 Replace $FlowFixMe in StatusBar (#48662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48662

Changelog:
[General][Changed] - Improved types in StatusBar by adding StackProps

Reviewed By: javache

Differential Revision: D68152452

fbshipit-source-id: a1ec30526e78eb7205e786ae1d0209037e4a0aba
2025-01-14 09:51:04 -08:00
Nicola Corti 6368555ab0 RN-Tester: Reorder buttons in the New Architecture sample (#48666)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48666

The New Architecture sample is getting too big and the two views are not visible anymore.
I'm fixing this but having buttons side by side.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D68153245

fbshipit-source-id: 5557fd40f81078fe3994d8efe0e73784e043ed78
2025-01-14 09:15:36 -08:00
Nicola Corti ef7f714f57 Remove unnecessary LICENSE-docs (#48670)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48670

The `LICENSE-docs` was needed when this repo was also containing the reactnative.dev docs.
As this is not the case anymore, this file is unncessary.

Changelog:
[Internal] [Changed] - Remove unnecessary LICENSE-docs

Reviewed By: cipolleschi

Differential Revision: D68156336

fbshipit-source-id: 489bf2cb95916c20eb61bfb00e34b8e271bc08e3
2025-01-14 08:53:58 -08:00
Fabrizio Cucci 51fb5ab87a Migrate rn-tester/IntegrationTests/AccessibilityManagerTest.js to function components (#48663)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48663

As per title.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D68151132

fbshipit-source-id: 6fd9c4999a95a6888795c5200aafb15ff623479f
2025-01-14 08:45:21 -08:00
Thomas Nardone a511c1bdee Fix null safety in views/text/frescosupport (#48612)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48612

Manual fixes to resolve nullsafe issues.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D67992722

fbshipit-source-id: a26cde9788bc3456ec756326208b4907ad989d4e
2025-01-14 08:28:03 -08:00
Thomas Nardone 8b8b0ba5dc Mark nullsafe fixmes in views/text/frescosupport (#48613)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48613

First step for nullsafe - annotate and mark fixmes

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D67992721

fbshipit-source-id: 0c0a3ac7d4442d35bba1f48d6aabf13a3a1d47c2
2025-01-14 08:28:03 -08:00
Samuel Susla c799aa07e2 Back out "RN: Enable useInsertionEffectsForAnimations" (#48669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48669

Original commit changeset: d09b2f1b7607

Original Phabricator Diff: D65906157

## Changelog:

[General] [Fixed] - Buttons becoming unresponsive when transform is animated

Reviewed By: yungsters

Differential Revision: D68152746

fbshipit-source-id: aa0c0aa3243c67c95128a75b40dd6aa1251abbca
2025-01-14 08:20:05 -08:00
Riccardo Cipolleschi f44ff97c47 Properly test JSC for template_app e2e tests (#48656)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48656

While working on 0.78, I realize we were not testing the template app with JSC.

This change should fix this.

## Changelog:
[Internal] - Disable Hermes for the JSC E2E tests with Maestro

Reviewed By: cortinico, fabriziocucci

Differential Revision: D68147849

fbshipit-source-id: 4fbe005b5d04d6163a37041d1bd57fd48a9dfda8
2025-01-14 08:11:25 -08:00
Dawid Małecki 9f7bacaa6b Add explicit types for methods from AnimatedImplementation in AnimatedMock (#48610)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48610

Changelog:
[Internal] - Improved typings for AnimatedImplementation methods exported from AnimatedMock

Reviewed By: huntie

Differential Revision: D68019816

fbshipit-source-id: ee73213c0b519be9b72b8dfb2e91a125021de63e
2025-01-14 07:31:54 -08:00
Wojciech Lewicki 07769d4d7e feat: Make DefaultReactNativeHost.clear() also invalidate DefaultReactHost (#48338)
Summary:
On bridgeless mode, `reactHost` is kept in memory even after destroying the `DefaultReactNativeHost` in brownfield scenario. Since it keeps references to the modules, they are not deallocated, and their `initialize` methods are not fired again when creating new instance of `react-native` later. It breaks the behavior of e.g. `react-native-screens`, which wants to listen for mutations and should get new `FabricUIManager`: https://github.com/software-mansion/react-native-screens/blob/20b7e83782cd5f79ddd0d61dadc13eeb4db4b258/android/src/main/java/com/swmansion/rnscreens/ScreensModule.kt#L45.

In this commit we change the `DefaultReactNativeHost.clear()` method to also invalidate the instance retained inside `DefaultReactHost`

## Changelog:

[ANDROID] [FIXED] - Make DefaultReactNativeHost.clear() also invalidate DefaultReactHost

Pull Request resolved: https://github.com/facebook/react-native/pull/48338

Test Plan: In brownfield scenario, destroy the instance of RN and see that modules are also destroyed.

Reviewed By: cipolleschi

Differential Revision: D67977140

Pulled By: cortinico

fbshipit-source-id: 1804f093ab1a905bef499078ddec32a13c50cc85
2025-01-14 07:31:35 -08:00
Dawid Małecki 8b5e2ea683 Replace ExactReactElement_DEPRECATED in ScrollViewStickyHeader (#48659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48659

Changelog:
[Internal] - Replaced ExactReactElement_DEPRECATED with React.Node as a children type in ScrollViewStickyHeader

Reviewed By: fabriziocucci

Differential Revision: D68151420

fbshipit-source-id: d4406de67176ae1fea95b8b2ea85f41dc7f5045e
2025-01-14 07:16:41 -08:00
Nicola Corti b7eccf23de Back out "Do not reset rn-artifacts-version on release branch" (#48651)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48651

Original commit changeset: dace7c931ec3

Original Phabricator Diff: D67975049

Reviewed By: cipolleschi

Differential Revision: D68114130

fbshipit-source-id: 9fb1707191037127b9ae985d2e3298a64e911590
2025-01-14 07:09:27 -08:00
Nicola Corti 85f9939031 Fix crash for Hermes Release due to HermesExecutor migration (#48660)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48660

RN-Tester is currently instacrashing on release due to a migration to Kotlin for HermesExecutor
This fixes it.

Changelog:
[Internal] [Changed] - Fix crash for Hermes Release due to HermesExecutor migration

Reviewed By: javache

Differential Revision: D68151666

fbshipit-source-id: 31f404ec518831cf2151dc670cdf8553427ae8ab
2025-01-14 06:12:00 -08:00
Iwo Plaza e4d969a4ab Migrate StyleSheet/*.js to use export statements (#48609)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48609

# Motivation
This is an attempt at modernizing the export syntax in some of the files in `Libraries/StyleSheet/`. It will allow these files to get properly ingested by modern Flow tooling.

# This diff
- Migrates the use of `module.exports` into `export default` for files located in `Libraries/StyleSheet/*.js`. Some files were omitted due to ballooning complexity, but will be addressed in other Diffs.
- Updating internal *require*s to use ".default", no product code seems to be affected.
- Migrating `require`s into `import`s where applicable, taking into account the performance implications (context: https://fb.workplace.com/groups/react.technologies.discussions/permalink/3638114866420225/)
- Updates the current iteration of API snapshots (intended).
- Updates `react-native-codegen`'s require of processColorArray, analogous to D42346452.

Changelog:
[General][Breaking] - Deep imports from some files in `StyleSheet/` can break when using the `require()` syntax, but can be easily fixed by appending `.default`

Reviewed By: javache

Differential Revision: D68017325

fbshipit-source-id: 3c5b94742f101db0b2914c91efab6003dba2b61a
2025-01-14 05:34:18 -08:00
Fabrizio Cucci d95909ea15 Migrate rn-tester/js/components/RNTesterTitle.js to function components (#48649)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48649

As per title.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D68099051

fbshipit-source-id: 867010b692e6d71e4683cc12b4455be730413268
2025-01-14 03:20:05 -08:00
Fabrizio Cucci 817cb17f78 Migrate rn-tester/js/examples/Layout/LayoutExample.js to function components (#48646)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48646

As per title.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D68098856

fbshipit-source-id: ad878569f5b88afa57895b4b08de32c880ee8242
2025-01-14 03:20:05 -08:00
Dawid Małecki 2056794d24 Refactor import syntax that caused $FlowFixMe generation in snap (#48639)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48639

Changelog:
[Internal] - refactored import syntax in File, ElementProperties, Inspector, InspectorOverlay, InspectorPanel, PerformanceOverlay, Modal, YellowBoxDeprecated

Reviewed By: andrewdacenko

Differential Revision: D68099152

fbshipit-source-id: a0d840a6000fd3974a3ce4673455180a8be66288
2025-01-14 03:08:44 -08:00
Dawid Małecki 647ca90a30 Replace $FlowFixMe in AnimatedWeb (#48633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48633

Changelog:
[General][Changed] - Improved types in AnimatedWeb

Reviewed By: huntie

Differential Revision: D68092072

fbshipit-source-id: 396efffc64030b0b2d4085f969b92c422b227c0d
2025-01-14 02:59:52 -08:00
David Vacca 2d320fbd76 Cache ViewManagerDelegate on ViewManagers (#48550)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48550

Cache ViewManagerDelegate on ViewManagers

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D67957883

fbshipit-source-id: 8ec2f34fca04833e391b0bd5b9329cdc9ee12f08
2025-01-13 23:39:45 -08:00
Fabrizio Cucci 980458c061 Migrate rn-tester/js/components/RNTesterButton.js to function components (#48645)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48645

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D68098118

fbshipit-source-id: 09f9c318afc210ca2ce6967dac7109544ef6717c
2025-01-13 13:07:44 -08:00
Pieter De Baets 5a290c4cab Fix nullability of ViewManagerDelegate method args (#48602)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48602

See context in D64532446 / https://github.com/facebook/react-native/pull/47086

These argument types were already consumed as nullable in various OSS libraries, which prevents correct Kotlin migration of this code.

Changelog: [Android][Changed] Deprecated ViewManagerDelegate#setProperty and ViewManagerDelegate#receiveCommand

Reviewed By: mdvacca

Differential Revision: D67277871

fbshipit-source-id: a0743584891c7b2b4b50fff11de15da0078d5a1a
2025-01-13 10:54:37 -08:00
Fabrizio Cucci 90d2f65301 Migrate rn-tester/js/examples/AppState/AppStateExample.js to function components (#48644)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48644

As per title.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D68095480

fbshipit-source-id: 2487fa5e66d672883cbfde0c68348a90db09d484
2025-01-13 10:47:13 -08:00
Fabrizio Cucci 05e8007e12 Migrate rn-tester/js/examples/OrientationChange/OrientationChangeExample.js to function components (#48643)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48643

As per title.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D68095232

fbshipit-source-id: fdf45a3bb64c590ea21222a02ae94d975579db49
2025-01-13 10:47:13 -08:00
Fabrizio Cucci 1e0009407d Migrate rn-tester/js/components/TextInlineView.js to function components (#48640)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48640

As per title.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D68095013

fbshipit-source-id: a593af63029352844e544245d88e7b4c9d7eb75c
2025-01-13 08:59:43 -08:00
Parsa Nasirimehr 12e321daf0 chore(Android): Migrate Hermes Executor to Kotlin (#48617)
Summary:
Migrating HermesExecutor and it's factory to Kotlin. Not sure if the TAG in HermesExecutorFactory is needed anymore or not, but the rest of the changes are pretty bog standard

## Changelog:

[INTERNAL] [FIXED] - Migrate HermesExecutor and HermesExecutorFactory to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/48617

Test Plan:
`./gradlew test`:
<img width="1266" alt="Screenshot 2025-01-11 at 04 01 12" src="https://github.com/user-attachments/assets/c0f1402c-796b-45fa-9ee3-41c5a5ffc356" />

Reviewed By: tdn120

Differential Revision: D68094681

Pulled By: cortinico

fbshipit-source-id: 16eae5c7c24886421cbd2cbf213295134a9c01cf
2025-01-13 08:44:05 -08:00
Thomas Nardone c7785e7ead Convert ReactTextInlineImageShadowNode (#48576)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48576

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D67981753

fbshipit-source-id: 5d8a2408af9af350c0d3b369677ff8ee00335554
2025-01-13 08:39:18 -08:00
Rubén Norte fe8d102663 Create placeholder for User Timing API tests (#48634)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48634

Changelog: [internal]

Just a placeholder to add new tests in the future.

Reviewed By: sammy-SC

Differential Revision: D68093342

fbshipit-source-id: 1e1d7fd71865763ef66b3bb1c76ff8b8ebca9fd9
2025-01-13 07:01:03 -08:00
Riccardo Cipolleschi 671520943f Remove build codegen from Cocoapods (#48631)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48631

This step is already carried out by [generate-artifact-executor](https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/codegen/generate-artifacts-executor.js#L385) if needed.

We can remove it from cocoapods and this will make it easier to migrate away from them.

For 3rd party apps that uses a specific version of React Native, codegen is shipped in NPM as already built in the react-native/codegen package.

This change really affects only the React Native monorepo.

## Changelog
[Internal] - Remove build codegen step from cocoapods

Reviewed By: cortinico

Differential Revision: D68019743

fbshipit-source-id: 7aaf9275886ba8b86d38d943d2b26bd8eed11aa8
2025-01-13 07:00:12 -08:00
301 changed files with 3512 additions and 3755 deletions
-2
View File
@@ -20,8 +20,6 @@ runs:
- name: Set React Native Version
shell: bash
run: node ./scripts/releases/set-rn-artifacts-version.js --build-type ${{ inputs.release-type }}
# We don't want to re-set the artifacts version if we're on the release branch.
if: ${{ !contains(github.ref, '-stable') }}
- name: Setup gradle
uses: ./.github/actions/setup-gradle
with:
+1 -1
View File
@@ -35,7 +35,7 @@ runs:
steps:
- name: Installing Maestro
shell: bash
run: export MAESTRO_VERSION=1.39.5; curl -Ls "https://get.maestro.mobile.dev" | bash
run: export MAESTRO_VERSION=1.39.7; curl -Ls "https://get.maestro.mobile.dev" | bash
- name: Set up JDK 17
if: ${{ inputs.install-java == 'true' }}
uses: actions/setup-java@v4
+1 -1
View File
@@ -31,7 +31,7 @@ runs:
steps:
- name: Installing Maestro
shell: bash
run: export MAESTRO_VERSION=1.39.5; curl -Ls "https://get.maestro.mobile.dev" | bash
run: export MAESTRO_VERSION=1.39.7; curl -Ls "https://get.maestro.mobile.dev" | bash
- name: Installing Maestro dependencies
shell: bash
run: |
+6 -1
View File
@@ -157,7 +157,7 @@ jobs:
react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }}
test_ios_rntester:
runs-on: macos-13
runs-on: macos-13-large
needs:
[build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos]
env:
@@ -369,6 +369,11 @@ jobs:
sed -i 's/newArchEnabled=true/newArchEnabled=false/' android/gradle.properties
fi
if [[ ${{matrix.jsengine}} == "JSC" ]]; then
echo "Using JSC instead of Hermes"
sed -i 's/hermesEnabled=true/hermesEnabled=false/' android/gradle.properties
fi
# Build
cd android
CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
+155
View File
@@ -1,5 +1,160 @@
# Changelog
## v0.78.0-rc.0
### Breaking
- Codegen: Separate component array types and command array types ([825492b199](https://github.com/facebook/react-native/commit/825492b1999b62de708e6f40d5d5de8d3d7cb8a9) by [@elicwhite](https://github.com/elicwhite))
- The `FuseboxClient.setClientMetadata` CDP method is removed. Instead, use `ReactNativeApplication.enable`. ([1a9780f0e3](https://github.com/facebook/react-native/commit/1a9780f0e3714ac18ffae34cb67376c711b0e031) by [@huntie](https://github.com/huntie))
#### Android specific
- Changed visibility of FrescoBasedReactTextInlineImageViewManager to internal ([d5f33c19cb](https://github.com/facebook/react-native/commit/d5f33c19cb33e2f2c7d2470cc90872c1f065f20d) by [@alanleedev](https://github.com/alanleedev))
- Mikgrating pointerEvents API breaks compatibility for kotlin usages of this api as a val ([45e4a3afce](https://github.com/facebook/react-native/commit/45e4a3afceb4be3047cd01a60ec2c9f806ed30fe) by [@mdvacca](https://github.com/mdvacca))
- Convert RootView to Kotlin ([21c9491926](https://github.com/facebook/react-native/commit/21c94919260a68409f82081740169d0409e78933) by [@fabriziocucci](https://github.com/fabriziocucci))
- Delete unused abstract class GuardedResultAsyncTask ([67bff8734f](https://github.com/facebook/react-native/commit/67bff8734f4b92fe399910eecad5b67511a749c1) by [@mdvacca](https://github.com/mdvacca))
- Delete deprecated class FabricViewStateManager ([b25b65ba19](https://github.com/facebook/react-native/commit/b25b65ba19f3c674fd2efe5c01123ccc0ae55cbf) by [@mdvacca](https://github.com/mdvacca))
- Removed ComponentNameResolver from public API ([a4849cb3d6](https://github.com/facebook/react-native/commit/a4849cb3d6f4245d15eb3812e417a9f4248bb3a1) by [@mdvacca](https://github.com/mdvacca))
#### iOS specific
- Change Image load event size info from logical size to pixel ([09995fc874](https://github.com/facebook/react-native/commit/09995fc8741cfdc6095d09627262b4f6fbbaafc2) by [@zhongwuzw](https://github.com/zhongwuzw))
### Added
- Add support for the second parameter of `console.table` to specify a list of columns to print in the table. ([fd0894b1c7](https://github.com/facebook/react-native/commit/fd0894b1c7fcb20dd213ec1e93aafef25935d709) by [@rubennorte](https://github.com/rubennorte))
- Added `RawValue(Runtime*, jsi::Value&)` constructor to make a `RawValue` from a `jsi::Value`. ([03d2186ace](https://github.com/facebook/react-native/commit/03d2186ace2cb17c676b7763d5a545759a658b77) by [@hannojg](https://github.com/hannojg))
- Added `pointerEvents` to `TextProps` type. ([3efbe33ce0](https://github.com/facebook/react-native/commit/3efbe33ce03f846932406742528652eb695b957d) by [@hyochan](https://github.com/hyochan))
- Add `jest-diff v29.7.0` to devDependencies ([b27bd00a38](https://github.com/facebook/react-native/commit/b27bd00a389295250ec003357df713ebf306374b) by [@andrewdacenko](https://github.com/andrewdacenko))
- Add useColorScheme mock test ([24fee29f7a](https://github.com/facebook/react-native/commit/24fee29f7a8ab328bb35e66d145d6b9c2d018c1d) by [@Kudo](https://github.com/Kudo))
#### Android specific
- Make the addition of JitPack repository configurable ([a98528e609](https://github.com/facebook/react-native/commit/a98528e609ff0ace4b7bc82f3aa273b7e3fa6443) by [@cortinico](https://github.com/cortinico))
- Fixing schema types for component command params of Arrays ([25c673e357](https://github.com/facebook/react-native/commit/25c673e35784d8d8c49555af104b9b4d8d37973d) by [@elicwhite](https://github.com/elicwhite))
- SoftException categories ([c832f94cf7](https://github.com/facebook/react-native/commit/c832f94cf713d0cb7616ef095f38583979e1cf43) by Thomas Nardone)
- Add mockito-kotlin for Kotlin unit testing ([e393711ef8](https://github.com/facebook/react-native/commit/e393711ef88629a661b34d4aebe785855c5c5969) by Thomas Nardone)
- ActivityIndicator: setting `resource-id` from the `testID` prop ([87b1bad45e](https://github.com/facebook/react-native/commit/87b1bad45e4eb730ea07686a2b2558253c60d3b7) by [@mateoguzmana](https://github.com/mateoguzmana))
- Added `getState` method for `StateWrapperImpl` ([ed36e896ac](https://github.com/facebook/react-native/commit/ed36e896ac34fcbefece87456dbdfdff30d22ad5) by [@hannojg](https://github.com/hannojg))
#### iOS specific
- [TextInput] Integrate a new property - `disableKeyboardShortcuts`. It can disable the keyboard shortcuts on iPads. ([0154372b93](https://github.com/facebook/react-native/commit/0154372b93eb1b02f0c62f2a75c95f4fc6a9f3e8) by [@rezkiy37](https://github.com/rezkiy37))
- Implement ReactNativeFactory ([081be01a5d](https://github.com/facebook/react-native/commit/081be01a5dd24d0a398c6aa8297575502a17d5ec) by [@okwasniewski](https://github.com/okwasniewski))
- Support system font families (system-ui, ui-sans-serif, ui-serif, ui-monospace, and ui-rounded) on iOS ([1763321c89](https://github.com/facebook/react-native/commit/1763321c8960d30ddc4d3464a0fffdecdd44617a) by [@cxa](https://github.com/cxa))
### Changed
- Improved types in BoxInspector and refactored a code ([f832c450a5](https://github.com/facebook/react-native/commit/f832c450a52c4c9d61c1d6b609fcad1332613556) by [@coado](https://github.com/coado))
- Improved types in StyleInspector and refactored a code ([49e5c58c59](https://github.com/facebook/react-native/commit/49e5c58c595265c9fffc84741aab6363d291f1f5) by [@coado](https://github.com/coado))
- Improved types in ElementBox and refactored a code ([2959d49e8d](https://github.com/facebook/react-native/commit/2959d49e8d09663f9ac437ffcb66d1c99162c6d0) by [@coado](https://github.com/coado))
- Improve types on BorderBox ([48a7840919](https://github.com/facebook/react-native/commit/48a784091989c695e3432cb8ba657139eb9f5e99) by [@coado](https://github.com/coado))
- Improved formatting of values logged via `console.table` (including Markdown format). ([7154c62afb](https://github.com/facebook/react-native/commit/7154c62afb5371f3f861663826792e41229c344a) by [@rubennorte](https://github.com/rubennorte))
- Improve types on DrawerLayoutAndroid ([b5155fba89](https://github.com/facebook/react-native/commit/b5155fba895411e290faeeea06180fce24079f78) by [@huntie](https://github.com/huntie))
- Mark `intersectionRect` required in `NativeIntersectionObserverEntry` to reflect native logic. ([8681fc2ab2](https://github.com/facebook/react-native/commit/8681fc2ab20aa1e5937a0bf3fc58ed03c3e0ee23) by [@lunaleaps](https://github.com/lunaleaps))
- Upgrading `typescript-config` module version to `esnext` ([5370347f54](https://github.com/facebook/react-native/commit/5370347f54719f318a4e032aba6cbf2269e7c3d7) by [@mateoguzmana](https://github.com/mateoguzmana))
- Reverts #47503. (~~Callbacks passed to `animation.start(<callback>)` will be scheduled for execution in a microtask. Previously, there were certain scenarios in which the callback could be synchronously executed by `start`.~~) ([8793b7d89b](https://github.com/facebook/react-native/commit/8793b7d89bcafdfcca7ecb953e60882b67ffc807) by [@yungsters](https://github.com/yungsters))
- ([9aa21b5e87](https://github.com/facebook/react-native/commit/9aa21b5e8765f14a9806eac435636b87f62178cc) by [@lunaleaps](https://github.com/lunaleaps))
- Fix item disappearing with scroll in VirtualizedList ([df7b6ae092](https://github.com/facebook/react-native/commit/df7b6ae092d03385ebd05efd0f068c59e727f723) by [@Tom910](https://github.com/Tom910))
#### Android specific
- Introduce new public API ViewManagerInterface ([40a0cdbc99](https://github.com/facebook/react-native/commit/40a0cdbc99746f18ca15c48f3d8f03cdad1635af) by [@mdvacca](https://github.com/mdvacca))
- Bumped Android Gradle Plugin (AGP) to 8.8.0 ([4c7c836ebf](https://github.com/facebook/react-native/commit/4c7c836ebf956c13fa327170adaec43a076226e7) by [@cortinico](https://github.com/cortinico))
- Bump Gradle to 8.12 ([5e6478954c](https://github.com/facebook/react-native/commit/5e6478954c77f64a9086757ed4a879e83a1ab404) by [@cortinico](https://github.com/cortinico))
- Replaced custom XML decoder with Fresco's built-in decoder ([6feb90bb29](https://github.com/facebook/react-native/commit/6feb90bb290ab460df8df2f6f01531a77aac9008) by [@Abbondanzo](https://github.com/Abbondanzo))
- Update Fresco to 3.6.0 ([819b5c2c8d](https://github.com/facebook/react-native/commit/819b5c2c8dfad620152b159838575b6c03e18ffe) by [@Abbondanzo](https://github.com/Abbondanzo))
- Migrate jsc-android to mavenCentral ([e42a3a6b84](https://github.com/facebook/react-native/commit/e42a3a6b842d71fc25419c02f6015863fa019f05) by [@Kudo](https://github.com/Kudo))
- Migrate ComponentNameResolver to kotlin ([385b9f4265](https://github.com/facebook/react-native/commit/385b9f4265316a1e1cf8627ea7ed3bed790cc8c5) by [@mdvacca](https://github.com/mdvacca))
- Update Fresco to 3.5.0 ([72bb2f4089](https://github.com/facebook/react-native/commit/72bb2f4089d5e49b9e8a09f416d63db6c7d2b798) by [@Abbondanzo](https://github.com/Abbondanzo))
- Migrate `ReactSwitchManager` to Kotlin ([b886bc4db9](https://github.com/facebook/react-native/commit/b886bc4db970d8c70de1596dc3f88bdc398de482) by [@krozniata](https://github.com/krozniata))
#### iOS specific
- Reduce memory allocations when computing accessibilityLabel ([74bdab8bd8](https://github.com/facebook/react-native/commit/74bdab8bd8be2413734004145507c0688232053e) by [@sparga](https://github.com/sparga))
- Explicitly define the source files for React-graphics ([3ff9212ce4](https://github.com/facebook/react-native/commit/3ff9212ce46314a749e65dd246e49965288d8f57) by [@cipolleschi](https://github.com/cipolleschi))
- Use configuration type when adding ndebug flag to pods in release ([462fae4a29](https://github.com/facebook/react-native/commit/462fae4a29ba1a5249d05862d2593dca4d6758c1) by [@benhandanyan](https://github.com/benhandanyan))
- Fix typo in utils.rb ([fa03840e68](https://github.com/facebook/react-native/commit/fa03840e688067bf16a7fb60c00efdc9a1813f92) by [@WoLewicki](https://github.com/WoLewicki))
### Removed
#### Android specific
- Removed JSCHeapCapture module, deprecated PackagerCommandListener#onCaptureHeapCommand ([e06fa5d102](https://github.com/facebook/react-native/commit/e06fa5d1026843ec4a2ba3dd209652dc5290c0ba) by [@javache](https://github.com/javache))
- Made ReactCookieJarContainer internal. ([18ebea533d](https://github.com/facebook/react-native/commit/18ebea533d348329926bd7782bb55469aa228a4a) by [@javache](https://github.com/javache))
### Fixed
- Modified `console.table` to avoid mutating the received argument. ([caa77fbe2b](https://github.com/facebook/react-native/commit/caa77fbe2b03e6969ae9b542d011f926a0ede3c7) by [@rubennorte](https://github.com/rubennorte))
- Disable `react-in-jsx-scope` rule in eslint config ([ea56c432b7](https://github.com/facebook/react-native/commit/ea56c432b7a577d3805d1a7b4b46596799dd892e) by [@matinzd](https://github.com/matinzd))
- Fix a bug when fantom tests could not be run in parallel, e.g. in a stress-test. ([8696b79f73](https://github.com/facebook/react-native/commit/8696b79f73fec18a9e3785b9a2c150afc9965d76) by [@mijay](https://github.com/mijay))
- Fix peer dependencies on React types ([4368368ef5](https://github.com/facebook/react-native/commit/4368368ef5c3f3d08a66ee6c13222f6d81a2d2df) by [@cipolleschi](https://github.com/cipolleschi))
- Removed unnecessary state updates in React to reflect the current state of looping animations. ([6059660c60](https://github.com/facebook/react-native/commit/6059660c607f5b6edba08a12906f0f9d6cb15d34) by [@rubennorte](https://github.com/rubennorte))
- `JSBigFileString` fails for non-zero offset arguments ([7d0338cb0b](https://github.com/facebook/react-native/commit/7d0338cb0b24926aff648a4c8ba5d77b052010cc) by [@jwajgelt](https://github.com/jwajgelt))
- Animation.stop() executes when `animatedShouldUseSingleOp` is enabled. ([746d584a23](https://github.com/facebook/react-native/commit/746d584a23f303493faa4f9d857ec542257a92ae) by [@javache](https://github.com/javache))
- Fixed `adjustsFontSizeToFit` not working for text with a single character ([47822e9048](https://github.com/facebook/react-native/commit/47822e90480d61e197a3f223e088ee88a0f38ad7) by [@j-piasecki](https://github.com/j-piasecki))
#### Android specific
- Fix crash for setEventEmitterCallback NoSuchMethodError on API lvl 26 ([7dcbc799eb](https://github.com/facebook/react-native/commit/7dcbc799eb2fb5792512b71320eafed08deec9ea) by [@cortinico](https://github.com/cortinico))
- Fix incorrect height of single line TextInputs without definite size ([9b646c8b7b](https://github.com/facebook/react-native/commit/9b646c8b7b9a23645b1563883768a9274897a1cd) by [@NickGerleman](https://github.com/NickGerleman))
- `FLAG_SECURE` not respected in Modal dialog ([7e029b0dcf](https://github.com/facebook/react-native/commit/7e029b0dcf6d1a6455a8a6343457b70e353d0ff6) by [@mateoguzmana](https://github.com/mateoguzmana))
- Fix JSC Debug instacrashing ([b10491a3c4](https://github.com/facebook/react-native/commit/b10491a3c457c802608758ca1fe659a72c18576b) by [@cortinico](https://github.com/cortinico))
- Fix BackHandle callback undefined cause crash issue ([44705fe11b](https://github.com/facebook/react-native/commit/44705fe11bd9bb12c8f71d1e50a7b48e0af6a38d) by [@BleemIs42](https://github.com/BleemIs42))
- Modal: Setting `resource-id` from `testID` prop ([52b6592559](https://github.com/facebook/react-native/commit/52b65925595882d9b6c7f354a5ce3bfe3823738e) by [@mateoguzmana](https://github.com/mateoguzmana))
- Handling `testID` correctly for horizontal scroll view ([81c74cd35f](https://github.com/facebook/react-native/commit/81c74cd35f9e40c8ad4663fc932d0dddeaa4bc19) by [@mateoguzmana](https://github.com/mateoguzmana))
- Fixed build issue when including mapbuffer jni headers in library code ([ecf17666ad](https://github.com/facebook/react-native/commit/ecf17666ad84e15d31944962e2d0e846a5670977) by [@hannojg](https://github.com/hannojg))
- Support Long values in WritableMap and WritableArray ([e7f943de2f](https://github.com/facebook/react-native/commit/e7f943de2fd71d2259ab53e7817d2dcf96559f7e) by [@WoLewicki](https://github.com/WoLewicki))
- Re-introduce the deprecated constructor on ReactModuleInfo ([734730df75](https://github.com/facebook/react-native/commit/734730df75b3bdddeb5dbe65f4151cc92b988303) by [@cortinico](https://github.com/cortinico))
- Fix JSC by avoiding use of unavailable `str.replaceAll()` ([b5b9e032c2](https://github.com/facebook/react-native/commit/b5b9e032c2b57aa44afb7141a879d83c8b889feb) by [@robhogan](https://github.com/robhogan))
- Reverted removal of TurboReactPackage ([70a957452c](https://github.com/facebook/react-native/commit/70a957452c438a74787f4f752b2c274360cb2edd) by [@javache](https://github.com/javache))
- SetColorScheme should be called on the UI thread ([2aa79979d3](https://github.com/facebook/react-native/commit/2aa79979d3e4a54008f24c81b6c04553c98ff6b6) by lihaitao)
#### iOS specific
- Fix app becoming unresponsive when RefreshControl is used inside of <Modal /> ([6cb2684b43](https://github.com/facebook/react-native/commit/6cb2684b4343bd8698b9770c0f6ef8812683c783) by [@sammy-SC](https://github.com/sammy-SC))
- Resolve "Your project does not explicitly specify the CocoaPods master specs repo" `pod install` warning ([2f2281718a](https://github.com/facebook/react-native/commit/2f2281718a2ef905ffd15adf3b47a1b6b6fb8d95) by [@noway](https://github.com/noway))
- Enable/disable keyboard shortcuts only on iOS ([8b0af4542e](https://github.com/facebook/react-native/commit/8b0af4542e6fd5628fefdc8e1699326c2225c3f0) by [@okwasniewski](https://github.com/okwasniewski))
- Dashed & dotted borders now work with overflow: hidden ([1b88c5b429](https://github.com/facebook/react-native/commit/1b88c5b429888e109b7acae4808b4b6f8b3f920f) by [@joevilches](https://github.com/joevilches))
- Emit didUpdateDimensions correctly ([920867d949](https://github.com/facebook/react-native/commit/920867d9494cbfcc9cb0e23607cb339ec1b89ca9) by TobiasH)
- Fix applicationDidEnterBackground not being called ([adaceba546](https://github.com/facebook/react-native/commit/adaceba5462b4ad8676745f34e0be2bf5bb25166) by [@alextoudic](https://github.com/alextoudic))
- Fixed problem with accessory view & 3rd party libs ([5fc582783d](https://github.com/facebook/react-native/commit/5fc582783d7f70ca9521e317c93624a8845bfff2) by [@kirillzyusko](https://github.com/kirillzyusko))
- Fix Direct Debugging with JSC ([b04d17afca](https://github.com/facebook/react-native/commit/b04d17afcac82af1a47fd462a04fe4088d19b468) by [@Saadnajmi](https://github.com/Saadnajmi))
- Fix ccache not found error exporting ccache binary path as Xcode user-defined setting to be used by ccache scripts ([d31ac832c5](https://github.com/facebook/react-native/commit/d31ac832c5b866653f7179fd517427f7be11ad45) by [@ste7en](https://github.com/ste7en))
- Properly escape paths in Xcode build script used when bundling an app. ([2fee13094b](https://github.com/facebook/react-native/commit/2fee13094b3d384c071978776fd8b7cff0b6530f) by [@kraenhansen](https://github.com/kraenhansen))
- Exclude Android HorizontalScrollContentView cxx component code ([4adaacb4f7](https://github.com/facebook/react-native/commit/4adaacb4f7cd136d5534c81fb9b8f5f2a0312d7f) by [@zhongwuzw](https://github.com/zhongwuzw))
- Fixed centerContent losing taps and causing jitter ([fe7e97a2fd](https://github.com/facebook/react-native/commit/fe7e97a2fd272db0d9d9aa7d0561337a7c8e2c30) by [@gaearon](https://github.com/gaearon))
### Unknown
- Release 0.78.0-rc.0 ([b713f273b6](https://github.com/facebook/react-native/commit/b713f273b6df654e4274ae00a849c39d2efccedc) by [@react-native-bot](https://github.com/react-native-bot))
- Bump Hermes ([0c8e15e8bb](https://github.com/facebook/react-native/commit/0c8e15e8bb16ec279290d2390caf75e83d52f518) by [@cipolleschi](https://github.com/cipolleschi))
- Include cxx modules in codegen schema ([cf5ab03d43](https://github.com/facebook/react-native/commit/cf5ab03d4324b7e3fce38f9eacc96da82b11b68a) by [@elicwhite](https://github.com/elicwhite))
- Add "jsEngine: hermes" to JS runtime Error prototype ([85bdd75828](https://github.com/facebook/react-native/commit/85bdd75828f85230aaa90ed510666457c46f996c) by Maddie Lord)
- Translation auto-update for Apps/Wilde/scripts/intl-config.json on master ([5b6e35afda](https://github.com/facebook/react-native/commit/5b6e35afda5f0ef8cc8810ed8c6bd918777292b4) by Intl Scheduler)
- Add logging in ReactInstanceManager.onHostPause when activity is incorrectly null ([c2fd35a442](https://github.com/facebook/react-native/commit/c2fd35a4429c752dc2d10a789e4c5f48d22b1eeb) by Maddie Lord)
- Remove as_const option (on by default) in fbsource ([e5a526ff44](https://github.com/facebook/react-native/commit/e5a526ff44c25afd935d117d6d4d342f210553a6) by [@panagosg7](https://github.com/panagosg7))
- Remove comment syntax from ReactNativeTypes ([a80baac58e](https://github.com/facebook/react-native/commit/a80baac58e9f2fc62829ab76b929f5c8b21c05a5) by [@hoxyq](https://github.com/hoxyq))
- Update YGNodeStyleGetGap to return YGValue ([331d99a941](https://github.com/facebook/react-native/commit/331d99a94154678848628122e8fe3373ee67fb9b) by [@heoblitz](https://github.com/heoblitz))
- Remove unused-variable in ../xplat/compphoto/gpuEngine/tools/ToolHelpers.cpp +3 ([071d223ee0](https://github.com/facebook/react-native/commit/071d223ee02c6f826d06c033e6c949642bd24b9a) by [@r-barnes](https://github.com/r-barnes))
#### Android Unknown
- Fix background getting clipped when border-radius is set ([6d235853fb](https://github.com/facebook/react-native/commit/6d235853fb9e9ad4050ba5611d74921fa1b9c72d) by [@jorge-cab](https://github.com/jorge-cab))
#### iOS Unknown
- Static Hermes for React Native ([23eb06f662](https://github.com/facebook/react-native/commit/23eb06f6623f6831ff5f6a2f12e22884de4c1326) by [@piaskowyk](https://github.com/piaskowyk))
- Remove unused-variable in xplat/js/react-native-github/packages/react-native/React/Base/RCTModuleData.mm +3 ([72007a14af](https://github.com/facebook/react-native/commit/72007a14af3afe0e161c1144af39759807807f25) by [@r-barnes](https://github.com/r-barnes))
#### Failed to parse
- Apply fixup patch to fbsource ([7948044179](https://github.com/facebook/react-native/commit/794804417990848d0fc9bb8939b9c340ced3477f) by generatedunixname499836121)
- Test(image): [android] react okhttp network fetcher cache control tests ([37c532a063](https://github.com/facebook/react-native/commit/37c532a063c6054ea974612a40551f7c1399c147) by [@mateoguzmana](https://github.com/mateoguzmana))
- Test(network): [android] `ResponseUtil` unit tests ([50d0157f0c](https://github.com/facebook/react-native/commit/50d0157f0c6a4e3224d8064a8b55c523bcd33269) by [@mateoguzmana](https://github.com/mateoguzmana))
- ReactOkHttpNetworkFetcher cache control headers getting overwritten by the rest of the headers ([81cb166d10](https://github.com/facebook/react-native/commit/81cb166d103f7caaa5135b5a1c66d4e978f3619f) by [@mateoguzmana](https://github.com/mateoguzmana))
## v0.76.6
### Fixed
-393
View File
@@ -1,393 +0,0 @@
Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public licenses.
Notwithstanding, Creative Commons may elect to apply one of its public
licenses to material it publishes and in those instances will be
considered the "Licensor." Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the public
licenses.
Creative Commons may be contacted at creativecommons.org.
@@ -27,7 +27,6 @@ import com.facebook.react.utils.JsonUtils
import com.facebook.react.utils.NdkConfiguratorUtils.configureReactNativeNdk
import com.facebook.react.utils.ProjectUtils.isNewArchEnabled
import com.facebook.react.utils.ProjectUtils.needsCodegenFromPackageJson
import com.facebook.react.utils.ProjectUtils.shouldWarnIfNewArchFlagIsSetInPrealpha
import com.facebook.react.utils.findPackageJsonFile
import java.io.File
import kotlin.system.exitProcess
@@ -42,7 +41,6 @@ class ReactPlugin : Plugin<Project> {
override fun apply(project: Project) {
checkJvmVersion(project)
val extension = project.extensions.create("react", ReactExtension::class.java, project)
checkIfNewArchFlagIsSet(project, extension)
// We register a private extension on the rootProject so that project wide configs
// like codegen config can be propagated from app project to libraries.
@@ -112,23 +110,6 @@ class ReactPlugin : Plugin<Project> {
}
}
private fun checkIfNewArchFlagIsSet(project: Project, extension: ReactExtension) {
if (project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)) {
project.logger.warn(
"""
********************************************************************************
WARNING: This version of React Native is ignoring the `newArchEnabled` flag you set. Please set it to true or remove it to suppress this warning.
********************************************************************************
"""
.trimIndent())
}
}
/** This function sets up `react-native-codegen` in our Gradle plugin. */
@Suppress("UnstableApiUsage")
private fun configureCodegen(
@@ -17,7 +17,6 @@ import com.facebook.react.utils.PropertyUtils.REACT_NATIVE_ARCHITECTURES
import com.facebook.react.utils.PropertyUtils.SCOPED_HERMES_ENABLED
import com.facebook.react.utils.PropertyUtils.SCOPED_NEW_ARCH_ENABLED
import com.facebook.react.utils.PropertyUtils.SCOPED_REACT_NATIVE_ARCHITECTURES
import java.io.File
import org.gradle.api.Project
import org.gradle.api.file.DirectoryProperty
@@ -29,8 +28,7 @@ internal object ProjectUtils {
return (project.hasProperty(NEW_ARCH_ENABLED) &&
project.property(NEW_ARCH_ENABLED).toString().toBoolean()) ||
(project.hasProperty(SCOPED_NEW_ARCH_ENABLED) &&
project.property(SCOPED_NEW_ARCH_ENABLED).toString().toBoolean()) ||
shouldEnableNewArchForReactNativeVersion(project.reactNativeDir(extension))
project.property(SCOPED_NEW_ARCH_ENABLED).toString().toBoolean())
}
internal val Project.isHermesEnabled: Boolean
@@ -83,50 +81,6 @@ internal object ProjectUtils {
internal fun Project.reactNativeDir(extension: ReactExtension): String =
extension.reactNativeDir.get().asFile.absolutePath
internal fun shouldEnableNewArchForReactNativeVersion(reactNativeDir: String): Boolean {
val packageJsonFile = File(reactNativeDir, "package.json")
if (!packageJsonFile.exists()) {
return false
}
val rnPackageJson = JsonUtils.fromPackageJson(packageJsonFile)
if (rnPackageJson == null) {
return false
}
// This regex describe the version syntax for React Native in the shape of
// major.minor.patch[-<prerelease>[[-.]k]]
// Where
// major is a number
// minor is a number
// patch is a number
// <prerelease>[-.]k is optional, but if present is preceeded by a `-`
// the <prerelease> tag is a string.
// it can be followed by `-` or `.` and k is a number.
val regex = """^(\d+)\.(\d+)\.(\d+)(?:-(\w+(?:[-.]\d+)?))?$""".toRegex()
val matchResult = regex.find(rnPackageJson.version)
if (matchResult == null) {
return false
}
val prerelease = matchResult.groupValues[4].toString()
return prerelease.contains("prealpha")
}
internal fun Project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension: ReactExtension): Boolean {
val propertySetToFalse =
(this.hasPropertySetToFalse(NEW_ARCH_ENABLED)) ||
(this.hasPropertySetToFalse(SCOPED_NEW_ARCH_ENABLED))
val shouldEnableNewArch =
shouldEnableNewArchForReactNativeVersion(this.reactNativeDir(extension))
return shouldEnableNewArch && propertySetToFalse
}
internal fun Project.hasPropertySetToFalse(property: String): Boolean =
this.hasProperty(property) && this.property(property).toString().toBoolean() == false
}
@@ -15,7 +15,6 @@ import com.facebook.react.utils.ProjectUtils.getReactNativeArchitectures
import com.facebook.react.utils.ProjectUtils.isHermesEnabled
import com.facebook.react.utils.ProjectUtils.isNewArchEnabled
import com.facebook.react.utils.ProjectUtils.needsCodegenFromPackageJson
import com.facebook.react.utils.ProjectUtils.shouldWarnIfNewArchFlagIsSetInPrealpha
import java.io.File
import org.assertj.core.api.Assertions.assertThat
import org.junit.Rule
@@ -75,78 +74,6 @@ class ProjectUtilsTest {
assertThat(project.isNewArchEnabled(extension)).isFalse()
}
@Test
fun isNewArchEnabled_withRNVersionPrealpha_returnTrue() {
val project = createProject()
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.0.0-prealpha-202310916"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.isNewArchEnabled(extension)).isTrue()
}
@Test
fun isNewArchEnabled_withRNVersion1PrereleaseString_returnTrue() {
val project = createProject()
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "1.2.3-prealpha0"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.isNewArchEnabled(extension)).isTrue()
}
@Test
fun isNewArchEnabled_withRNVersion1PrereleaseStringDotNumber_returnTrue() {
val project = createProject()
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "1.2.3-prealpha.0"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.isNewArchEnabled(extension)).isTrue()
}
@Test
fun isNewArchEnabled_withRNVersion1PrereleaseStringDashNumber_returnTrue() {
val project = createProject()
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "1.2.3-prealpha-0"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.isNewArchEnabled(extension)).isTrue()
}
@Test
fun isNewArchEnabled_withRNVersion1000_returnFalse() {
val project = createProject()
@@ -320,214 +247,4 @@ class ProjectUtilsTest {
assertThat(archs[2]).isEqualTo("x86")
assertThat(archs[3]).isEqualTo("x86_64")
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNewArchIsSetToFalseAndOnPrealpha_returnTrue() {
val project = createProject()
project.extensions.extraProperties.set("newArchEnabled", "false")
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.0.0-prealpha-2023100915"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isTrue()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenScopedNewArchIsSetToFalseAndOnPrealpha_returnTrue() {
val project = createProject()
project.extensions.extraProperties.set("react.newArchEnabled", "false")
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.0.0-prealpha-2023100915"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isTrue()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenBothAreSetToFalseAndOnPrealpha_returnTrue() {
val project = createProject()
project.extensions.extraProperties.set("newArchEnabled", "false")
project.extensions.extraProperties.set("react.newArchEnabled", "false")
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.0.0-prealpha-2023100915"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isTrue()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNewArchIsSetToTrueAndOnPrealpha_returnFalse() {
val project = createProject()
project.extensions.extraProperties.set("newArchEnabled", "true")
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.0.0-prealpha-2023100915"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenScopedNewArchIsSetToTrueAndOnPrealpha_returnFalse() {
val project = createProject()
project.extensions.extraProperties.set("react.newArchEnabled", "true")
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.0.0-prealpha-2023100915"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenBothAreSetToTrueAndOnPrealpha_returnFalse() {
val project = createProject()
project.extensions.extraProperties.set("newArchEnabled", "true")
project.extensions.extraProperties.set("react.newArchEnabled", "true")
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.0.0-prealpha-2023100915"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNoneAreSetAndOnPrealpha_returnFalse() {
val project = createProject()
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.0.0-prealpha-2023100915"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNewArchIsSetToTrueAndNotOnPrealpha_returnFalse() {
val project = createProject()
project.extensions.extraProperties.set("newxArchEnabled", "true")
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.73.0"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenScopedNewArchIsSetToTrueAndNotOnPrealpha_returnFalse() {
val project = createProject()
project.extensions.extraProperties.set("react.newxArchEnabled", "true")
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.73.0"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenBothAreSetToTrueAndNotOnPrealpha_returnFalse() {
val project = createProject()
project.extensions.extraProperties.set("newArchEnabled", "true")
project.extensions.extraProperties.set("react.newxArchEnabled", "true")
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.73.0"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
}
@Test
fun shouldWarnIfNewArchFlagIsSetInPrealpha_whenNoneAreSetAndNotOnPrealpha_returnFalse() {
val project = createProject()
val extension = TestReactExtension(project)
File(tempFolder.root, "package.json").apply {
writeText(
// language=json
"""
{
"version": "0.73.0"
}
"""
.trimIndent())
}
extension.reactNativeDir.set(tempFolder.root)
assertThat(project.shouldWarnIfNewArchFlagIsSetInPrealpha(extension)).isFalse()
}
}
@@ -25,7 +25,7 @@ import type {
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
@@ -39,9 +39,9 @@ type NativeProps = $ReadOnly<{|
edgeInsets?: $ReadOnlyArray<EdgeInsetsValue>,
dimensions?: $ReadOnlyArray<DimensionValue>,
sizes?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>,
object?: $ReadOnlyArray<$ReadOnly<{|prop: string|}>>,
arrayOfObjects?: $ReadOnlyArray<$ReadOnly<{|prop1: Float, prop2: Int32|}>>,
|}>;
object?: $ReadOnlyArray<$ReadOnly<{prop: string}>>,
arrayOfObjects?: $ReadOnlyArray<$ReadOnly<{prop1: Float, prop2: Int32}>>,
}>;
export default (codegenNativeComponent<NativeProps>(
'ArrayPropsNativeComponentView',
@@ -14,13 +14,13 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
disabled?: WithDefault<boolean, false>,
disabledNullable?: WithDefault<boolean, null>,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'BooleanPropNativeComponentView',
@@ -14,12 +14,12 @@ import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
tintColor?: ColorValue,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'ColorPropNativeComponentView',
@@ -14,12 +14,12 @@ import type {DimensionValue} from 'react-native/Libraries/StyleSheet/StyleSheetT
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
marginBack?: DimensionValue,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'DimensionPropNativeComponentView',
@@ -13,13 +13,13 @@ import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNat
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
// TODO(T104760003) Fix EdgeInsetsValue in codegen
// contentInset?: EdgeInsetsValue,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'EdgeInsetsPropNativeComponentView',
@@ -14,13 +14,13 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
alignment?: WithDefault<'top' | 'center' | 'bottom-right', 'center'>,
intervals?: WithDefault<0 | 15 | 30 | 60, 0>,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'EnumPropNativeComponentView',
@@ -18,7 +18,7 @@ import type {
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type OnChangeEvent = $ReadOnly<{|
type OnChangeEvent = $ReadOnly<{
location: {
source: {url: string, ...},
x: Int32,
@@ -26,9 +26,9 @@ type OnChangeEvent = $ReadOnly<{|
arrayOfObjects: $ReadOnlyArray<{value: $ReadOnly<{str: string}>}>,
...
},
|}>;
}>;
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
@@ -36,7 +36,7 @@ type NativeProps = $ReadOnly<{|
// Events
onChange?: ?BubblingEventHandler<OnChangeEvent>,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'EventNestedObjectPropsNativeComponentView',
@@ -20,22 +20,22 @@ import type {
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type OnChangeEvent = $ReadOnly<{|
type OnChangeEvent = $ReadOnly<{
value: boolean,
source?: string,
progress: ?Int32,
scale?: ?Float,
|}>;
}>;
type OnEventDirect = $ReadOnly<{|
type OnEventDirect = $ReadOnly<{
value: boolean,
|}>;
}>;
type OnOrientationChangeEvent = $ReadOnly<{|
type OnOrientationChangeEvent = $ReadOnly<{
orientation: 'landscape' | 'portrait',
|}>;
}>;
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
@@ -57,7 +57,7 @@ type NativeProps = $ReadOnly<{|
null,
'paperBubblingName',
>,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'EventPropsNativeComponentView',
@@ -17,7 +17,7 @@ import type {
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
@@ -28,7 +28,7 @@ type NativeProps = $ReadOnly<{|
blurRadius5?: WithDefault<Float, 1>,
blurRadius6?: WithDefault<Float, -0.0>,
blurRadiusNullable?: WithDefault<Float, null>,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'FloatPropsNativeComponentView',
@@ -14,12 +14,12 @@ import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNat
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
thumbImage?: ImageSource,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'ImagePropNativeComponentView',
@@ -17,14 +17,14 @@ import type {
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
progress1?: WithDefault<Int32, 0>,
progress2?: WithDefault<Int32, -1>,
progress3?: WithDefault<Int32, 10>,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'IntegerPropNativeComponentView',
@@ -17,15 +17,15 @@ import type {
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
title?: WithDefault<string, ''>,
// Events
onChange?: ?BubblingEventHandler<$ReadOnly<{|value: boolean|}>>,
|}>;
onChange?: ?BubblingEventHandler<$ReadOnly<{value: boolean}>>,
}>;
export default (codegenNativeComponent<NativeProps>(
'InterfaceOnlyNativeComponentView',
@@ -14,12 +14,12 @@ import type {UnsafeMixed} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
mixedProp?: UnsafeMixed,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'MixedPropNativeComponentView',
@@ -16,7 +16,7 @@ import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
@@ -24,7 +24,7 @@ type NativeProps = $ReadOnly<{|
color?: ColorValue,
thumbTintColor?: ColorValue,
point?: PointValue,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'MultiNativePropNativeComponentView',
@@ -13,11 +13,11 @@ import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNat
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// No Props or events
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'NoPropsNoEventsNativeComponentView',
@@ -21,29 +21,29 @@ import type {
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type ObjectArrayPropType = $ReadOnly<{|
type ObjectArrayPropType = $ReadOnly<{
array: $ReadOnlyArray<string>,
|}>;
}>;
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
objectProp?: $ReadOnly<{|
objectProp?: $ReadOnly<{
stringProp?: WithDefault<string, ''>,
booleanProp: boolean,
floatProp: Float,
intProp: Int32,
stringEnumProp?: WithDefault<'small' | 'large', 'small'>,
intEnumProp?: WithDefault<0 | 1, 0>,
|}>,
}>,
objectArrayProp: ObjectArrayPropType,
objectPrimitiveRequiredProp: $ReadOnly<{|
objectPrimitiveRequiredProp: $ReadOnly<{
image: ImageSource,
color?: ColorValue,
point: ?PointValue,
|}>,
|}>;
}>,
}>;
export default (codegenNativeComponent<NativeProps>(
'ObjectPropsNativeComponent',
@@ -14,12 +14,12 @@ import type {PointValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
startPoint?: PointValue,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'PointPropNativeComponentView',
@@ -14,13 +14,13 @@ import type {WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
// Props
placeholder?: WithDefault<string, ''>,
defaultValue?: string,
|}>;
}>;
export default (codegenNativeComponent<NativeProps>(
'StringPropNativeComponentView',
@@ -12,9 +12,9 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export type StateType = {|
export type StateType = {
state: string,
|};
};
export enum StatusRegularEnum {
Active,
@@ -40,13 +40,13 @@ export enum StatusLowerCaseEnum {
Off = 'off',
}
export type StateTypeWithEnums = {|
export type StateTypeWithEnums = {
state: string,
regular: StatusRegularEnum,
str: StatusStrEnum,
num: StatusNumEnum,
lowerCase: StatusLowerCaseEnum,
|};
};
export interface Spec extends TurboModule {
+getStatusRegular: (statusProp: StateType) => StatusRegularEnum;
@@ -17,46 +17,46 @@ type AnotherGenericObject = GenericObject;
export interface Spec extends TurboModule {
+getGenericObject: (arg: Object) => Object;
+getGenericObjectReadOnly: (arg: Object) => $ReadOnly<{|a: string|}>;
+getGenericObjectReadOnly: (arg: Object) => $ReadOnly<{a: string}>;
+getGenericObjectWithAlias: (arg: GenericObject) => AnotherGenericObject;
+difficultObject: (A: {|
+difficultObject: (A: {
D: boolean,
E: {|
E: {
D: boolean,
E: number,
F: string,
|},
},
F: string,
|}) => {|
}) => {
D: boolean,
E: {|
E: {
D: boolean,
E: {|
E: {
D: boolean,
E: number,
F: string,
|},
},
F: string,
|},
},
F: string,
|};
+getConstants: () => {|
};
+getConstants: () => {
D: boolean,
E: {|
E: {
D: boolean,
E: {|
E: {
D: boolean,
E: {|
E: {
D: boolean,
E: number,
F: string,
|},
},
F: string,
|},
},
F: string,
|},
},
F: string,
|};
};
}
export default (TurboModuleRegistry.getEnforcing<Spec>(
@@ -13,24 +13,24 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getConstants: () => {|
+getConstants: () => {
D?: ?boolean,
A?: Array<any>,
E?: ?{|
E?: ?{
D?: ?boolean,
E?: ?{|
E?: ?{
D?: ?boolean,
E?: ?{|
E?: ?{
D?: boolean,
E?: number,
F?: string,
|},
},
F?: string,
|},
},
F?: string,
|},
},
F?: string,
|};
};
}
export default (TurboModuleRegistry.getEnforcing<Spec>(
@@ -14,10 +14,10 @@ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
export type SomeObj = {|
export type SomeObj = {
a: string,
b?: boolean,
|};
};
export type PartialSomeObj = Partial<SomeObj>;
@@ -15,24 +15,24 @@ import type {
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
type Animal = {|
type Animal = {
name: string,
|};
};
export interface Spec extends TurboModule {
// Exported methods.
+getConstants: () => {|
+getConstants: () => {
const1: boolean,
const2: number,
const3: string,
|};
};
+voidFunc: () => void;
+getBool: (arg: boolean) => boolean;
+getNumber: (arg: number) => number;
+getString: (arg: string) => string;
+getArray: (arg: Array<any>) => Array<any>;
+getObject: (arg: Object) => Object;
+getObjectShape: (arg: {|prop: number|}) => {|prop: number|};
+getObjectShape: (arg: {prop: number}) => {prop: number};
+getAlias: (arg: Animal) => Animal;
+getRootTag: (arg: RootTag) => RootTag;
+getValue: (
@@ -15,25 +15,25 @@ import type {
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
type Animal = {|
type Animal = {
name: string,
|};
};
export interface Spec extends TurboModule {
// Exported methods.
+getConstants: () => {|
+getConstants: () => {
const1: Array<boolean>,
const2: Array<number>,
const3: Array<string>,
id?: Array<?{|prop: number|}>,
|};
id?: Array<?{prop: number}>,
};
+voidFunc: () => void;
+getBool: (id: Array<boolean>) => Array<boolean>;
+getNumber: (arg: Array<number>) => Array<number>;
+getString: (arg: Array<string>) => Array<string>;
+getArray: (arg: Array<Array<any>>) => Array<Array<any>>;
+getObject: (arg: Array<Object>) => Array<Object>;
+getObjectShape: (arg: Array<{|prop: number|}>) => Array<{|prop: number|}>;
+getObjectShape: (arg: Array<{prop: number}>) => Array<{prop: number}>;
+getAlias: (arg: Array<Animal>) => Array<Animal>;
+getRootTag: (arg: Array<RootTag>) => Array<RootTag>;
+getValue: (
@@ -15,24 +15,24 @@ import type {
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
type Animal = ?{|
type Animal = ?{
name: ?string,
|};
};
export interface Spec extends TurboModule {
// Exported methods.
+getConstants: () => {|
+getConstants: () => {
const1: ?boolean,
const2: ?number,
const3: ?string,
|};
};
+voidFunc: () => void;
+getBool: (arg: ?boolean) => ?boolean;
+getNumber: (arg: ?number) => ?number;
+getString: (arg: ?string) => ?string;
+getArray: (arg: ?Array<any>) => ?Array<any>;
+getObject: (arg: ?Object) => ?Object;
+getObjectShape: (arg: ?{|prop: ?number|}) => ?{|prop: ?number|};
+getObjectShape: (arg: ?{prop: ?number}) => ?{prop: ?number};
+getAlias: (arg: ?Animal) => ?Animal;
+getRootTag: (arg: ?RootTag) => ?RootTag;
+getValue: (x: ?number, y: ?string, z: ?Object) => ?Object;
@@ -15,24 +15,24 @@ import type {
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
type Animal = ?{|
type Animal = ?{
name?: ?string,
|};
};
export interface Spec extends TurboModule {
// Exported methods.
+getConstants?: () => {|
+getConstants?: () => {
const1?: ?boolean,
const2?: ?number,
const3?: ?string,
|};
};
+voidFunc?: () => void;
+getBool?: (arg?: ?boolean) => ?boolean;
+getNumber?: (arg?: ?number) => ?number;
+getString?: (arg?: ?string) => ?string;
+getArray?: (arg?: ?Array<any>) => ?Array<any>;
+getObject?: (arg?: ?Object) => ?Object;
+getObjectShape?: (arg?: {|prop?: ?number|}) => {|prop?: ?number|};
+getObjectShape?: (arg?: {prop?: ?number}) => {prop?: ?number};
+getAlias?: (arg?: ?Animal) => ?Animal;
+getRootTag?: (arg?: ?RootTag) => ?RootTag;
+getValue?: (x?: ?number, y?: ?string, z?: ?Object) => ?Object;
@@ -15,24 +15,24 @@ import type {
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
type Animal = {|
type Animal = {
name?: string,
|};
};
export interface Spec extends TurboModule {
// Exported methods.
+getConstants?: () => {|
+getConstants?: () => {
const1?: boolean,
const2?: number,
const3?: string,
|};
};
+voidFunc?: () => void;
+getBool?: (arg?: boolean) => boolean;
+getNumber?: (arg?: number) => number;
+getString?: (arg?: string) => string;
+getArray?: (arg?: Array<any>) => Array<any>;
+getObject?: (arg?: Object) => Object;
+getObjectShape?: (arg?: {|prop?: number|}) => {|prop?: number|};
+getObjectShape?: (arg?: {prop?: number}) => {prop?: number};
+getAlias?: (arg?: Animal) => Animal;
+getRootTag?: (arg?: RootTag) => RootTag;
+getValue?: (x?: number, y?: string, z?: Object) => Object;
@@ -28,18 +28,18 @@ type Event = $ReadOnly<{
doubles: $ReadOnlyArray<Double>,
yesNos: $ReadOnlyArray<'yep' | 'nope'>,
strings: $ReadOnlyArray<string>,
latLons: $ReadOnlyArray<{|lat: Double, lon: Double|}>,
latLons: $ReadOnlyArray<{lat: Double, lon: Double}>,
multiArrays: $ReadOnlyArray<$ReadOnlyArray<Int32>>,
}>;
type NativeProps = $ReadOnly<{|
type NativeProps = $ReadOnly<{
...ViewProps,
opacity?: Float,
values: $ReadOnlyArray<Int32>,
// Events
onIntArrayChanged?: ?BubblingEventHandler<Event>,
|}>;
}>;
export type NativeComponentType = HostComponent<NativeProps>;
@@ -40,7 +40,7 @@ const ActionSheetIOS = {
* See https://reactnative.dev/docs/actionsheetios#showactionsheetwithoptions
*/
showActionSheetWithOptions(
options: {|
options: {
+title?: ?string,
+message?: ?string,
+options: Array<string>,
@@ -52,7 +52,7 @@ const ActionSheetIOS = {
+disabledButtonTintColor?: ColorValue | ProcessedColorValue,
+userInterfaceStyle?: string,
+disabledButtonIndices?: Array<number>,
|},
},
callback: (buttonIndex: number) => void,
) {
invariant(
+1 -1
View File
@@ -192,4 +192,4 @@ export default {
forkEvent: AnimatedImplementation.forkEvent,
unforkEvent: AnimatedImplementation.unforkEvent,
Event: AnimatedEvent,
};
} as typeof AnimatedImplementation;
+27 -9
View File
@@ -10,17 +10,35 @@
'use strict';
import type {AnimatedComponentType} from './createAnimatedComponent';
import AnimatedImplementation from './AnimatedImplementation';
import React from 'react';
export default {
...AnimatedImplementation,
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
* types. Plain intrinsic components can't be typed like this */
div: (AnimatedImplementation.createAnimatedComponent('div'): $FlowFixMe),
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
* types. Plain intrinsic components can't be typed like this */
span: (AnimatedImplementation.createAnimatedComponent('span'): $FlowFixMe),
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
* types. Plain intrinsic components can't be typed like this */
img: (AnimatedImplementation.createAnimatedComponent('img'): $FlowFixMe),
div: AnimatedImplementation.createAnimatedComponent<
React.PropsOf<'div'>,
mixed,
>(
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
* types. Plain intrinsic components can't be typed like this */
'div',
) as AnimatedComponentType<React.PropsOf<'div'>>,
span: AnimatedImplementation.createAnimatedComponent<
React.PropsOf<'span'>,
mixed,
>(
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
* types. Plain intrinsic components can't be typed like this */
'span',
) as AnimatedComponentType<React.PropsOf<'span'>>,
img: AnimatedImplementation.createAnimatedComponent<
React.PropsOf<'img'>,
mixed,
>(
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
* types. Plain intrinsic components can't be typed like this */
'img',
) as AnimatedComponentType<React.PropsOf<'img'>>,
};
@@ -9,6 +9,7 @@
*/
import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
import type {PlatformConfig} from '../AnimatedPlatformConfig';
import type Animation, {EndCallback} from '../animations/Animation';
import type {InterpolationConfigType} from './AnimatedInterpolation';
import type AnimatedNode from './AnimatedNode';
@@ -131,6 +132,11 @@ export default class AnimatedValue extends AnimatedWithChildren {
return this._value + this._offset;
}
__makeNative(platformConfig: ?PlatformConfig): void {
super.__makeNative(platformConfig);
this.#ensureUpdateSubscriptionExists();
}
#ensureUpdateSubscriptionExists(): void {
if (this.#updateSubscription != null) {
return;
+14 -13
View File
@@ -276,6 +276,20 @@ function useAnimatedPropsLifecycle_insertionEffects(node: AnimatedProps): void {
// if the queue is empty. When multiple animated components are mounted at
// the same time. Only first component flushes the queue and the others will noop.
NativeAnimatedHelper.API.flushQueue();
let drivenAnimationEndedListener: ?EventSubscription = null;
if (node.__isNative) {
drivenAnimationEndedListener =
NativeAnimatedHelper.nativeEventEmitter.addListener(
'onUserDrivenAnimationEnded',
data => {
node.update();
},
);
}
return () => {
drivenAnimationEndedListener?.remove();
};
});
useInsertionEffect(() => {
@@ -287,17 +301,6 @@ function useAnimatedPropsLifecycle_insertionEffects(node: AnimatedProps): void {
useInsertionEffect(() => {
node.__attach();
let drivenAnimationEndedListener: ?EventSubscription = null;
if (node.__isNative) {
drivenAnimationEndedListener =
NativeAnimatedHelper.nativeEventEmitter.addListener(
'onUserDrivenAnimationEnded',
data => {
node.update();
},
);
}
if (prevNodeRef.current != null) {
const prevNode = prevNodeRef.current;
// TODO: Stop restoring default values (unless `reset` is called).
@@ -312,8 +315,6 @@ function useAnimatedPropsLifecycle_insertionEffects(node: AnimatedProps): void {
} else {
prevNodeRef.current = node;
}
drivenAnimationEndedListener?.remove();
};
}, [node]);
}
+2 -1
View File
@@ -12,7 +12,8 @@
import type {BlobOptions} from './BlobTypes';
const Blob = require('./Blob');
import Blob from './Blob';
const invariant = require('invariant');
/**
@@ -26,15 +26,15 @@ const GRAY = '#999999';
type IndicatorSize = number | 'small' | 'large';
type IOSProps = $ReadOnly<{|
type IOSProps = $ReadOnly<{
/**
Whether the indicator should hide when not animating.
@platform ios
*/
hidesWhenStopped?: ?boolean,
|}>;
type Props = $ReadOnly<{|
}>;
type Props = $ReadOnly<{
...ViewProps,
...IOSProps,
@@ -58,7 +58,7 @@ type Props = $ReadOnly<{|
@type {@platform android} number
*/
size?: ?IndicatorSize,
|}>;
}>;
const ActivityIndicator = (
{
+2 -2
View File
@@ -27,7 +27,7 @@ import View from './View/View';
import invariant from 'invariant';
import * as React from 'react';
type ButtonProps = $ReadOnly<{|
type ButtonProps = $ReadOnly<{
/**
Text to display inside the button. On Android the given title will be
converted to the uppercased form.
@@ -167,7 +167,7 @@ type ButtonProps = $ReadOnly<{|
importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
accessibilityHint?: ?string,
accessibilityLanguage?: ?Stringish,
|}>;
}>;
/**
A basic button component that should render nicely on any platform. Supports a
@@ -31,11 +31,11 @@ const DRAWER_STATES = ['Idle', 'Dragging', 'Settling'];
type DrawerStates = 'Idle' | 'Dragging' | 'Settling';
type DrawerSlideEvent = $ReadOnly<{|
type DrawerSlideEvent = $ReadOnly<{
offset: number,
|}>;
}>;
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
accessibilityRole?: ?AccessibilityRole,
/**
@@ -116,11 +116,11 @@ type Props = $ReadOnly<{|
children?: React.Node,
style?: ?ViewStyleProp,
|}>;
}>;
type State = {|
type State = {
drawerOpened: boolean,
|};
};
/**
* React component that wraps the platform `DrawerLayout` (Android only). The
@@ -25,32 +25,32 @@ export type KeyboardEventEasing =
| 'linear'
| 'keyboard';
export type KeyboardMetrics = $ReadOnly<{|
export type KeyboardMetrics = $ReadOnly<{
screenX: number,
screenY: number,
width: number,
height: number,
|}>;
}>;
export type KeyboardEvent = AndroidKeyboardEvent | IOSKeyboardEvent;
type BaseKeyboardEvent = {|
type BaseKeyboardEvent = {
duration: number,
easing: KeyboardEventEasing,
endCoordinates: KeyboardMetrics,
|};
};
export type AndroidKeyboardEvent = $ReadOnly<{|
export type AndroidKeyboardEvent = $ReadOnly<{
...BaseKeyboardEvent,
duration: 0,
easing: 'keyboard',
|}>;
}>;
export type IOSKeyboardEvent = $ReadOnly<{|
export type IOSKeyboardEvent = $ReadOnly<{
...BaseKeyboardEvent,
startCoordinates: KeyboardMetrics,
isEventFromThisApp: boolean,
|}>;
}>;
type KeyboardEventDefinitions = {
keyboardWillShow: [KeyboardEvent],
@@ -27,7 +27,7 @@ import View from '../View/View';
import Keyboard from './Keyboard';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
...ViewProps,
/**
@@ -51,11 +51,11 @@ type Props = $ReadOnly<{|
* may be non-zero in some cases. Defaults to 0.
*/
keyboardVerticalOffset?: number,
|}>;
}>;
type State = {|
type State = {
bottom: number,
|};
};
/**
* View that moves out of the way when the keyboard appears by automatically
@@ -34,11 +34,11 @@ import {useMemo, useRef, useState} from 'react';
type ViewStyleProp = $ElementType<React.ElementConfig<typeof View>, 'style'>;
export type StateCallbackType = $ReadOnly<{|
export type StateCallbackType = $ReadOnly<{
pressed: boolean,
|}>;
}>;
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
/**
* Accessibility.
*/
@@ -193,7 +193,7 @@ type Props = $ReadOnly<{|
* https://github.com/facebook/react-native/issues/34424
*/
'aria-label'?: ?string,
|}>;
}>;
type Instance = React.ElementRef<typeof View>;
@@ -19,19 +19,19 @@ import invariant from 'invariant';
import * as React from 'react';
import {useMemo} from 'react';
type NativeBackgroundProp = $ReadOnly<{|
type NativeBackgroundProp = $ReadOnly<{
type: 'RippleAndroid',
color: ?number,
borderless: boolean,
rippleRadius: ?number,
|}>;
}>;
export type RippleConfig = {|
export type RippleConfig = {
color?: ColorValue,
borderless?: boolean,
radius?: number,
foreground?: boolean,
|};
};
/**
* Provides the event handlers and props for configuring the ripple effect on
@@ -39,15 +39,15 @@ export type RippleConfig = {|
*/
export default function useAndroidRippleForView(
rippleConfig: ?RippleConfig,
viewRef: {|current: null | React.ElementRef<typeof View>|},
): ?$ReadOnly<{|
viewRef: {current: null | React.ElementRef<typeof View>},
): ?$ReadOnly<{
onPressIn: (event: PressEvent) => void,
onPressMove: (event: PressEvent) => void,
onPressOut: (event: PressEvent) => void,
viewProps:
| $ReadOnly<{|nativeBackgroundAndroid: NativeBackgroundProp|}>
| $ReadOnly<{|nativeForegroundAndroid: NativeBackgroundProp|}>,
|}> {
| $ReadOnly<{nativeBackgroundAndroid: NativeBackgroundProp}>
| $ReadOnly<{nativeForegroundAndroid: NativeBackgroundProp}>,
}> {
const {color, borderless, radius, foreground} = rippleConfig ?? {};
return useMemo(() => {
@@ -15,7 +15,7 @@ import ProgressBarAndroidNativeComponent from './ProgressBarAndroidNativeCompone
const React = require('react');
export type ProgressBarAndroidProps = $ReadOnly<{|
export type ProgressBarAndroidProps = $ReadOnly<{
...ViewProps,
/**
@@ -25,12 +25,12 @@ export type ProgressBarAndroidProps = $ReadOnly<{|
* `progress` value.
*/
...
| {|
| {
styleAttr: 'Horizontal',
indeterminate: false,
progress: number,
|}
| {|
}
| {
typeAttr:
| 'Horizontal'
| 'Normal'
@@ -40,7 +40,7 @@ export type ProgressBarAndroidProps = $ReadOnly<{|
| 'SmallInverse'
| 'LargeInverse',
indeterminate: true,
|},
},
/**
* Whether to show the ProgressBar (true, the default) or hide it (false).
*/
@@ -53,7 +53,7 @@ export type ProgressBarAndroidProps = $ReadOnly<{|
* Used to locate this view in end-to-end tests.
*/
testID?: ?string,
|}>;
}>;
/**
* React component that wraps the Android-only `ProgressBar`. This component is
@@ -21,7 +21,7 @@ import PullToRefreshViewNativeComponent, {
const Platform = require('../../Utilities/Platform');
const React = require('react');
type IOSProps = $ReadOnly<{|
type IOSProps = $ReadOnly<{
/**
* The color of the refresh indicator.
*/
@@ -34,9 +34,9 @@ type IOSProps = $ReadOnly<{|
* The title displayed under the refresh indicator.
*/
title?: ?string,
|}>;
}>;
type AndroidProps = $ReadOnly<{|
type AndroidProps = $ReadOnly<{
/**
* Whether the pull to refresh functionality is enabled.
*/
@@ -53,9 +53,9 @@ type AndroidProps = $ReadOnly<{|
* Size of the refresh indicator.
*/
size?: ?('default' | 'large'),
|}>;
}>;
export type RefreshControlProps = $ReadOnly<{|
export type RefreshControlProps = $ReadOnly<{
...ViewProps,
...IOSProps,
...AndroidProps,
@@ -74,7 +74,7 @@ export type RefreshControlProps = $ReadOnly<{|
* Progress view top offset
*/
progressViewOffset?: ?number,
|}>;
}>;
/**
* This component is used inside a ScrollView or ListView to add pull to refresh
@@ -127,7 +127,7 @@ import * as React from 'react';
*/
// Public methods for ScrollView
export type ScrollViewImperativeMethods = $ReadOnly<{|
export type ScrollViewImperativeMethods = $ReadOnly<{
getScrollResponder: $PropertyType<ScrollView, 'getScrollResponder'>,
getScrollableNode: $PropertyType<ScrollView, 'getScrollableNode'>,
getInnerViewNode: $PropertyType<ScrollView, 'getInnerViewNode'>,
@@ -141,19 +141,19 @@ export type ScrollViewImperativeMethods = $ReadOnly<{|
ScrollView,
'scrollResponderScrollNativeHandleToKeyboard',
>,
|}>;
}>;
export type DecelerationRateType = 'fast' | 'normal' | number;
export type ScrollResponderType = ScrollViewImperativeMethods;
type PublicScrollViewInstance = $ReadOnly<{|
type PublicScrollViewInstance = $ReadOnly<{
...HostInstance,
...ScrollViewImperativeMethods,
|}>;
}>;
type InnerViewInstance = React.ElementRef<View>;
type IOSProps = $ReadOnly<{|
type IOSProps = $ReadOnly<{
/**
* Controls whether iOS should automatically adjust the content inset
* for scroll views that are placed behind a navigation bar or
@@ -307,9 +307,9 @@ type IOSProps = $ReadOnly<{|
| 'never'
| 'always'
),
|}>;
}>;
type AndroidProps = $ReadOnly<{|
type AndroidProps = $ReadOnly<{
/**
* Enables nested scrolling for Android API level 21+.
* Nested scrolling is supported by default on iOS
@@ -364,14 +364,14 @@ type AndroidProps = $ReadOnly<{|
* @platform android
*/
fadingEdgeLength?: ?number,
|}>;
}>;
type StickyHeaderComponentType = component(
ref?: React.RefSetter<$ReadOnly<interface {setNextHeaderY: number => void}>>,
...ScrollViewStickyHeaderProps
);
export type Props = $ReadOnly<{|
export type Props = $ReadOnly<{
...ViewProps,
...IOSProps,
...AndroidProps,
@@ -494,10 +494,10 @@ export type Props = $ReadOnly<{|
* whether content is "visible" or not.
*
*/
maintainVisibleContentPosition?: ?$ReadOnly<{|
maintainVisibleContentPosition?: ?$ReadOnly<{
minIndexForVisible: number,
autoscrollToTopThreshold?: ?number,
|}>,
}>,
/**
* Called when the momentum scroll starts (scroll which occurs as the ScrollView glides to a stop).
*/
@@ -651,17 +651,17 @@ export type Props = $ReadOnly<{|
* measure, measureLayout, etc.
*/
scrollViewRef?: React.RefSetter<PublicScrollViewInstance>,
|}>;
}>;
type State = {|
type State = {
layoutHeight: ?number,
|};
};
const IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
export type ScrollViewComponentStatics = $ReadOnly<{|
export type ScrollViewComponentStatics = $ReadOnly<{
Context: typeof ScrollViewContext,
|}>;
}>;
/**
* Component that wraps platform ScrollView while providing
@@ -976,22 +976,22 @@ class ScrollView extends React.Component<Props, State> {
* @platform ios
*/
scrollResponderZoomTo: (
rect: {|
rect: {
x: number,
y: number,
width: number,
height: number,
animated?: boolean,
|},
},
animated?: boolean, // deprecated, put this inside the rect argument instead
) => void = (
rect: {|
rect: {
x: number,
y: number,
width: number,
height: number,
animated?: boolean,
|},
},
animated?: boolean, // deprecated, put this inside the rect argument instead
) => {
invariant(Platform.OS === 'ios', 'zoomToRect is not implemented');
@@ -31,13 +31,13 @@ interface NativeCommands {
) => void;
+zoomToRect: (
viewRef: React.ElementRef<ScrollViewNativeComponentType>,
rect: {|
rect: {
x: Double,
y: Double,
width: Double,
height: Double,
animated?: boolean,
|},
},
animated?: boolean,
) => void;
}
@@ -19,7 +19,7 @@ import * as React from 'react';
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
export type Props = $ReadOnly<{
children?: ExactReactElement_DEPRECATED<$FlowFixMe>,
children?: React.Node,
nextHeaderLayoutY: ?number,
onLayout: (event: LayoutEvent) => void,
scrollAnimatedValue: Animated.Value,
@@ -12,7 +12,7 @@
const React = require('react');
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
/**
* Indicates whether the render function needs to be called again
*/
@@ -22,7 +22,7 @@ type Props = $ReadOnly<{|
* A function that returns a renderable component
*/
render: () => React.Node,
|}>;
}>;
class StaticRenderer extends React.Component<Props> {
shouldComponentUpdate(nextProps: Props): boolean {
@@ -55,7 +55,7 @@ export type StatusBarAnimation = $Keys<{
...
}>;
type AndroidProps = $ReadOnly<{|
type AndroidProps = $ReadOnly<{
/**
* The background color of the status bar.
* @platform android
@@ -69,9 +69,9 @@ type AndroidProps = $ReadOnly<{|
* @platform android
*/
translucent?: ?boolean,
|}>;
}>;
type IOSProps = $ReadOnly<{|
type IOSProps = $ReadOnly<{
/**
* If the network activity indicator should be visible.
*
@@ -85,9 +85,9 @@ type IOSProps = $ReadOnly<{|
* @platform ios
*/
showHideTransition?: ?('fade' | 'slide' | 'none'),
|}>;
}>;
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
...AndroidProps,
...IOSProps,
/**
@@ -103,7 +103,25 @@ type Props = $ReadOnly<{|
* Sets the color of the status bar text.
*/
barStyle?: ?('default' | 'light-content' | 'dark-content'),
|}>;
}>;
type StackProps = {
backgroundColor: ?{
value: Props['backgroundColor'],
animated: boolean,
},
barStyle: ?{
value: Props['barStyle'],
animated: boolean,
},
translucent: Props['translucent'],
hidden: ?{
value: boolean,
animated: boolean,
transition: Props['showHideTransition'],
},
networkActivityIndicatorVisible: Props['networkActivityIndicatorVisible'],
};
/**
* Merges the prop stack with the default values.
@@ -129,7 +147,7 @@ function mergePropsStack(
* Returns an object to insert in the props stack from the props
* and the transition/animation info.
*/
function createStackEntry(props: any): any {
function createStackEntry(props: Props): StackProps {
const animated = props.animated ?? false;
const showHideTransition = props.showHideTransition ?? 'fade';
return {
@@ -203,7 +221,7 @@ function createStackEntry(props: any): any {
* `currentHeight` (Android only) The height of the status bar.
*/
class StatusBar extends React.Component<Props> {
static _propsStack: Array<any> = [];
static _propsStack: Array<StackProps> = [];
static _defaultProps: any = createStackEntry({
backgroundColor:
@@ -218,12 +236,10 @@ class StatusBar extends React.Component<Props> {
});
// Timer for updating the native module values at the end of the frame.
// $FlowFixMe[missing-local-annot]
static _updateImmediate = null;
static _updateImmediate: ?number = null;
// The current merged values from the props stack.
// $FlowFixMe[missing-local-annot]
static _currentValues = null;
static _currentValues: ?StackProps = null;
// TODO(janic): Provide a real API to deal with status bar height. See the
// discussion in #6195.
@@ -371,8 +387,7 @@ class StatusBar extends React.Component<Props> {
return newEntry;
}
// $FlowFixMe[missing-local-annot]
_stackEntry = null;
_stackEntry: ?StackProps = null;
componentDidMount() {
// Every time a StatusBar component is mounted, we push it's prop to a stack
@@ -412,14 +427,14 @@ class StatusBar extends React.Component<Props> {
if (Platform.OS === 'ios') {
if (
!oldProps ||
oldProps.barStyle.value !== mergedProps.barStyle.value
oldProps.barStyle?.value !== mergedProps.barStyle.value
) {
NativeStatusBarManagerIOS.setStyle(
mergedProps.barStyle.value,
mergedProps.barStyle.animated || false,
);
}
if (!oldProps || oldProps.hidden.value !== mergedProps.hidden.value) {
if (!oldProps || oldProps.hidden?.value !== mergedProps.hidden.value) {
NativeStatusBarManagerIOS.setHidden(
mergedProps.hidden.value,
mergedProps.hidden.animated
@@ -456,7 +471,7 @@ class StatusBar extends React.Component<Props> {
mergedProps.backgroundColor.animated,
);
}
if (!oldProps || oldProps.hidden.value !== mergedProps.hidden.value) {
if (!oldProps || oldProps.hidden?.value !== mergedProps.hidden.value) {
NativeStatusBarManagerAndroid.setHidden(mergedProps.hidden.value);
}
// Activities are not translucent by default, so always set if true.
@@ -24,13 +24,13 @@ import SwitchNativeComponent, {
import * as React from 'react';
type SwitchChangeEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
value: boolean,
target: number,
|}>,
}>,
>;
export type Props = $ReadOnly<{|
export type Props = $ReadOnly<{
...ViewProps,
/**
@@ -59,10 +59,10 @@ export type Props = $ReadOnly<{|
color of the background exposed by the shrunken track, use
[`ios_backgroundColor`](https://reactnative.dev/docs/switch#ios_backgroundColor).
*/
trackColor?: ?$ReadOnly<{|
trackColor?: ?$ReadOnly<{
false?: ?ColorValue,
true?: ?ColorValue,
|}>,
}>,
/**
On iOS, custom color for the background. This background color can be
@@ -84,7 +84,7 @@ export type Props = $ReadOnly<{|
use `onChange`.
*/
onValueChange?: ?(value: boolean) => Promise<void> | void,
|}>;
}>;
const returnsFalse = () => false;
const returnsTrue = () => true;
@@ -69,10 +69,10 @@ export type ReturnKeyType =
export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
export type NativeProps = $ReadOnly<{|
export type NativeProps = $ReadOnly<{
// This allows us to inherit everything from ViewProps except for style (see below)
// This must be commented for Fabric codegen to work.
...$Diff<ViewProps, $ReadOnly<{|style: ?ViewStyleProp|}>>,
...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
/**
* Android props after this
@@ -345,13 +345,13 @@ export type NativeProps = $ReadOnly<{|
* Callback that is called when the text input is blurred.
* `target` is the reactTag of the element
*/
onBlur?: ?BubblingEventHandler<$ReadOnly<{|target: Int32|}>>,
onBlur?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>,
/**
* Callback that is called when the text input is focused.
* `target` is the reactTag of the element
*/
onFocus?: ?BubblingEventHandler<$ReadOnly<{|target: Int32|}>>,
onFocus?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>,
/**
* Callback that is called when the text input's text changes.
@@ -359,7 +359,7 @@ export type NativeProps = $ReadOnly<{|
* TODO: differentiate between onChange and onChangeText
*/
onChange?: ?BubblingEventHandler<
$ReadOnly<{|target: Int32, eventCount: Int32, text: string|}>,
$ReadOnly<{target: Int32, eventCount: Int32, text: string}>,
>,
/**
@@ -368,7 +368,7 @@ export type NativeProps = $ReadOnly<{|
* TODO: differentiate between onChange and onChangeText
*/
onChangeText?: ?BubblingEventHandler<
$ReadOnly<{|target: Int32, eventCount: Int32, text: string|}>,
$ReadOnly<{target: Int32, eventCount: Int32, text: string}>,
>,
/**
@@ -379,17 +379,17 @@ export type NativeProps = $ReadOnly<{|
* Only called for multiline text inputs.
*/
onContentSizeChange?: ?DirectEventHandler<
$ReadOnly<{|
$ReadOnly<{
target: Int32,
contentSize: $ReadOnly<{|width: Double, height: Double|}>,
|}>,
contentSize: $ReadOnly<{width: Double, height: Double}>,
}>,
>,
/**
* Callback that is called when text input ends.
*/
onEndEditing?: ?BubblingEventHandler<
$ReadOnly<{|target: Int32, text: string|}>,
$ReadOnly<{target: Int32, text: string}>,
>,
/**
@@ -398,10 +398,10 @@ export type NativeProps = $ReadOnly<{|
* `{ nativeEvent: { selection: { start, end } } }`.
*/
onSelectionChange?: ?DirectEventHandler<
$ReadOnly<{|
$ReadOnly<{
target: Int32,
selection: $ReadOnly<{|start: Double, end: Double|}>,
|}>,
selection: $ReadOnly<{start: Double, end: Double}>,
}>,
>,
/**
@@ -409,7 +409,7 @@ export type NativeProps = $ReadOnly<{|
* Invalid if `multiline={true}` is specified.
*/
onSubmitEditing?: ?BubblingEventHandler<
$ReadOnly<{|target: Int32, text: string|}>,
$ReadOnly<{target: Int32, text: string}>,
>,
/**
@@ -419,7 +419,7 @@ export type NativeProps = $ReadOnly<{|
* the typed-in character otherwise including `' '` for space.
* Fires before `onChange` callbacks.
*/
onKeyPress?: ?BubblingEventHandler<$ReadOnly<{|target: Int32, key: string|}>>,
onKeyPress?: ?BubblingEventHandler<$ReadOnly<{target: Int32, key: string}>>,
/**
* Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
@@ -427,32 +427,32 @@ export type NativeProps = $ReadOnly<{|
* is not provided for performance reasons.
*/
onScroll?: ?DirectEventHandler<
$ReadOnly<{|
$ReadOnly<{
target: Int32,
responderIgnoreScroll: boolean,
contentInset: $ReadOnly<{|
contentInset: $ReadOnly<{
top: Double, // always 0 on Android
bottom: Double, // always 0 on Android
left: Double, // always 0 on Android
right: Double, // always 0 on Android
|}>,
contentOffset: $ReadOnly<{|
}>,
contentOffset: $ReadOnly<{
x: Double,
y: Double,
|}>,
contentSize: $ReadOnly<{|
}>,
contentSize: $ReadOnly<{
width: Double, // always 0 on Android
height: Double, // always 0 on Android
|}>,
layoutMeasurement: $ReadOnly<{|
}>,
layoutMeasurement: $ReadOnly<{
width: Double,
height: Double,
|}>,
velocity: $ReadOnly<{|
}>,
velocity: $ReadOnly<{
x: Double, // always 0 on Android
y: Double, // always 0 on Android
|}>,
|}>,
}>,
}>,
>,
/**
@@ -485,10 +485,10 @@ export type NativeProps = $ReadOnly<{|
* The start and end of the text input's selection. Set start and end to
* the same value to position the cursor.
*/
selection?: ?$ReadOnly<{|
selection?: ?$ReadOnly<{
start: Int32,
end?: ?Int32,
|}>,
}>,
/**
* The value to show for the text input. `TextInput` is a controlled
@@ -588,7 +588,7 @@ export type NativeProps = $ReadOnly<{|
textShadowRadius?: ?Float,
textDecorationLine?: ?string,
fontStyle?: ?string,
textShadowOffset?: ?$ReadOnly<{|width?: ?Double, height?: ?Double|}>,
textShadowOffset?: ?$ReadOnly<{width?: ?Double, height?: ?Double}>,
lineHeight?: ?Float,
textTransform?: ?string,
color?: ?Int32,
@@ -610,7 +610,7 @@ export type NativeProps = $ReadOnly<{|
*/
mostRecentEventCount: Int32,
text?: ?string,
|}>;
}>;
type NativeType = HostComponent<NativeProps>;
@@ -76,7 +76,7 @@ import * as React from 'react';
* For an example, look at InputAccessoryViewExample.js in RNTester.
*/
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
+children: React.Node,
/**
* An ID which is used to associate this `InputAccessoryView` to
@@ -85,7 +85,7 @@ type Props = $ReadOnly<{|
nativeID?: ?string,
style?: ?ViewStyleProp,
backgroundColor?: ?ColorValue,
|}>;
}>;
const InputAccessoryView: React.ComponentType<Props> = (props: Props) => {
const {width} = useWindowDimensions();
@@ -26,71 +26,71 @@ import * as React from 'react';
type ReactRefSetter<T> = {current: null | T, ...} | ((ref: null | T) => mixed);
export type ChangeEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
eventCount: number,
target: number,
text: string,
|}>,
}>,
>;
export type TextInputEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
eventCount: number,
previousText: string,
range: $ReadOnly<{|
range: $ReadOnly<{
start: number,
end: number,
|}>,
}>,
target: number,
text: string,
|}>,
}>,
>;
export type ContentSizeChangeEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
target: number,
contentSize: $ReadOnly<{|
contentSize: $ReadOnly<{
width: number,
height: number,
|}>,
|}>,
}>,
}>,
>;
type TargetEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
target: number,
|}>,
}>,
>;
export type BlurEvent = TargetEvent;
export type FocusEvent = TargetEvent;
type Selection = $ReadOnly<{|
type Selection = $ReadOnly<{
start: number,
end: number,
|}>;
}>;
export type SelectionChangeEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
selection: Selection,
target: number,
|}>,
}>,
>;
export type KeyPressEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
key: string,
target?: ?number,
eventCount?: ?number,
|}>,
}>,
>;
export type EditingEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
eventCount: number,
text: string,
target: number,
|}>,
}>,
>;
type DataDetectorTypesType =
@@ -215,7 +215,7 @@ export type enterKeyHintType =
type PasswordRules = string;
type IOSProps = $ReadOnly<{|
type IOSProps = $ReadOnly<{
/**
* If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false.
* @platform ios
@@ -350,9 +350,9 @@ type IOSProps = $ReadOnly<{|
* @platform ios
*/
smartInsertDelete?: ?boolean,
|}>;
}>;
type AndroidProps = $ReadOnly<{|
type AndroidProps = $ReadOnly<{
/**
* When provided it will set the color of the cursor (or "caret") in the component.
* Unlike the behavior of `selectionColor` the cursor color will be set independently
@@ -444,10 +444,10 @@ type AndroidProps = $ReadOnly<{|
* @platform android
*/
underlineColorAndroid?: ?ColorValue,
|}>;
}>;
export type Props = $ReadOnly<{|
...$Diff<ViewProps, $ReadOnly<{|style: ?ViewStyleProp|}>>,
export type Props = $ReadOnly<{
...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
...IOSProps,
...AndroidProps,
@@ -900,10 +900,10 @@ export type Props = $ReadOnly<{|
* The start and end of the text input's selection. Set start and end to
* the same value to position the cursor.
*/
selection?: ?$ReadOnly<{|
selection?: ?$ReadOnly<{
start: number,
end?: ?number,
|}>,
}>,
/**
* The highlight and cursor color of the text input.
@@ -978,14 +978,14 @@ export type Props = $ReadOnly<{|
* unwanted edits without flicker.
*/
value?: ?Stringish,
|}>;
}>;
type ImperativeMethods = $ReadOnly<{|
type ImperativeMethods = $ReadOnly<{
clear: () => void,
isFocused: () => boolean,
getNativeRef: () => ?HostInstance,
setSelection: (start: number, end: number) => void,
|}>;
}>;
/**
* A foundational component for inputting text into the app via a
@@ -1103,13 +1103,13 @@ type InternalTextInput = component(
...Props
);
export type TextInputComponentStatics = $ReadOnly<{|
State: $ReadOnly<{|
export type TextInputComponentStatics = $ReadOnly<{
State: $ReadOnly<{
currentlyFocusedInput: () => ?HostInstance,
currentlyFocusedField: () => ?number,
focusTextInput: (textField: ?HostInstance) => void,
blurTextInput: (textField: ?HostInstance) => void,
|}>,
|}>;
}>,
}>;
export type TextInputType = InternalTextInput & TextInputComponentStatics;
@@ -67,71 +67,71 @@ if (Platform.OS === 'android') {
}
export type ChangeEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
eventCount: number,
target: number,
text: string,
|}>,
}>,
>;
export type TextInputEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
eventCount: number,
previousText: string,
range: $ReadOnly<{|
range: $ReadOnly<{
start: number,
end: number,
|}>,
}>,
target: number,
text: string,
|}>,
}>,
>;
export type ContentSizeChangeEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
target: number,
contentSize: $ReadOnly<{|
contentSize: $ReadOnly<{
width: number,
height: number,
|}>,
|}>,
}>,
}>,
>;
type TargetEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
target: number,
|}>,
}>,
>;
export type BlurEvent = TargetEvent;
export type FocusEvent = TargetEvent;
type Selection = $ReadOnly<{|
type Selection = $ReadOnly<{
start: number,
end: number,
|}>;
}>;
export type SelectionChangeEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
selection: Selection,
target: number,
|}>,
}>,
>;
export type KeyPressEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
key: string,
target?: ?number,
eventCount?: ?number,
|}>,
}>,
>;
export type EditingEvent = SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
eventCount: number,
text: string,
target: number,
|}>,
}>,
>;
type DataDetectorTypesType =
@@ -259,7 +259,7 @@ export type enterKeyHintType =
type PasswordRules = string;
type IOSProps = $ReadOnly<{|
type IOSProps = $ReadOnly<{
/**
* If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false.
* @platform ios
@@ -397,9 +397,9 @@ type IOSProps = $ReadOnly<{|
* @platform ios
*/
smartInsertDelete?: ?boolean,
|}>;
}>;
type AndroidProps = $ReadOnly<{|
type AndroidProps = $ReadOnly<{
/**
* When provided it will set the color of the cursor (or "caret") in the component.
* Unlike the behavior of `selectionColor` the cursor color will be set independently
@@ -483,10 +483,10 @@ type AndroidProps = $ReadOnly<{|
* @platform android
*/
underlineColorAndroid?: ?ColorValue,
|}>;
}>;
export type Props = $ReadOnly<{|
...$Diff<ViewProps, $ReadOnly<{|style: ?ViewStyleProp|}>>,
export type Props = $ReadOnly<{
...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
...IOSProps,
...AndroidProps,
@@ -903,10 +903,10 @@ export type Props = $ReadOnly<{|
* The start and end of the text input's selection. Set start and end to
* the same value to position the cursor.
*/
selection?: ?$ReadOnly<{|
selection?: ?$ReadOnly<{
start: number,
end?: ?number,
|}>,
}>,
/**
* The highlight and cursor color of the text input.
@@ -987,7 +987,7 @@ export type Props = $ReadOnly<{|
* unwanted edits without flicker.
*/
value?: ?Stringish,
|}>;
}>;
type ViewCommands = $NonMaybeType<
| typeof AndroidTextInputCommands
@@ -995,10 +995,10 @@ type ViewCommands = $NonMaybeType<
| typeof RCTSinglelineTextInputNativeCommands,
>;
type LastNativeSelection = {|
type LastNativeSelection = {
selection: Selection,
mostRecentEventCount: number,
|};
};
const emptyFunctionThatReturnsTrue = () => true;
@@ -1874,14 +1874,14 @@ ExportedForwardRef.State = {
blurTextInput: TextInputState.blurTextInput,
};
export type TextInputComponentStatics = $ReadOnly<{|
State: $ReadOnly<{|
export type TextInputComponentStatics = $ReadOnly<{
State: $ReadOnly<{
currentlyFocusedInput: typeof TextInputState.currentlyFocusedInput,
currentlyFocusedField: typeof TextInputState.currentlyFocusedField,
focusTextInput: typeof TextInputState.focusTextInput,
blurTextInput: typeof TextInputState.blurTextInput,
|}>,
|}>;
}>,
}>;
const styles = StyleSheet.create({
multilineDefault: {
@@ -24,6 +24,6 @@ export interface TextInputNativeCommands<T> {
) => void;
}
const supportedCommands = ['focus', 'blur', 'setTextAndSelection'];
const supportedCommands = ['focus', 'blur', 'setTextAndSelection'] as string[];
export default supportedCommands;
@@ -19,7 +19,7 @@ import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
import Platform from '../../Utilities/Platform';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
...React.ElementConfig<TouchableWithoutFeedback>,
onPressAnimationComplete?: ?() => void,
@@ -29,12 +29,12 @@ type Props = $ReadOnly<{|
style?: ?ViewStyleProp,
hostRef: React.RefSetter<React.ElementRef<typeof Animated.View>>,
|}>;
}>;
type State = $ReadOnly<{|
type State = $ReadOnly<{
pressability: Pressability,
scale: Animated.Value,
|}>;
}>;
class TouchableBounce extends React.Component<Props, State> {
state: State = {
@@ -218,5 +218,5 @@ module.exports = (React.forwardRef((props, hostRef) => (
<TouchableBounce {...props} hostRef={hostRef} />
)): component(
ref: React.RefSetter<mixed>,
...props: $ReadOnly<$Diff<Props, {|hostRef: mixed|}>>
...props: $ReadOnly<$Diff<Props, {hostRef: mixed}>>
));
@@ -20,19 +20,19 @@ import StyleSheet, {type ViewStyleProp} from '../../StyleSheet/StyleSheet';
import Platform from '../../Utilities/Platform';
import * as React from 'react';
type AndroidProps = $ReadOnly<{|
type AndroidProps = $ReadOnly<{
nextFocusDown?: ?number,
nextFocusForward?: ?number,
nextFocusLeft?: ?number,
nextFocusRight?: ?number,
nextFocusUp?: ?number,
|}>;
}>;
type IOSProps = $ReadOnly<{|
type IOSProps = $ReadOnly<{
hasTVPreferredFocus?: ?boolean,
|}>;
}>;
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
...React.ElementConfig<TouchableWithoutFeedback>,
...AndroidProps,
...IOSProps,
@@ -45,17 +45,17 @@ type Props = $ReadOnly<{|
testOnly_pressed?: ?boolean,
hostRef: React.RefSetter<React.ElementRef<typeof View>>,
|}>;
}>;
type ExtraStyles = $ReadOnly<{|
type ExtraStyles = $ReadOnly<{
child: ViewStyleProp,
underlay: ViewStyleProp,
|}>;
}>;
type State = $ReadOnly<{|
type State = $ReadOnly<{
pressability: Pressability,
extraStyles: ?ExtraStyles,
|}>;
}>;
/**
* A wrapper for making views respond properly to touches.
@@ -383,7 +383,7 @@ class TouchableHighlight extends React.Component<Props, State> {
const Touchable: component(
ref: React.RefSetter<React.ElementRef<typeof View>>,
...props: $ReadOnly<$Diff<Props, {|+hostRef: mixed|}>>
...props: $ReadOnly<$Diff<Props, {+hostRef: mixed}>>
) = React.forwardRef((props, hostRef) => (
<TouchableHighlight {...props} hostRef={hostRef} />
));
@@ -23,7 +23,7 @@ import {Commands} from '../View/ViewNativeComponent';
import invariant from 'invariant';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
...React.ElementConfig<TouchableWithoutFeedback>,
/**
@@ -33,19 +33,19 @@ type Props = $ReadOnly<{|
* methods to generate that dictionary.
*/
background?: ?(
| $ReadOnly<{|
| $ReadOnly<{
type: 'ThemeAttrAndroid',
attribute:
| 'selectableItemBackground'
| 'selectableItemBackgroundBorderless',
rippleRadius: ?number,
|}>
| $ReadOnly<{|
}>
| $ReadOnly<{
type: 'RippleAndroid',
color: ?number,
borderless: boolean,
rippleRadius: ?number,
|}>
}>
),
/**
@@ -89,22 +89,22 @@ type Props = $ReadOnly<{|
* versions, this will fallback to background.
*/
useForeground?: ?boolean,
|}>;
}>;
type State = $ReadOnly<{|
type State = $ReadOnly<{
pressability: Pressability,
|}>;
}>;
class TouchableNativeFeedback extends React.Component<Props, State> {
/**
* Creates a value for the `background` prop that uses the Android theme's
* default background for selectable elements.
*/
static SelectableBackground: (rippleRadius: ?number) => $ReadOnly<{|
static SelectableBackground: (rippleRadius: ?number) => $ReadOnly<{
attribute: 'selectableItemBackground',
type: 'ThemeAttrAndroid',
rippleRadius: ?number,
|}> = (rippleRadius: ?number) => ({
}> = (rippleRadius: ?number) => ({
type: 'ThemeAttrAndroid',
attribute: 'selectableItemBackground',
rippleRadius,
@@ -114,11 +114,11 @@ class TouchableNativeFeedback extends React.Component<Props, State> {
* Creates a value for the `background` prop that uses the Android theme's
* default background for borderless selectable elements. Requires API 21+.
*/
static SelectableBackgroundBorderless: (rippleRadius: ?number) => $ReadOnly<{|
static SelectableBackgroundBorderless: (rippleRadius: ?number) => $ReadOnly<{
attribute: 'selectableItemBackgroundBorderless',
type: 'ThemeAttrAndroid',
rippleRadius: ?number,
|}> = (rippleRadius: ?number) => ({
}> = (rippleRadius: ?number) => ({
type: 'ThemeAttrAndroid',
attribute: 'selectableItemBackgroundBorderless',
rippleRadius,
@@ -133,12 +133,12 @@ class TouchableNativeFeedback extends React.Component<Props, State> {
color: string,
borderless: boolean,
rippleRadius: ?number,
) => $ReadOnly<{|
) => $ReadOnly<{
borderless: boolean,
color: ?number,
rippleRadius: ?number,
type: 'RippleAndroid',
|}> = (color: string, borderless: boolean, rippleRadius: ?number) => {
}> = (color: string, borderless: boolean, rippleRadius: ?number) => {
const processedColor = processColor(color);
invariant(
processedColor == null || typeof processedColor === 'number',
@@ -21,16 +21,16 @@ import flattenStyle from '../../StyleSheet/flattenStyle';
import Platform from '../../Utilities/Platform';
import * as React from 'react';
type TVProps = $ReadOnly<{|
type TVProps = $ReadOnly<{
hasTVPreferredFocus?: ?boolean,
nextFocusDown?: ?number,
nextFocusForward?: ?number,
nextFocusLeft?: ?number,
nextFocusRight?: ?number,
nextFocusUp?: ?number,
|}>;
}>;
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
...React.ElementConfig<TouchableWithoutFeedback>,
...TVProps,
@@ -38,12 +38,12 @@ type Props = $ReadOnly<{|
style?: ?ViewStyleProp,
hostRef?: ?React.RefSetter<React.ElementRef<typeof Animated.View>>,
|}>;
}>;
type State = $ReadOnly<{|
type State = $ReadOnly<{
anim: Animated.Value,
pressability: Pressability,
|}>;
}>;
/**
* A wrapper for making views respond properly to touches.
@@ -29,7 +29,7 @@ import usePressability from '../../Pressability/usePressability';
import * as React from 'react';
import {useMemo} from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
accessibilityElementsHidden?: ?boolean,
accessibilityHint?: ?Stringish,
@@ -82,7 +82,7 @@ type Props = $ReadOnly<{|
rejectResponderTermination?: ?boolean,
testID?: ?string,
touchSoundDisabled?: ?boolean,
|}>;
}>;
const PASSTHROUGH_PROPS = [
'accessibilityActions',
@@ -144,7 +144,7 @@ export type AccessibilityState = {
...
};
export type AccessibilityValue = $ReadOnly<{|
export type AccessibilityValue = $ReadOnly<{
/**
* The minimum value of this component's range. (should be an integer)
*/
@@ -164,4 +164,4 @@ export type AccessibilityValue = $ReadOnly<{|
* A textual description of this component's value. (will override minimum, current, and maximum if set)
*/
text?: Stringish,
|}>;
}>;
@@ -34,7 +34,7 @@ import type {Node} from 'react';
export type ViewLayout = Layout;
export type ViewLayoutEvent = LayoutEvent;
type DirectEventProps = $ReadOnly<{|
type DirectEventProps = $ReadOnly<{
/**
* When `accessible` is true, the system will try to invoke this function
* when the user performs an accessibility custom action.
@@ -78,15 +78,15 @@ type DirectEventProps = $ReadOnly<{|
* See https://reactnative.dev/docs/view#onaccessibilityescape
*/
onAccessibilityEscape?: ?() => mixed,
|}>;
}>;
type MouseEventProps = $ReadOnly<{|
type MouseEventProps = $ReadOnly<{
onMouseEnter?: ?(event: MouseEvent) => void,
onMouseLeave?: ?(event: MouseEvent) => void,
|}>;
}>;
// Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use)
type PointerEventProps = $ReadOnly<{|
type PointerEventProps = $ReadOnly<{
onClick?: ?(event: PointerEvent) => void,
onClickCapture?: ?(event: PointerEvent) => void,
onPointerEnter?: ?(event: PointerEvent) => void,
@@ -109,16 +109,16 @@ type PointerEventProps = $ReadOnly<{|
onGotPointerCaptureCapture?: ?(e: PointerEvent) => void,
onLostPointerCapture?: ?(e: PointerEvent) => void,
onLostPointerCaptureCapture?: ?(e: PointerEvent) => void,
|}>;
}>;
type FocusEventProps = $ReadOnly<{|
type FocusEventProps = $ReadOnly<{
onBlur?: ?(event: BlurEvent) => void,
onBlurCapture?: ?(event: BlurEvent) => void,
onFocus?: ?(event: FocusEvent) => void,
onFocusCapture?: ?(event: FocusEvent) => void,
|}>;
}>;
type TouchEventProps = $ReadOnly<{|
type TouchEventProps = $ReadOnly<{
onTouchCancel?: ?(e: PressEvent) => void,
onTouchCancelCapture?: ?(e: PressEvent) => void,
onTouchEnd?: ?(e: PressEvent) => void,
@@ -127,14 +127,14 @@ type TouchEventProps = $ReadOnly<{|
onTouchMoveCapture?: ?(e: PressEvent) => void,
onTouchStart?: ?(e: PressEvent) => void,
onTouchStartCapture?: ?(e: PressEvent) => void,
|}>;
}>;
/**
* For most touch interactions, you'll simply want to wrap your component in
* `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`,
* `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion.
*/
type GestureResponderEventProps = $ReadOnly<{|
type GestureResponderEventProps = $ReadOnly<{
/**
* Does this view want to "claim" touch responsiveness? This is called for
* every touch move on the `View` when it is not the responder.
@@ -249,23 +249,23 @@ type GestureResponderEventProps = $ReadOnly<{|
* See https://reactnative.dev/docs/view#onstartshouldsetrespondercapture
*/
onStartShouldSetResponderCapture?: ?(e: PressEvent) => boolean,
|}>;
}>;
type AndroidDrawableThemeAttr = $ReadOnly<{|
type AndroidDrawableThemeAttr = $ReadOnly<{
type: 'ThemeAttrAndroid',
attribute: string,
|}>;
}>;
type AndroidDrawableRipple = $ReadOnly<{|
type AndroidDrawableRipple = $ReadOnly<{
type: 'RippleAndroid',
color?: ?number,
borderless?: ?boolean,
rippleRadius?: ?number,
|}>;
}>;
type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple;
type AndroidViewProps = $ReadOnly<{|
type AndroidViewProps = $ReadOnly<{
/**
* Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props,
* the text is read aloud. The value should should match the nativeID of the related element.
@@ -394,9 +394,9 @@ type AndroidViewProps = $ReadOnly<{|
* @platform android
*/
onClick?: ?(event: PressEvent) => mixed,
|}>;
}>;
type IOSViewProps = $ReadOnly<{|
type IOSViewProps = $ReadOnly<{
/**
* Prevents view from being inverted if set to true and color inversion is turned on.
*
@@ -465,9 +465,9 @@ type IOSViewProps = $ReadOnly<{|
* See https://reactnative.dev/docs/view#shouldrasterizeios
*/
shouldRasterizeIOS?: ?boolean,
|}>;
}>;
export type ViewProps = $ReadOnly<{|
export type ViewProps = $ReadOnly<{
...DirectEventProps,
...GestureResponderEventProps,
...MouseEventProps,
@@ -644,4 +644,4 @@ export type ViewProps = $ReadOnly<{|
* See https://reactnative.dev/docs/view#removeclippedsubviews
*/
removeClippedSubviews?: ?boolean,
|}>;
}>;
+2 -2
View File
@@ -12,13 +12,13 @@ import type {IEventEmitter} from '../vendor/emitter/EventEmitter';
import EventEmitter from '../vendor/emitter/EventEmitter';
export type RawEventEmitterEvent = $ReadOnly<{|
export type RawEventEmitterEvent = $ReadOnly<{
eventName: string,
// We expect, but do not/cannot require, that nativeEvent is an object
// with the properties: key, elementType (string), type (string), tag (numeric),
// and a stateNode of the native element/Fiber the event was emitted to.
nativeEvent: {[string]: mixed},
|}>;
}>;
type RawEventDefinitions = {
[eventChannel: string]: [RawEventEmitterEvent],
+2 -2
View File
@@ -452,7 +452,7 @@ function setSendIdleEvents(sendIdleEvents: boolean): void {
NativeTiming.setSendIdleEvents(sendIdleEvents);
}
let ExportedJSTimers: {|
let ExportedJSTimers: {
callIdleCallbacks: (frameTime: number) => any | void,
callReactNativeMicrotasks: () => void,
callTimers: (timersToCall: Array<number>) => any | void,
@@ -467,7 +467,7 @@ let ExportedJSTimers: {|
queueReactNativeMicrotask: (func: any, ...args: any) => number,
setInterval: (func: any, duration: number, ...args: any) => number,
setTimeout: (func: any, duration: number, ...args: any) => number,
|};
};
if (!NativeTiming) {
console.warn("Timing native module is not available, can't set timers.");
+2 -2
View File
@@ -11,12 +11,12 @@
// Make sure global Event is defined
import EventPolyfill from './EventPolyfill';
type CustomEvent$Options = $ReadOnly<{|
type CustomEvent$Options = $ReadOnly<{
bubbles?: boolean,
cancelable?: boolean,
composed?: boolean,
detail?: {...},
|}>;
}>;
class CustomEvent extends EventPolyfill {
detail: ?{...};
@@ -10,13 +10,13 @@
'use strict';
export type ResolvedAssetSource = {|
export type ResolvedAssetSource = {
+__packager_asset: boolean,
+width: ?number,
+height: ?number,
+uri: string,
+scale: number,
|};
};
import type {
AssetDestPathResolver,
+17 -17
View File
@@ -24,16 +24,16 @@ import type {ImageSource} from './ImageSource';
import type {ElementRef, Node, RefSetter} from 'react';
export type ImageLoadEvent = SyntheticEvent<
$ReadOnly<{|
source: $ReadOnly<{|
$ReadOnly<{
source: $ReadOnly<{
width: number,
height: number,
uri: string,
|}>,
|}>,
}>,
}>,
>;
type IOSImageProps = $ReadOnly<{|
type IOSImageProps = $ReadOnly<{
/**
* A static image to display while loading the image source.
*
@@ -52,12 +52,12 @@ type IOSImageProps = $ReadOnly<{|
* See https://reactnative.dev/docs/image#onprogress
*/
onProgress?: ?(
event: SyntheticEvent<$ReadOnly<{|loaded: number, total: number|}>>,
event: SyntheticEvent<$ReadOnly<{loaded: number, total: number}>>,
) => void,
|}>;
}>;
type AndroidImageProps = $ReadOnly<{|
loadingIndicatorSource?: ?(number | $ReadOnly<{|uri: string|}>),
type AndroidImageProps = $ReadOnly<{
loadingIndicatorSource?: ?(number | $ReadOnly<{uri: string}>),
progressiveRenderingEnabled?: ?boolean,
fadeDuration?: ?number,
@@ -76,10 +76,10 @@ type AndroidImageProps = $ReadOnly<{|
* Defaults to 1.0.
*/
resizeMultiplier?: ?number,
|}>;
}>;
export type ImageProps = $ReadOnly<{|
...$Diff<ViewProps, $ReadOnly<{|style: ?ViewStyleProp|}>>,
export type ImageProps = $ReadOnly<{
...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
...IOSImageProps,
...AndroidImageProps,
@@ -164,9 +164,9 @@ export type ImageProps = $ReadOnly<{|
*/
onError?: ?(
event: SyntheticEvent<
$ReadOnly<{|
$ReadOnly<{
error: string,
|}>,
}>,
>,
) => void,
@@ -267,9 +267,9 @@ export type ImageProps = $ReadOnly<{|
*/
srcSet?: ?string,
children?: empty,
|}>;
}>;
export type ImageBackgroundProps = $ReadOnly<{|
export type ImageBackgroundProps = $ReadOnly<{
...ImageProps,
children?: Node,
@@ -293,4 +293,4 @@ export type ImageBackgroundProps = $ReadOnly<{|
* See https://reactnative.dev/docs/imagebackground#imageref
*/
imageRef?: RefSetter<ElementRef<Image>>,
|}>;
}>;
+2 -2
View File
@@ -12,7 +12,7 @@ import type {ImageURISource} from './ImageSource';
import Platform from '../Utilities/Platform';
type NativeImageSourceSpec = $ReadOnly<{|
type NativeImageSourceSpec = $ReadOnly<{
android?: string,
ios?: string,
default?: string,
@@ -21,7 +21,7 @@ type NativeImageSourceSpec = $ReadOnly<{|
// https://reactnative.dev/docs/images#why-not-automatically-size-everything
height: number,
width: number,
|}>;
}>;
/**
* In hybrid apps, use `nativeImageSource` to access images that are already
@@ -13,6 +13,8 @@
import type {InspectorData} from '../Renderer/shims/ReactNativeTypes';
import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
import React from 'react';
const TouchableHighlight = require('../Components/Touchable/TouchableHighlight');
const TouchableWithoutFeedback = require('../Components/Touchable/TouchableWithoutFeedback');
const View = require('../Components/View/View');
@@ -22,15 +24,14 @@ const Text = require('../Text/Text');
const mapWithSeparator = require('../Utilities/mapWithSeparator');
const BoxInspector = require('./BoxInspector');
const StyleInspector = require('./StyleInspector');
const React = require('react');
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
hierarchy: ?InspectorData['hierarchy'],
style?: ?ViewStyleProp,
frame?: ?Object,
selection?: ?number,
setSelection?: number => mixed,
|}>;
}>;
class ElementProperties extends React.Component<Props> {
render(): React.Node {
+1 -1
View File
@@ -19,6 +19,7 @@ import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
import type {ReactDevToolsAgent} from '../Types/ReactDevToolsTypes';
import SafeAreaView from '../../src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE';
import React from 'react';
const View = require('../Components/View/View');
const PressabilityDebug = require('../Pressability/PressabilityDebug');
@@ -29,7 +30,6 @@ const Platform = require('../Utilities/Platform');
const getInspectorDataForViewAtPoint = require('./getInspectorDataForViewAtPoint');
const InspectorOverlay = require('./InspectorOverlay');
const InspectorPanel = require('./InspectorPanel');
const React = require('react');
const {useState} = React;
@@ -13,15 +13,16 @@
import type {PressEvent} from '../Types/CoreEventTypes';
import type {InspectedElement} from './Inspector';
import React from 'react';
const View = require('../Components/View/View');
const StyleSheet = require('../StyleSheet/StyleSheet');
const ElementBox = require('./ElementBox');
const React = require('react');
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
inspected?: ?InspectedElement,
onTouchPoint: (locationX: number, locationY: number) => void,
|}>;
}>;
function InspectorOverlay({inspected, onTouchPoint}: Props): React.Node {
const findViewForTouchEvent = (e: PressEvent) => {
@@ -13,6 +13,7 @@
import type {ElementsHierarchy, InspectedElement} from './Inspector';
import SafeAreaView from '../Components/SafeAreaView/SafeAreaView';
import React from 'react';
const ScrollView = require('../Components/ScrollView/ScrollView');
const TouchableHighlight = require('../Components/Touchable/TouchableHighlight');
@@ -22,9 +23,8 @@ const Text = require('../Text/Text');
const ElementProperties = require('./ElementProperties');
const NetworkOverlay = require('./NetworkOverlay');
const PerformanceOverlay = require('./PerformanceOverlay');
const React = require('react');
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
devtoolsIsOpen: boolean,
inspecting: boolean,
setInspecting: (val: boolean) => void,
@@ -38,7 +38,7 @@ type Props = $ReadOnly<{|
selection?: ?number,
setSelection: number => mixed,
inspected?: ?InspectedElement,
|}>;
}>;
class InspectorPanel extends React.Component<Props> {
renderWaiting(): React.Node {
@@ -107,11 +107,11 @@ class InspectorPanel extends React.Component<Props> {
}
}
type InspectorPanelButtonProps = $ReadOnly<{|
type InspectorPanelButtonProps = $ReadOnly<{
onClick: (val: boolean) => void,
pressed: boolean,
title: string,
|}>;
}>;
class InspectorPanelButton extends React.Component<InspectorPanelButtonProps> {
render(): React.Node {
@@ -49,11 +49,11 @@ type NetworkRequestInfo = {
...
};
type Props = $ReadOnly<{||}>;
type State = {|
type Props = $ReadOnly<{}>;
type State = {
detailRowId: ?number,
requests: Array<NetworkRequestInfo>,
|};
};
function getStringByValue(value: any): string {
if (value === undefined) {
@@ -10,11 +10,12 @@
'use strict';
import React from 'react';
const View = require('../Components/View/View');
const StyleSheet = require('../StyleSheet/StyleSheet');
const Text = require('../Text/Text');
const PerformanceLogger = require('../Utilities/GlobalPerformanceLogger');
const React = require('react');
class PerformanceOverlay extends React.Component<{...}> {
render(): React.Node {
@@ -25,12 +25,12 @@ const I18nManager = require('../ReactNative/I18nManager');
function resolveBoxStyle(
prefix: string,
style: Object,
): ?$ReadOnly<{|
): ?$ReadOnly<{
bottom: number,
left: number,
right: number,
top: number,
|}> {
}> {
let hasParts = false;
const result = {
bottom: 0,
@@ -124,7 +124,7 @@ const currentCentroidY = TouchHistoryMath.currentCentroidY;
* [PanResponder example in RNTester](https://github.com/facebook/react-native/blob/HEAD/packages/rn-tester/js/examples/PanResponder/PanResponderExample.js)
*/
export type GestureState = {|
export type GestureState = {
/**
* ID of the gestureState - persisted as long as there at least one touch on screen
*/
@@ -181,7 +181,7 @@ export type GestureState = {|
* @private
*/
_accountsForMovesUpTo: number,
|};
};
type ActiveCallback = (
event: PressEvent,
@@ -190,7 +190,7 @@ type ActiveCallback = (
type PassiveCallback = (event: PressEvent, gestureState: GestureState) => mixed;
export type PanHandlers = {|
export type PanHandlers = {
onMoveShouldSetResponder: (event: PressEvent) => boolean,
onMoveShouldSetResponderCapture: (event: PressEvent) => boolean,
onResponderEnd: (event: PressEvent) => void,
@@ -203,9 +203,9 @@ export type PanHandlers = {|
onResponderTerminationRequest: (event: PressEvent) => boolean,
onStartShouldSetResponder: (event: PressEvent) => boolean,
onStartShouldSetResponderCapture: (event: PressEvent) => boolean,
|};
};
type PanResponderConfig = $ReadOnly<{|
type PanResponderConfig = $ReadOnly<{
onMoveShouldSetPanResponder?: ?ActiveCallback,
onMoveShouldSetPanResponderCapture?: ?ActiveCallback,
onStartShouldSetPanResponder?: ?ActiveCallback,
@@ -224,7 +224,7 @@ type PanResponderConfig = $ReadOnly<{|
onPanResponderTerminate?: ?PassiveCallback,
onPanResponderTerminationRequest?: ?ActiveCallback,
onShouldBlockNativeResponder?: ?ActiveCallback,
|}>;
}>;
const PanResponder = {
/**
+6 -6
View File
@@ -32,14 +32,14 @@ const Platform = require('../Utilities/Platform');
const invariant = require('invariant');
const React = require('react');
type RequiredProps<ItemT> = {|
type RequiredProps<ItemT> = {
/**
* An array (or array-like list) of items to render. Other data types can be
* used by targeting VirtualizedList directly.
*/
data: ?$ReadOnly<$ArrayLike<ItemT>>,
|};
type OptionalProps<ItemT> = {|
};
type OptionalProps<ItemT> = {
/**
* Takes an item from `data` and renders it into the list. Example usage:
*
@@ -150,7 +150,7 @@ type OptionalProps<ItemT> = {|
* Enable an optimization to memoize the item renderer to prevent unnecessary rerenders.
*/
strictMode?: boolean,
|};
};
/**
* Default Props Helper Functions
@@ -176,10 +176,10 @@ function isArrayLike(data: mixed): boolean {
return typeof Object(data).length === 'number';
}
type FlatListProps<ItemT> = {|
type FlatListProps<ItemT> = {
...RequiredProps<ItemT>,
...OptionalProps<ItemT>,
|};
};
type VirtualizedListProps = React.ElementConfig<typeof VirtualizedList>;
+6 -6
View File
@@ -25,7 +25,7 @@ type Item = any;
export type SectionBase<SectionItemT> = _SectionBase<SectionItemT>;
type RequiredProps<SectionT: SectionBase<any>> = {|
type RequiredProps<SectionT: SectionBase<any>> = {
/**
* The actual data to render, akin to the `data` prop in [`<FlatList>`](https://reactnative.dev/docs/flatlist).
*
@@ -38,9 +38,9 @@ type RequiredProps<SectionT: SectionBase<any>> = {|
* }>
*/
sections: $ReadOnlyArray<SectionT>,
|};
};
type OptionalProps<SectionT: SectionBase<any>> = {|
type OptionalProps<SectionT: SectionBase<any>> = {
/**
* Default renderer for every item in every section. Can be over-ridden on a per-section basis.
*/
@@ -90,9 +90,9 @@ type OptionalProps<SectionT: SectionBase<any>> = {|
* This may improve scroll performance for large lists.
*/
removeClippedSubviews?: boolean,
|};
};
export type Props<SectionT> = {|
export type Props<SectionT> = {
...$Diff<
VirtualizedSectionListProps<SectionT>,
{
@@ -114,7 +114,7 @@ export type Props<SectionT> = {|
>,
...RequiredProps<SectionT>,
...OptionalProps<SectionT>,
|};
};
/**
* A performant interface for rendering sectioned lists, supporting the most handy features:
+6 -6
View File
@@ -26,7 +26,7 @@ type Item = any;
export type SectionBase<SectionItemT> = _SectionBase<SectionItemT>;
type RequiredProps<SectionT: SectionBase<any>> = {|
type RequiredProps<SectionT: SectionBase<any>> = {
/**
* The actual data to render, akin to the `data` prop in [`<FlatList>`](https://reactnative.dev/docs/flatlist).
*
@@ -39,9 +39,9 @@ type RequiredProps<SectionT: SectionBase<any>> = {|
* }>
*/
sections: $ReadOnlyArray<SectionT>,
|};
};
type OptionalProps<SectionT: SectionBase<any>> = {|
type OptionalProps<SectionT: SectionBase<any>> = {
/**
* Default renderer for every item in every section. Can be over-ridden on a per-section basis.
*/
@@ -91,9 +91,9 @@ type OptionalProps<SectionT: SectionBase<any>> = {|
* This may improve scroll performance for large lists.
*/
removeClippedSubviews?: boolean,
|};
};
export type Props<SectionT: SectionBase<any>> = $ReadOnly<{|
export type Props<SectionT: SectionBase<any>> = $ReadOnly<{
...$Diff<
VirtualizedSectionListProps<SectionT>,
{
@@ -115,7 +115,7 @@ export type Props<SectionT: SectionBase<any>> = $ReadOnly<{|
>,
...RequiredProps<SectionT>,
...OptionalProps<SectionT>,
|}>;
}>;
/**
* A performant interface for rendering sectioned lists, supporting the most handy features:
+14 -14
View File
@@ -37,20 +37,20 @@ export type LogData = $ReadOnly<{
}>;
export type Observer = (
$ReadOnly<{|
$ReadOnly<{
logs: LogBoxLogs,
isDisabled: boolean,
selectedLogIndex: number,
|}>,
}>,
) => void;
export type IgnorePattern = string | RegExp;
export type Subscription = $ReadOnly<{|
export type Subscription = $ReadOnly<{
unsubscribe: () => void,
|}>;
}>;
export type WarningInfo = {|
export type WarningInfo = {
finalFormat: string,
forceDialogImmediately: boolean,
suppressDialog_LEGACY: boolean,
@@ -58,15 +58,15 @@ export type WarningInfo = {|
monitorEvent: string | null,
monitorListVersion: number,
monitorSampleRate: number,
|};
};
export type WarningFilter = (format: string) => WarningInfo;
type AppInfo = $ReadOnly<{|
type AppInfo = $ReadOnly<{
appVersion: string,
engine: string,
onPress?: ?() => void,
|}>;
}>;
const observers: Set<{observer: Observer, ...}> = new Set();
const ignorePatterns: Set<IgnorePattern> = new Set();
@@ -413,25 +413,25 @@ export function observe(observer: Observer): Subscription {
};
}
type Props = $ReadOnly<{||}>;
type State = $ReadOnly<{|
type Props = $ReadOnly<{}>;
type State = $ReadOnly<{
logs: LogBoxLogs,
isDisabled: boolean,
hasError: boolean,
selectedLogIndex: number,
|}>;
}>;
type SubscribedComponent = React.ComponentType<
$ReadOnly<{|
$ReadOnly<{
logs: $ReadOnlyArray<LogBoxLog>,
isDisabled: boolean,
selectedLogIndex: number,
|}>,
}>,
>;
export function withSubscription(
WrappedComponent: SubscribedComponent,
): React.ComponentType<{||}> {
): React.ComponentType<{}> {
class LogBoxStateSubscription extends React.Component<Props, State> {
static getDerivedStateFromError(): {hasError: boolean} {
return {hasError: true};
+9 -9
View File
@@ -82,23 +82,23 @@ class LogBoxLog {
isComponentError: boolean;
extraData: mixed | void;
symbolicated:
| $ReadOnly<{|error: null, stack: null, status: 'NONE'|}>
| $ReadOnly<{|error: null, stack: null, status: 'PENDING'|}>
| $ReadOnly<{|error: null, stack: Stack, status: 'COMPLETE'|}>
| $ReadOnly<{|error: Error, stack: null, status: 'FAILED'|}> = {
| $ReadOnly<{error: null, stack: null, status: 'NONE'}>
| $ReadOnly<{error: null, stack: null, status: 'PENDING'}>
| $ReadOnly<{error: null, stack: Stack, status: 'COMPLETE'}>
| $ReadOnly<{error: Error, stack: null, status: 'FAILED'}> = {
error: null,
stack: null,
status: 'NONE',
};
symbolicatedComponentStack:
| $ReadOnly<{|error: null, componentStack: null, status: 'NONE'|}>
| $ReadOnly<{|error: null, componentStack: null, status: 'PENDING'|}>
| $ReadOnly<{|
| $ReadOnly<{error: null, componentStack: null, status: 'NONE'}>
| $ReadOnly<{error: null, componentStack: null, status: 'PENDING'}>
| $ReadOnly<{
error: null,
componentStack: ComponentStack,
status: 'COMPLETE',
|}>
| $ReadOnly<{|error: Error, componentStack: null, status: 'FAILED'|}> = {
}>
| $ReadOnly<{error: Error, componentStack: null, status: 'FAILED'}> = {
error: null,
componentStack: null,
status: 'NONE',
@@ -40,12 +40,12 @@ function getLogBoxLog() {
});
}
function getLogBoxSymbolication(): {|
function getLogBoxSymbolication(): {
symbolicate: JestMockFn<
$ReadOnlyArray<Array<StackFrame>>,
Promise<SymbolicatedStackTrace>,
>,
|} {
} {
return (require('../LogBoxSymbolication'): any);
}
+10 -10
View File
@@ -107,7 +107,7 @@ export type ExtendedExceptionData = ExceptionData & {
...
};
export type Category = string;
export type CodeFrame = $ReadOnly<{|
export type CodeFrame = $ReadOnly<{
content: string,
location: ?{
row: number,
@@ -120,26 +120,26 @@ export type CodeFrame = $ReadOnly<{|
// we gained the ability to use the collapse flag, but
// it is not integrated into the LogBox UI.
collapse?: boolean,
|}>;
export type Message = $ReadOnly<{|
}>;
export type Message = $ReadOnly<{
content: string,
substitutions: $ReadOnlyArray<
$ReadOnly<{|
$ReadOnly<{
length: number,
offset: number,
|}>,
}>,
>,
|}>;
}>;
export type ComponentStack = $ReadOnlyArray<CodeFrame>;
export type ComponentStackType = 'legacy' | 'stack';
const SUBSTITUTION = UTFSequence.BOM + '%s';
export function parseInterpolation(args: $ReadOnlyArray<mixed>): $ReadOnly<{|
export function parseInterpolation(args: $ReadOnlyArray<mixed>): $ReadOnly<{
category: Category,
message: Message,
|}> {
}> {
const categoryParts = [];
const contentParts = [];
const substitutionOffsets = [];
@@ -456,12 +456,12 @@ export function withoutANSIColorStyles(message: mixed): mixed {
);
}
export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {
componentStack: ComponentStack,
componentStackType: ComponentStackType,
category: Category,
message: Message,
|} {
} {
const message = withoutANSIColorStyles(args[0]);
let argsWithoutComponentStack: Array<mixed> = [];
let componentStack: ComponentStack = [];
@@ -16,11 +16,11 @@ import * as LogBoxData from './Data/LogBoxData';
import LogBoxInspector from './UI/LogBoxInspector';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
logs: $ReadOnlyArray<LogBoxLog>,
selectedLogIndex: number,
isDisabled?: ?boolean,
|}>;
}>;
export class _LogBoxInspectorContainer extends React.Component<Props> {
render(): React.Node {
@@ -65,4 +65,4 @@ export class _LogBoxInspectorContainer extends React.Component<Props> {
export default (LogBoxData.withSubscription(
_LogBoxInspectorContainer,
): React.ComponentType<{||}>);
): React.ComponentType<{}>);
@@ -16,11 +16,11 @@ import LogBoxLog from './Data/LogBoxLog';
import LogBoxLogNotification from './UI/LogBoxNotification';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
logs: $ReadOnlyArray<LogBoxLog>,
selectedLogIndex: number,
isDisabled?: ?boolean,
|}>;
}>;
export function _LogBoxNotificationContainer(props: Props): React.Node {
const {logs} = props;
@@ -102,4 +102,4 @@ const styles = StyleSheet.create({
export default (LogBoxData.withSubscription(
_LogBoxNotificationContainer,
): React.ComponentType<{||}>);
): React.ComponentType<{}>);
+4 -4
View File
@@ -18,16 +18,16 @@ import StyleSheet from '../../StyleSheet/StyleSheet';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';
type Props = $ReadOnly<{|
backgroundColor: $ReadOnly<{|
type Props = $ReadOnly<{
backgroundColor: $ReadOnly<{
default: string,
pressed: string,
|}>,
}>,
children?: React.Node,
hitSlop?: ?EdgeInsetsProp,
onPress?: ?(event: PressEvent) => void,
style?: ViewStyleProp,
|}>;
}>;
function LogBoxButton(props: Props): React.Node {
const [pressed, setPressed] = React.useState(false);
@@ -22,9 +22,9 @@ import LogBoxButton from './LogBoxButton';
import LogBoxInspectorSection from './LogBoxInspectorSection';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
codeFrame: ?CodeFrame,
|}>;
}>;
function LogBoxInspectorCodeFrame(props: Props): React.Node {
const codeFrame = props.codeFrame;
@@ -18,13 +18,13 @@ import LogBoxMessage from './LogBoxMessage';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
collapsed: boolean,
message: Message,
level: LogLevel,
title: string,
onPress: () => void,
|}>;
}>;
const SHOW_MORE_MESSAGE_LENGTH = 300;
@@ -20,9 +20,9 @@ import LogBoxInspectorSection from './LogBoxInspectorSection';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
log: LogBoxLog,
|}>;
}>;
const BEFORE_SLASH_RE = /^(.*)[\\/]/;
@@ -14,11 +14,11 @@ import Text from '../../Text/Text';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
heading: string,
children: React.Node,
action?: ?React.Node,
|}>;
}>;
function LogBoxInspectorSection(props: Props): React.Node {
return (
@@ -18,10 +18,10 @@ import LogBoxButton from './LogBoxButton';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
onPress?: ?(event: PressEvent) => void,
status: 'COMPLETE' | 'FAILED' | 'NONE' | 'PENDING',
|}>;
}>;
function LogBoxInspectorSourceMapStatus(props: Props): React.Node {
const [state, setState] = React.useState({
@@ -23,10 +23,10 @@ import LogBoxInspectorStackFrame from './LogBoxInspectorStackFrame';
import * as LogBoxStyle from './LogBoxStyle';
import * as React from 'react';
type Props = $ReadOnly<{|
type Props = $ReadOnly<{
log: LogBoxLog,
onRetry: () => void,
|}>;
}>;
export function getCollapseMessage(
stackFrames: Stack,

Some files were not shown because too many files have changed in this diff Show More