Commit Graph

43 Commits

Author SHA1 Message Date
Sam Zhou cf664c65e2 Standardize subtyping error code into incompatible-type in react native and metro (#53312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53312

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D80400976

fbshipit-source-id: 196af69c0b9621b2a2675b232406639773e04933
2025-08-18 09:04:31 -07:00
Maciej Jastrzębski 6965d57e75 fix(a11y): TextInput aria-label handling (#53051)
Summary:
The `aria-label` prop was ignored on `TextInput` component. Which resulted in screen reader not able to read it.

This PR forwards `aria-label` to `accessibilityLabel` in a manner similar to e.g. `View` and `Text`

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[GENERAL] [FIXED] - a11y: fix `aria-label` on `TextInput`

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

Test Plan:
Run RNTester => TextInput => Accessibility section under Accessibility Inspector or screen reader.

iOS fixed:
https://github.com/user-attachments/assets/68c3a2ef-7dfe-479c-97fc-cbe72108c45c

iOS baseline:
https://github.com/user-attachments/assets/2e8372ba-10dc-47d2-b6b1-9f664000de7d

Reviewed By: andrewdacenko

Differential Revision: D79635413

Pulled By: rshest

fbshipit-source-id: dd2f583d67c6c6c6393e02c5fe534308e1e2f921
2025-08-06 09:36:35 -07:00
Sam Zhou 6b354155ed Replace $FlowFixMe(Props|State|Empty) with just $FlowFixMe (#53002)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53002

Changelog: [Internal]

Reviewed By: marcoww6

Differential Revision: D79524515

fbshipit-source-id: 18b96538a62c7ae5912b1e89d2b50c1420c7eaf5
2025-08-04 11:43:00 -07:00
Tim Yung 1977dd6596 RN: Sort Pragmas in Headers (#51554)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51554

Sorts pragma directives file headers in React Native.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75264593

fbshipit-source-id: 9e4b253dd0fc94dc2fc469d7114b93a8aae305f4
2025-05-22 21:18:53 -07:00
Panos Vekris 50ca7e5730 manual annotations in preparation of natural inference rollout in react-native, tools, etc.
Summary:
The Flow team is improving the way Flow infers type for primitive literals. This diff prepares the codebase for the new behavior by adding type annotations, or annotations of the form `'abc' as const`.

Changelog: [internal]

Reviewed By: marcoww6

Differential Revision: D75188179

fbshipit-source-id: be50990f23f79cf2d8dae7576af5190218adcafe
2025-05-21 20:06:46 -07:00
Tim Yung 1bf167ce97 RN: Prefer Destructured Import for useRef (#51404)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51404

Prefers using this as a destructured import instead of as a member expression of `React`.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D74893440

fbshipit-source-id: 9032f1e867a34b9cfa808f920a38f2630046eed7
2025-05-16 16:33:18 -07:00
Dawid Małecki ddcab831b1 Migrate already root exported deep imports in rn-tester. (#50958)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50958

In rn-tester package there are many react-native deep imports which will be deprecated in the future. It is a starter for migrating rn-tester to using root imports instead. Only deep imports that are already root exported are changed. This diff avoids using `CodegenTypes` as it causes build errors and will be resolved in next stages.

Besides import changes, `PointerEvent` type is now also exported from the root.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D73656526

fbshipit-source-id: 5814a3d9c6a04b1236581dbbe291cd109e2c71c0
2025-04-28 07:24:46 -07:00
Jakub Piasecki dcaa33e6d9 Add support for numberOfLines for TextInput on iOS (#49549)
Summary:
`TextInput` component has been missing support for `numberOfLines` prop on iOS, this PR adds it.

## Changelog:

[IOS] [ADDED] - Add support for `numberOfLines` prop on `TextInput`

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

Test Plan: Tested on RNTester and added a new case utilizing the prop

Reviewed By: cipolleschi

Differential Revision: D69915133

Pulled By: j-piasecki

fbshipit-source-id: b6a86bc64bd3c2129a64e99c9bcec9cf5bfde3bc
2025-02-24 04:23:58 -08:00
Jakub Piasecki c3ea606660 Align TextInput types with TypeScript (#48972)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48972

Changelog: [Internal]

Align TextInput types with TypeScript definitions.

Reviewed By: huntie

Differential Revision: D68713179

fbshipit-source-id: bb36d9333e45f2a30db91a17b8698b34cd792eb6
2025-01-31 04:54:42 -08:00
Rickard Zrinski 97cf42f979 Fix maxFontSizeMultiplier prop on Text and TextInput components in new architecture (#47614)
Summary:
The `maxFontSizeMultiplier` prop for `Text` and `TextInput` was not handled in Fabric / New Architecture as documented in https://github.com/facebook/react-native/issues/47499.

bypass-github-export-checks

## Changelog:

[GENERAL] [FIXED] - Fix `maxFontSizeMultiplier` prop on `Text` and `TextInput` components in Fabric / New Architecture

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

Test Plan:
I have not added any automated tests for this change but try to do so if requested. I have however added examples to RN Tester for both the Text and TextInput components, as well as compared the behaviour with Paper / Old Architecture. Both on version 0.76.

Noticed now I didn't do exactly the same steps in both videos, oops! Be aware that reapplying changes made in the Settings are currently half-broken on the new architecture, thus I'm restarting the app on Android and iOS. But this issue is unrelated to my changes. I've tested on main branch and it has the same issue.

Here are comparison videos between Paper and Fabric on iOS *after* I've made my fix.

### Text
| Paper  | Fabric |
| ------------- | ------------- |
| <video src="https://github.com/user-attachments/assets/f4fd009f-aa6d-41ab-92fa-8dcf1e351ba1" /> | <video src="https://github.com/user-attachments/assets/fda42cc6-34c2-42a7-a6e2-028e7c866075" /> |

### TextInput
| Paper  | Fabric |
| ------------- | ------------- |
| <video src="https://github.com/user-attachments/assets/59b59f7b-25d2-4b5b-a8e2-d2054cc6390b" /> | <video src="https://github.com/user-attachments/assets/72068566-8f2a-4463-874c-45a6f5b63b0d" /> |

Reviewed By: Abbondanzo

Differential Revision: D65953019

Pulled By: cipolleschi

fbshipit-source-id: 90c3c7e236229e9ad9bd346941fafe4af8a9d9fc
2025-01-29 09:27:44 -08:00
VidocqH 2ae45ec3ce fix TextInput dataDetectorTypes (#48952)
Summary:
Setting `dataDetectorTypes` has no effect. As I am new to the react native codebase, it seems like `dataDetectorTypes` has not implemented on new arch yet.

issue: https://github.com/facebook/react-native/issues/48951

## Changelog:

[IOS] [FIXED] - implement `dataDetectorTypes` in the same way as the old architecture

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

Test Plan: <img width="356" alt="image" src="https://github.com/user-attachments/assets/192a683c-f7b7-48ac-98cd-76866901f008" />

Reviewed By: javache

Differential Revision: D68715166

Pulled By: cipolleschi

fbshipit-source-id: 612119e7453da012e6f75e1fc3a22ddedcb569a4
2025-01-28 05:07:26 -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
Mateo Guzmán d4407d6f77 Fix RNTester strict mode warnings (#48619)
Summary:
While investigating https://github.com/facebook/react-native/issues/22186, some false positives showed up as some of the examples also have non-strict mode compatible code.

In this PR:

- Converting from class to functional components some TextInput and Image examples that were using `UNSAFE_` lifecycles.
- Unifying the auto-expanding example as it was exactly the same for iOS and Android.

## Changelog:

[INTERNAL] - Fix RNTester strict mode warnings for TextInput and Image examples

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

Test Plan:
- Wrapped the the entry app component in `RNTesterAppShared.js` with `StrictMode` and verified that no warnings are shown anymore for the updated components.
- Checked the examples are still working as they were.

Reviewed By: fabriziocucci

Differential Revision: D68094402

Pulled By: rshest

fbshipit-source-id: e13878cb290735095afaef3d0377fd6dab33c380
2025-01-13 05:11:13 -08:00
Mykhailo Kravchenko 0154372b93 feat: Manage keyboard shortcuts visibility of TextInput (#47671)
Summary:
**iOS** does offer a native property for **UITextField** called `inputAssistantItem`. According to the [documentation](https://developer.apple.com/documentation/uikit/uitextinputassistantitem), we can hide the **"shortcuts"** by setting the `leadingBarButtonGroups` and `trailingBarButtonGroups` properties to empty arrays.

I propose adding a new property for **TextInput** in **React Native**, which would set these native properties to empty arrays. This new property could be called `disableInputAssistant` or `disableKeyboardShortcuts` and would be a `boolean`.

Developers can manage this behavior (the redo & undo buttons and suggestions pop-up hiding) after applying these native props.

https://github.com/react-native-community/discussions-and-proposals/discussions/830

## Changelog:

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

Pick one each for the category and type tags:

[IOS] [ADDED] - [TextInput] Integrate a new property - `disableKeyboardShortcuts`. It can disable the keyboard shortcuts on iPads.

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

[IOS] [ADDED] - [TextInput] Integrate a new property - `disableKeyboardShortcuts`. It can disable the keyboard shortcuts on iPads.

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

Test Plan:
Manual
1. Open TextInput examples.
2. Scroll down and reach the "Keyboard shortcuts" section.
3. Test each case.

Note: **TextInput** behaves the same as now when the new prop is not passed or is `false`.

https://github.com/user-attachments/assets/5e814516-9e6c-4495-9d46-8175425c4456

Reviewed By: javache

Differential Revision: D67451609

Pulled By: cipolleschi

fbshipit-source-id: 59ba3a5cc1644ed176420f82dc98232d88341c6e
2025-01-06 09:54:29 -08:00
Mateo Guzmán 79ed11f8f4 fix(rn-tester): text input and xml http request dark mode adjustments (#48207)
Summary:
Was troubleshooting in these modules recently and noticed a few texts off in dark mode. Replacing a few instances of the Text component in all I could see in the two screens.

## Changelog:

[INTERNAL] - RN Tester `TextInput` & `XMLHttpRequest` dark mode adjustments

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

Test Plan:
<details>
<summary>View Screenshots (before fixes)</summary>

| Screenshot 1 | Screenshot 2 | Screenshot 3 | Screenshot 4 | Screenshot 5 | Screenshot 6 |
|--------------|--------------|--------------|--------------|--------------|--------------|
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 11 36](https://github.com/user-attachments/assets/c396bc5d-4b3c-4f63-8ac0-68bc808aa9d4) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 11 21](https://github.com/user-attachments/assets/cd8e5a2f-9066-4bc7-b56b-65dbd6df7dc4) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 30](https://github.com/user-attachments/assets/da451c18-40cd-4421-b8f5-a2462f82fee9) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 23](https://github.com/user-attachments/assets/32925fdb-f983-439f-b898-6986b739895a) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 19](https://github.com/user-attachments/assets/f0db7b49-dfef-4abc-aef0-2d55b016c0f8) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 16](https://github.com/user-attachments/assets/bad6dc45-3679-4bb6-aadd-6743053cd90f) |
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 10](https://github.com/user-attachments/assets/43028f51-c6e2-4b26-b20d-a3639606d6d5) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 07](https://github.com/user-attachments/assets/f8e2196e-bc64-4507-b330-d1d85730ddff) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 09 59](https://github.com/user-attachments/assets/a7100770-4b38-421f-9b73-09e4fff9e012) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 09 53](https://github.com/user-attachments/assets/27759c8c-0e56-4b92-8173-ba031b994e5c) | | | |

</details>

<details>
<summary>View Screenshots (after fixes)</summary>

| Screenshot 1 | Screenshot 2 | Screenshot 3 | Screenshot 4 | Screenshot 5 | Screenshot 6 |
|--------------|--------------|--------------|--------------|--------------|--------------|
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 30](https://github.com/user-attachments/assets/71c0287d-d98a-4bfe-85dc-1e08da12ce43) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 26](https://github.com/user-attachments/assets/45eac165-f42a-4193-98cc-3ee85d963382) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 23](https://github.com/user-attachments/assets/c0e4432d-2d1d-487f-8965-3829c3257364) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 19](https://github.com/user-attachments/assets/ab81500c-66c1-4b90-b2b1-f7c490e0029b) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 16](https://github.com/user-attachments/assets/aafcad74-e851-49a8-9db0-df06f81f0b30) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 11](https://github.com/user-attachments/assets/29a2a6c8-e448-4c90-844d-29a248f9ab69) |
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 07](https://github.com/user-attachments/assets/54e505c4-c554-4000-aac1-61b97e034f55) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 04 39](https://github.com/user-attachments/assets/0e91dc29-199d-424e-b36a-6b0f7a317cd2) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 04 22](https://github.com/user-attachments/assets/e965b01d-0b03-4d01-a971-57c3bd550146) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 04 15](https://github.com/user-attachments/assets/50ef03a6-bf1a-4db3-845b-e98373369574) |  |  |

</details>

Reviewed By: cipolleschi

Differential Revision: D67087492

Pulled By: javache

fbshipit-source-id: c9c64377d8c10d965bc5db7783aa80f099ce858a
2024-12-12 04:07:10 -08:00
Nicola Corti 88c9a42fca Fix eslint warnings in react-native (#48016)
Summary:
There are currently 2 warnings firing for every PR (e.g. look here https://github.com/facebook/react-native/pull/48013/files).

Those are annoying so I'm fixing them here.

## Changelog:

[INTERNAL] - Fix eslint warnings in react-native

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

Test Plan: CI

Reviewed By: NickGerleman

Differential Revision: D66595842

Pulled By: cortinico

fbshipit-source-id: 0fd39629a97dbbe5d75a78c8eaa50241faf6bf1e
2024-12-02 04:11:22 -08:00
dominictb e021e50d53 fix: scroll the cursor into view when focus (#46411)
Summary:
Currently in iOS, when focusing the multiline text input, the cursor is not automatically scrolled into view if it is out of view. This PR adds the small util to scroll the cursor into view when the text input focuses. This doesn't happen in Android due to [this](https://github.com/facebook/react-native/blob/defb0bd137711d3e76514d9202005a221a345871/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L360)

Original issue: https://github.com/Expensify/App/issues/48122
Original proposal: https://github.com/Expensify/App/issues/48122#issuecomment-2320769418

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[IOS] [ADDED] - Scroll the cursor into view when text input is focused

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

Test Plan:
Code to reproduce in rn-tester
```
const TextInputWithFocusButton = () => {
  const inputToFocusRef = React.useRef<React.ElementRef<typeof TextInput> | null>(null);
  return (
    <View>
      <ExampleTextInput
        ref={inputToFocusRef}
        placeholder="height increases with content"
        defaultValue="React Native enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and React. The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere. Facebook uses React Native in multiple production apps and will continue investing in React Native."
        multiline={true}
        enablesReturnKeyAutomatically={true}
        returnKeyType="go"
        style={[styles.multiline, styles.multilineExpandable]}
      />
      <Button title="Focus" onPress={() => {
        inputToFocusRef.current?.focus();
      }} />
    </View>
  );
};
```

Steps:
- Move the cursor of the input to end of the input text
- Scroll up the input
- Blur the input
- Click on `Focus` button to re-focus the input

Note that before this fix, the cursor is not scrolled into view

- In iOS

<table>
<tr>
<th>Before</th>
<th>After</th>
</tr>
<tr>
<td>

https://github.com/user-attachments/assets/de589cbf-158c-4e28-81d6-8412bf05ab23

</td>
<td>

https://github.com/user-attachments/assets/81c571f9-653b-49a5-9ecb-6eeaa2c54ec7

</td>
</tr>
</table>

Reviewed By: sammy-SC

Differential Revision: D62847985

Pulled By: cipolleschi

fbshipit-source-id: c0367a7fc0a7a16b30c4538e59f42d971d959357
2024-11-18 03:38:49 -08:00
Mateo Guzmán 32931466ed feat(text-input): [iOS] inputAccessoryViewButtonLabel prop (#47441)
Summary:
Fixes https://github.com/facebook/react-native/issues/29244, also mentioned in https://github.com/facebook/react-native/issues/25009

As mentioned in the linked issues, the current return key label in the input accessory view is not localized. In the code, right now the texts are hardcoded (see: [RCTTextInputComponentView.mm](https://github.com/facebook/react-native/blob/main/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm#L552) and [RCTBaseTextInputView.mm](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm#L694)). I could not find the historical reason for this, but doing some investigation there doesn't seem to be a way of getting the translated text into the code by using the existing props. (Ref: https://stackoverflow.com/a/58190342/5415299)

The solution: adding a new property `inputAccessoryViewButtonLabel` which can be used to overwrite these defaults non-translated values. The property is optional to avoid breaking changes.

The implementation works for both Fabric and Paper.

## Changelog:

[IOS] [ADDED] - TextInput `inputAccessoryViewButtonLabel` prop

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

Test Plan:
A new example has been added under the `TextInput` examples in the RNTester. See below:

<details>
<summary>Video demonstrating how the new prop behaves</summary>

https://github.com/user-attachments/assets/b15cb8b8-494a-4f41-b434-e33eeef5d267

</details>

Reviewed By: cipolleschi

Differential Revision: D65533493

Pulled By: javache

fbshipit-source-id: d80bf501ba3e38bf3b09833170780df45a26bb61
2024-11-13 06:44:23 -08:00
Riccardo Cipolleschi d3d48cb357 feat(JS): Expose text content types to JS (#46170)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46170

This PR expose to JS a few missing text content types on iOS (available from iOS 15)

- dateTime
- flightNumber
- shipmentTrackingNumber

## Changelog
[General][Added] - Expose missing text content type to JS

Reviewed By: blakef

Differential Revision: D61657788

fbshipit-source-id: 1a0ea0e76efaf715d88bcbf249f7cb20b5f3607b
2024-09-10 05:00:00 -07:00
shubhamguptadream11 ce2d34f194 feat(iOS): line break mode implement JS APIs for the new mode (#46128)
Summary:
Solves this issue: https://github.com/facebook/react-native/issues/44107

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[IOS] [ADDED] - Line break mode for TextInput components. **This includes JS APIs for the new mode.**

This PR is a breakdown of [this](https://github.com/facebook/react-native/pull/45968) PR.

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

Test Plan:
- Added unit tests to cover the new JS APIs.
- Verified that the new mode functions as expected through manual testing.

Reviewed By: andrewdacenko

Differential Revision: D61657004

Pulled By: cipolleschi

fbshipit-source-id: 9fc5c40fc077bee8e1abc51b6eae2e0f0fcd9b8f
2024-09-10 04:52:22 -07:00
Nick Gerleman 2ad51e53f0 Move showSoftInputOnFocus example to TextInputSharedExamples (#44558)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44558

Right now this is only exposed to RNTester on iOS, but the prop exists on both platforms.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D57281892

fbshipit-source-id: 9effc2b9c6421f8c74a2f4b933ab0fa0f15e7d70
2024-05-14 05:26:35 -07:00
Pieter Vanderwerff 007ca0c376 Deploy 0.236.0 to xplat (#44510)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44510

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D57186863

fbshipit-source-id: 389dcb039c7d4c461b3be28f4eba32d5d9781e61
2024-05-09 19:33:12 -07:00
Nick Gerleman 3f88821167 Avoid TextInput example styles causing non-deterministic rendering on iOS (#43599)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43599

iOS E2E tests non-deterministic rendering happens around examples with a border set to `StyleSheet.hairlineWidth`. That value has special subpixel math, that doesn't seem to render consistently on iOS (this is its own bug).

To unblock adding some new E2E iOS TextInput tests, this removes usage of `hairlineWidth` in styles, and more generally, tries to unify TextInput styles in the examples.

This will break a whole bunch of RNTester Jest E2E baselines on different apps, which I will update from land-time runs or after continuous builds are available for different endpoints.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D55213090

fbshipit-source-id: 6d81b9355adc538a3ade6f50ef93c3ca08782ae7
2024-03-29 02:41:26 -07:00
Oskar Kwaśniewski 7d1a98c43b Lint source files, sort imports, remove unused imports (#41829)
Summary:
This PR lints source files using eslint. I've executed `yarn lint --fix` and also manually fixed some of eslint issues.

Before:

![CleanShot 2023-12-07 at 12 07 10@2x](https://github.com/facebook/react-native/assets/52801365/2b00cf23-e5a0-46b8-802f-adcb67224111)

After:

![CleanShot 2023-12-07 at 12 06 24@2x](https://github.com/facebook/react-native/assets/52801365/bb05b2c0-2b27-4f99-b7b4-cb47a51a3885)

## Changelog:

[GENERAL] [FIXED] - Lint source files, sort imports, remove unused ones

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

Test Plan: CI Green

Reviewed By: christophpurrer

Differential Revision: D51979074

Pulled By: dmytrorykun

fbshipit-source-id: e11b90721e33f5e9949a0833e5f39fe7ba3d1067
2023-12-11 08:54:29 -08:00
Moti Zilberman d6e0bc714a Enable lint/sort-imports everywhere (#41334)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41334

TSIA.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D51025812

fbshipit-source-id: e10d437be775a6b80946483aa96460f34927f870
2023-11-06 12:59:38 -08:00
Sam Zhou 90c0e3be14 Align types for different ios/android implementation files (#38761)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38761

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D48014272

fbshipit-source-id: d70c2b9442cedf87e72be336c7a25372daea8f28
2023-08-02 19:57:12 -07:00
Rob Walker 216865cdb7 feat: Support iOS 17 text content types (#38354)
Summary:
While setting up a credit card form in RN, I discovered that iOS 17 supports a number of new content types ([`UITextContentType` docs](https://developer.apple.com/documentation/uikit/uitextcontenttype?language=objc)). In the docs these are marked with the `Beta` flag.

Setting up the new content types is relatively straightforward, but a change is required in https://github.com/facebook/react-native-deprecated-modules to update the `TextInput` prop types. ~~I will open a PR in that repo shortly.~~ I have [opened a PR](https://github.com/facebook/react-native-deprecated-modules/pull/23) to update the prop types. ~~Once that PR is merged, a version bump for that dependency will need to be added to this PR.~~ The PR is merged and the dependency in this PR has been updated.

## Changelog:

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

Pick one each for the category and type tags:

[IOS] [ADDED] - Added support for iOS 17+ text content types

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

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

Test Plan: The `rn-tester` app builds and runs successfully. I have added a few new examples of inputs using the new text content types.

Reviewed By: javache

Differential Revision: D47554161

Pulled By: philIip

fbshipit-source-id: 8d4414dc6229063f81164f2d8727921c8294c92e
2023-07-20 20:31:04 -07:00
Fábio Henriques 6b62f12ce9 Add smartInsertDelete prop to TextInput component (#36111)
Summary:
This PR add support to configure the `smartInsertDeleteType` property in iOS inputs [as described here](https://developer.apple.com/documentation/uikit/uitextinputtraits/2865828-smartinsertdeletetype), making possible toggle this autoformatting behavior.

PR for the docs update: https://github.com/facebook/react-native-website/pull/3560

## Changelog:

[IOS] [ADDED] - Add `smartInsertDelete` prop to `TextInput` component

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

Test Plan:
* Added an example in the RNTester app to test this behavior in iOS.
* If the `smartInsertDelete` prop is `true` or `undefined`, the system will use the default autoformatting behavior.
* If the `smartInsertDelete` prop is `false`, the system will disable the autoformatting behavior.

https://user-images.githubusercontent.com/20051562/217862828-70c20344-d687-4824-8f5d-d591eff856ef.mp4

Reviewed By: javache

Differential Revision: D46546277

Pulled By: NickGerleman

fbshipit-source-id: 3172b14fb196876d9ee0030186540608204b96de
2023-06-08 12:06:15 -07:00
Luna Wei c0abff11b6 Precedent textContentType when set
Summary: Changelog: [iOS][Changed] - Give precedence to `textContentType` property for backwards compat as mentioned in https://github.com/facebook/react-native/issues/36229#issuecomment-1470468374

Reviewed By: necolas

Differential Revision: D44106291

fbshipit-source-id: 5702d7f171735d1abe6cfbc9ca1ad8f21751d51e
2023-03-16 08:26:53 -07:00
Ruslan Lesiutin 06cf36bcd4 refactor(rn-tester): removed usages of Slider
Summary:
# Changelog:
[Internal][Removed] - removed usages of Slider inside rn-tester package

Reviewed By: lunaleaps

Differential Revision: D40984396

fbshipit-source-id: 6c623c0972bfdac624368506401cf3200340069f
2023-01-05 06:12:47 -08:00
bang9 048194849b feat(iOS): added lineBreakStrategy attribute to Text/TextInput (#31272)
Summary:
iOS did not support the implementation of Korean word-wrap(line-break) before iOS14.
If the attribute applied, the word-wrap of Korean will works.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Added] -  Line break strategy for Text and TextInput components

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

Test Plan:
1. Test build and run on above iOS 14.
2. Test it does not affect existing text components when set default(none) strategy.
3. Test whether word-wrap works with Korean when set hangul-word strategy.

<img src="https://user-images.githubusercontent.com/26326015/112963967-d7f70c00-9182-11eb-9a34-8c758b80c219.png" width="300" height="" style="max-width:100%;">

Reviewed By: javache

Differential Revision: D39824809

Pulled By: lunaleaps

fbshipit-source-id: 42cb0385221a38c84e80d3494d1bfc1934ecf32b
2022-10-17 13:14:17 -07:00
Gabriel Donadel Dall'Agnol 73abcba40f feat: Unify TextInput autoComplete and textContentType props (#34523)
Summary:
This unifies the Android only  `autoComplete` and the iOS only `textContentType` TextInput props with the web `autoComplete` values as requested on https://github.com/facebook/react-native/issues/34424. I left the `textContentType` prop and the current supported `autoComplete` values untouched in order to avoid having a breaking change. This also updates RNTester to include test cases using the new `autoComplete` values

## 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] [Changed] - Unify TextInput autoComplete and textContentType props

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

Test Plan:
1. Open the RNTester app and navigate to the TextInput page
2. Test the `TextInput` component through the `Text Auto Complete` section

https://user-images.githubusercontent.com/11707729/187118267-3b509631-7b84-47b7-a580-567a7f5b483f.mov

Reviewed By: NickGerleman

Differential Revision: D39104545

Pulled By: cipolleschi

fbshipit-source-id: a0d4b1b9ab336854a741a9efe4a62c3da0b5c0f4
2022-09-08 10:36:23 -07:00
Gabriel Donadel Dall'Agnol de75a7a22e feat: Add readOnly prop to TextInput component (#34444)
Summary:
This adds the `readOnly` prop to  TextInput as requested on https://github.com/facebook/react-native/issues/34424 mapping the existing `editable` prop to `readOnly` so that `readOnly={false}` maps to `editable={true}` and `readOnly={true}` represents ` editable={false}`. This PR also updates the TextInputExample on the RNTest in order to facilitate the manual QA of this.

## Changelog

[General] [Added] - Add readOnly prop to TextInput component

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

Test Plan:
1. Open the RNTester app and navigate to the TextInput page
2. Test the `TextInput` component through the `Editable and Read only` section

https://user-images.githubusercontent.com/11707729/185295132-036443c8-1d5e-4567-a15e-5f1173cb0526.mov

Reviewed By: lunaleaps

Differential Revision: D38912786

Pulled By: necolas

fbshipit-source-id: faeb59ed8695732be682ec55406a2de0cb7e619a
2022-08-23 18:50:51 -07:00
Pieter Vanderwerff ee3d3c248d Add missing class annotations xplat/js
Reviewed By: SamChou19815

Differential Revision: D38373443

fbshipit-source-id: 1222c4845ebd6b72bd6f54af1a27cf8542dd883a
2022-08-03 12:43:58 -07:00
Sam Zhou 087f142cb7 Release resolved-env
Summary: Changelog: [internal]

Reviewed By: bradzacher

Differential Revision: D38054157

fbshipit-source-id: 6f859e45623168e5b17b5303adb5955b74fc3641
2022-07-21 21:17:16 -07:00
Pieter Vanderwerff e7a4dbcefc Add LTI annotations to function params in xplat/js [1/2]
Summary: Add annotations to function parameters required for Flow's Local Type Inference project. This codemod prepares the codebase to match Flow's new typechecking algorithm. The new algorithm will make Flow more reliable and predicatable.

Reviewed By: evanyeung

Differential Revision: D37353648

fbshipit-source-id: e5a0c685ced85a8ff353d578b373f836b376bb28
2022-06-22 21:36:52 -07:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Tim Yung 77ecc7ede1 JS: Format with Prettier v2.4.1 [3/n]
Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
2021-11-02 22:14:16 -07:00
Evan Yeung afe0c1daea Remove existential types from xplat/js
Summary: Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D29724915

fbshipit-source-id: 97cbeefbba2ddc2e1088dfe19db14fa545213549
2021-07-21 16:52:22 -07:00
Luna Wei fa3243ad33 Rename things in RNTester
Summary:
Changelog:
[Internal] - Rename some types and components in RNTester to support work for tertiary levels of navigation.

module = component | api
moduleExample = an example of a certain feature a module

Reviewed By: kacieb

Differential Revision: D29381875

fbshipit-source-id: c348bcbb73aaf95e85928bb14080a097e685cc78
2021-07-01 14:35:30 -07:00
Paige Sun d90253da36 iOS: Fix InputAccessoryView disappearing when inputAccessoryViewID exists
Summary:
InputAccessoryView disappears on Fabric (not Paper) when the text prop changes.

Changelog: [Fabric] [iOS] Fix InputAccessoryView disappearing when inputAccessoryViewID exists

Differential Revision: D27721549

fbshipit-source-id: 163dfcf0a8d5226453f4de356650a6ba82bee10b
2021-04-20 12:50:25 -07:00
Ankit Tiwari 1270873ed6 RNTester UI Redesign (#29685)
Summary:
This Pull request adds the UI changes to the RNTester app as discussed in the MLH Fellowship.

This list is not exhaustive.

- The initial App screen is redesigned.
  - A bottom Navbar has been added.
   - Filter pills are added.
   - The list card UI is updated.

- The example page UI is updated.

- Recently Viewed Sections are added. It shows the last 5 recently viewed components/APIs.

- Bookmarking functionality is added.

- The documentation URL is added to the example page.

- RNTester doesn't lose its state on a hard refresh (even on iOS).

<img width="373" src="https://user-images.githubusercontent.com/22813027/90530113-20346180-e192-11ea-8ef6-789fa25b402b.png" />
<img width="373" src="https://user-images.githubusercontent.com/22813027/90530112-20346180-e192-11ea-9539-706b540fcc5f.png" />
<img width="373" src="https://user-images.githubusercontent.com/22813027/90530100-1d397100-e192-11ea-8836-b88070643233.png" />
<img width="373" src="https://user-images.githubusercontent.com/22813027/90530110-1f9bcb00-e192-11ea-936b-64ee75fa4289.png" />

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

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

{F302717939}

Note: this failed **before** this diff too:

{F302745716}

Reviewed By: mdvacca, cpojer

Differential Revision: D23240434

fbshipit-source-id: 65e2766a6a097eca0e0d0fda8dadf6871e9276c2

Co-authored-by: agarwalmanya <manya18ag@gmail.com>
Co-authored-by: chirag-singhal <csinghal208@gmail.com>
Co-authored-by: Ansh Godha <ag759@cornell.edu>
Co-authored-by: Yash Kumar Verma <yk.verma2000@gmail.com>
Co-authored-by: Sanskar Jethi <sansyrox@gmail.com>
Co-authored-by: Aniketh Saha <anik220798@gmail.com>
Co-authored-by: Xtremilicious <nilarjundas@outlook.com>
Co-authored-by: Jani Evakallio <jani.evakallio@gmail.com>
2020-08-26 08:45:57 -07:00
stealthanthrax 63992c0b96 Migrating RNTester to Packages Directory (#29567)
Summary:
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
This PR aims to migrate the RNTester App to `packages` directory. But is currently, open to inspect the CI issues and resolve the merge conflicts.

Currently done
 - Working on iOS
 - Working on Android
 - Detox Tests working on iOS

Need to work on
 - Errors generated by the CI builds

[General] [Changed] - Migrated the RNTester App to the packages directory.

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

Test Plan: It runs on both ios and android for now and the detox iOS builds are working.

Reviewed By: cpojer

Differential Revision: D23034761

Pulled By: rickhanlonii

fbshipit-source-id: e04bb06e1c7ef15d340206090d1575a871b9e6f5
2020-08-19 17:57:08 -07:00