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

18 Коммитов

Автор SHA1 Сообщение Дата
Ruslan Lesiutin 1453ef1a88 refactor(react-native-github): move ProgressViewIOS to internal (#35277)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35277

# Changelog:
[JS][Removed] - removed ProgressViewIOS module
[iOS][Removed] - removed native iOS sources of ProgressViewIOS

Reviewed By: lunaleaps

Differential Revision: D40937475

fbshipit-source-id: 9060adf3c99727af4eeffc767ccfd0a70574859d
2022-11-09 16:09:31 -08:00
Ruslan Lesiutin d03a29ce5f refactor(react-native-github): move ImagePickerIOS to internal (#35199)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35199

**Changelog:**
[iOS][Removed] - Removed ImagePickerIOS module native sources
[JS][Removed] - Removed ImagePickerIOS module from react-native

Reviewed By: cortinico

Differential Revision: D40859520

fbshipit-source-id: a6a114a05574d46ea62600999bff95025ba7cdc8
2022-11-04 08:08:54 -07:00
Nick Gerleman 5d26ceaa23 Fixup TS Organization (#35169)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35169

This reorganizes typing structure a bit.

`Utilities.d.ts` was originally added for utilitiy types but I ended up leaving it a grab bag of types that didn't belong to any individual bit of code. Out of what is in it right now, `Insets` was actually public, and seems to have been imported.

We also run into files around the renderer which are [currently overwritten](e286da25fc/Libraries/Renderer/implementations/ReactNativeRenderer.d.ts) by the React sync script.

Finally, all of the top-level imports of `Utilities` were auto-generated by VS Code, but fail in real apps. I think this is because our tsconfig sets a `baseUrl` to allow resolution from the types folder, so the tooling in the RN repo will use that, but it breaks in real apps that don't have that mapping.

This splits all these up into a couple separate directories that are hopefully easier to reason about, and removes `Omit` which has been a builtin type for quite some time (we were actually already using built-in `Omit`).

Changelog:
[General][Fixed] - Fixup TS Organization

Reviewed By: cipolleschi

Differential Revision: D40932319

fbshipit-source-id: 0b6e3e3eda603885b4dc01dcb9f5233aa546d128
2022-11-02 14:58:37 -07:00
Ruslan Lesiutin 20eeb1bfe3 refactor(react-native-github): remove AsyncStorage from JS
Summary:
## Changelog
[JS][Removed] - Removed AsyncStorage module from react-native

Reviewed By: NickGerleman

Differential Revision: D40302352

fbshipit-source-id: 9377ea12036e498dde0b4b0f56de5c4fb9bd2461
2022-10-31 14:39:19 -07:00
Fabrizio Cucci e22217fe8b Add `useAnimatedValue` to public API
Summary:
Changelog:
[General][Added] - Introduce `useAnimatedValue` hook to make it easier working with `Animated.Value`s in function components.

Reviewed By: javache

Differential Revision: D40434219

fbshipit-source-id: 3caf6ad98d11a534b8cc6816820bc1d125150380
2022-10-18 04:22:58 -07:00
David 5dd2f2e4b7 fix: Update incorrect `SwitchChangeEvent` type (#34931)
Summary:
I noticed that typescript type for `onChange`  event of `<Switch/>` was incorrect

```tsx
<Switch
  onChange={(event) => {
    // TS
    event.value; // boolean
    event.nativeEvent.value; //TS2339: Property 'value' does not exist on type 'Event'.
    // JS
    console.log(event.nativeEvent); // {value:false,target:87}
    console.log(event.value); // undefined
  }}
/>
```

## Changelog

[General] [Changed] - Typescript: update incorrect `SwitchChangeEvent` type

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

Test Plan: ...

Reviewed By: lunaleaps

Differential Revision: D40240552

Pulled By: skinsshark

fbshipit-source-id: 4d39d547778de4ac4dc6c94471f05bfbe157d0e5
2022-10-12 13:05:35 -07:00
Rubén Norte 40567c21e9 Fix TypeScript tests
Summary:
I fixed the TypeScript definitions for Systrace in a0f56adb07, but I forgot to update the TypeScript tests that were outdated. This diff fixes those tests and CI in OSS.

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D40141920

fbshipit-source-id: f73501450af0be6b0b6f836b9a774abb1fa4f620
2022-10-06 06:54:05 -07:00
Rubén Norte a0f56adb07 Refactor Systrace module
Summary:
This refactors the systrace module to:
1) Migrate it to ESM
2) Fix the typing of certain parameters (e.g.: `eventName` and `cookie` shouldn't be optional)
2) Fix TypeScript definitions
3) Add inline documentation for methods
4) Add args (metadata) to all methods where it's supported in fbsystrace (`endEvent` and `endAsyncEvent`).
5) Make `setEnabled` a no-op. The only place where this method is called is from native, when starting a profile session. The problem is that implementation for Systrace in OSS (https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.java#L40-L42) doesn't support listeners, so this wouldn't work correctly there. It also doesn't get called with Venice, so instead of fixing it for Venice with the same Meta-internal behavior, I decided to fix it for everyone with the synchronous method.

I'm not considering this a change in the public API of systrace because this module has been broken in OSS for ages and I'm assuming no one's using it at this point.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D40095842

fbshipit-source-id: fee41b2b7ae23aefe059e390c55d139db75247c5
2022-10-05 15:17:53 -07:00
Aelita e0a495899d Sync new changes in @types/react-native (TextProps, TouchableWithoutFeedbackProps) (#34794)
Summary:
Sync the changes in `types/react-native` https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62394 to here as required by lunaleaps

## Changelog
[Internal] [Added] - Sync new changes in `types/react-native`

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

Test Plan: Tested in `types/__typetests__/index.tsx`

Reviewed By: cortinico

Differential Revision: D39846101

Pulled By: cortinico

fbshipit-source-id: cebe62aa97f764d9a10c8371936870c515fb9be3
2022-10-03 08:01:20 -07:00
Nick Gerleman b788b6e1c9 Fix `analyze_code` CircleCI Job (#34801)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34801

D39796598 (8cdc9e7f04) broke this CircleCI job, causing failures for `dtslint` and `prettier`. This fixes both issues, by upating formatting, and removing types from `legacy-properties.d.ts` that we no longer export.

These were not flagged by sandcastle. It looks like this is because:
1. We run eslint, but not dtslint internally
2. Arcanist will ignore anything under a "vendor" directory, while we do not exlude anything from the prettier check in OSS.

I also updated the eslint config to lint any TypeScript that appears outside the types directory, since typings are now spread out.

Changelog:
[Internal][Fixed] - Fix `analyze_code` CircleCI Job

Reviewed By: cipolleschi

Differential Revision: D39848604

fbshipit-source-id: 844dfe26e4b618059542b29df163402079c39322
2022-09-27 07:11:10 -07:00
Nick Gerleman 8cdc9e7f04 Place TypeScript Declarations Alongside Source Files
Summary:
React Native's TS definitions are currently mostly stored in one monolithic file. This change splits the definitions up to correspond to the source files they came from, and are placed next to the source files. I think this should help inform, and make it easy to update the TS declarations when touching the Flow file.

I noticed as part of the change that the typings have not yet removed many APIs that were removed from RN. This is bad, since it means using the removed/non-functional API doesn't cause typechecker errors. Locating typings next to source should prevent that from being able to happen.

The organization here means individual TS declarations can declare what will be in the RN entrypoint, which is a little confusing. Seems like a good potential next refactor, beyond the literal translation I did.

Changelog:
[General][Changed] - Place TS Declarations Alongside Source Files

Reviewed By: lunaleaps, rshest

Differential Revision: D39796598

fbshipit-source-id: b36366466fd1976bdd2d4c8f7a4104a33c457a07
2022-09-26 12:09:45 -07:00
Saad Najmi 6ba5fa946d Update pressable hover props (#34740)
Summary:
This is a mirror of https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62344 . I am updating some typescript types for props that were added with https://github.com/facebook/react-native/issues/32405

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Fixed] - Fixed missing Pressable hover props in typescript definition

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

Test Plan: Added a test case.

Reviewed By: lunaleaps

Differential Revision: D39688606

Pulled By: cortinico

fbshipit-source-id: 98ea5f64e6ac264772466455e6d5ab99a8427d3a
2022-09-21 11:50:21 -07:00
Luna Wei 6eee307778 Fix: Publish types folder (#34727)
Summary:
From changes in https://github.com/facebook/react-native/pull/34614, I forgot to actually export the types directory.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal] - Add types directory as part of the npm package

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

Test Plan: Verified on [`build_npm_package_1`](https://app.circleci.com/pipelines/github/facebook/react-native/15799/workflows/4fd57bfc-0142-49d9-a1a6-83fa43f0e371/jobs/295438) job where we create the commitly, that `types` folder is included and `__typetests__` are ignored

Reviewed By: cipolleschi

Differential Revision: D39646310

Pulled By: lunaleaps

fbshipit-source-id: 361f7925fa1cdc30d0865d291933c7fce9e0fa49
2022-09-20 12:39:58 -07:00
Nick Gerleman 773615bc9d Remove listKey from TS typings
Summary:
The prop is removed as part of D39589089 (bc5cb7cd79) (no longer does anything). Remove from the TS declarations.

Changelog:
[General][Removed] - Remove listKey from TS typings

Reviewed By: lunaleaps

Differential Revision: D39650827

fbshipit-source-id: dd9b5eccba1b9f6964a6d60ea5bae9913e8396e3
2022-09-20 11:39:05 -07:00
Luna Wei 2f6e0358a9 Add id property
Summary:
Changelog: [Internal] - Apply changes from recent `id` property adds. These are changes by
gabrieldonadel from https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62019

Reviewed By: cipolleschi

Differential Revision: D39646408

fbshipit-source-id: d75f2e2b5b3d157825c4aaf21775e0d5165383ee
2022-09-20 10:57:58 -07:00
Luna Wei 88bfc65803 Update Accessibility types for aria props
Summary: Changelog: [Internal] - Update the base accessibility props to include the added aria props. See https://github.com/facebook/react-native/compare/0.70-stable...main for changes.

Reviewed By: cipolleschi

Differential Revision: D39633224

fbshipit-source-id: 6c08ab8540b8b6e2b57f066a35754376c5ae3d68
2022-09-20 10:57:58 -07:00
Luna Wei c5217f199d Update Keyboard, Alert TS Types
Summary: Changelog: [Internal] - Update changes to Keyboard, Alert from differences in those files from https://github.com/facebook/react-native/compare/0.70-stable...main

Reviewed By: NickGerleman

Differential Revision: D39629997

fbshipit-source-id: 85bb91d00a165e708dbf4e32d7f37ce8a6c02a72
2022-09-19 14:56:36 -07:00
Luna Wei 6b2a511cbb Move TypeScript declarations into react-native (#34614)
Summary:
## Changelog
[General] [Added] - Add `types` folder to house TypeScript types.

Release TypesScript types with react-native and eventually deprecate [types/react-native](https://www.npmjs.com/package/types/react-native).

The current plan is to release types/react-native for 0.70 and 0.71 while also maintaining types here. This will result in some double maintenance until 0.72 but will give community time to move off of types/react-native.

After this lands, there have been changes on `main` of types that we need to update. Then, when we release 0.71 from DefinitelyTyped, we can simply copy over the `types` folder from this repo.

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

Test Plan:
`yarn run test-typescript` for linting types

* Created a new project using the TS template and my local clone of `react-native` on this branch.
`npx react-native init MyTSApp --version <path-to-my-local-rn-repo> --template react-native-template-typescript`
* Updated the `package.json` to remove `types/react-native`
* Deleted my node_modules and re-ran yarn
* Opened MyTSApp in VSCode and verified the type suggestions appeared and cmd+click to defnitions took me to the node_module dependency `react-native/types`

## Danger is failing on this PR and it's expected
 as it runs off the changes on `main`.  [This is expected](https://docs.github.com/en/github-ae@latest/actions/using-workflows/events-that-trigger-workflows?fbclid=IwAR2_AE0Jwndt8Gu-iTQnxGxLJq7nakbi7sz8jwZ6U62JWLSdcZuvjcQ6WvE#pull_request_target). However testing it locally passes. Once merged, and these changes are on `main`, danger will pass again.

```
$ react-native/packages/react-native-bots
❯ yarn danger pr https://github.com/facebook/react-native/pull/34614
yarn run v1.22.19
$ ..react-native/node_modules/.bin/danger pr https://github.com/facebook/react-native/pull/34614
Starting Danger PR on facebook/react-native#34614

Danger: ✓ found only warnings, not failing the build
## Warnings
🔒 package.json - <i>Changes were made to package.json. This will require a manual import by a Facebook employee.</i>

  Done in 13.24s.
```

Reviewed By: mdvacca

Differential Revision: D39479137

Pulled By: lunaleaps

fbshipit-source-id: 1d506f812d566b783b6e79104cd6339b077a42a7
2022-09-19 12:26:00 -07:00