facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.09k stars 24.19k forks source link

TextInput contextMenuHidden does not hide autofill #43452

Open believer opened 6 months ago

believer commented 6 months ago

Description

In iOS 17 a new "Autofill" option was added to the context menu for <TextInput>. This option is not hidden when we use contextMenuHidden. We've tried using a combination of other props, such as autoComplete, keyboardType, and textContentType, but it always persists.

It's possible to hide it by adding pointerEvents="none" (or box-only), but we want to be able to interact with the field.

Steps to reproduce

  1. Add <TextInput contextMenuHidden>
  2. Focus field
  3. Press again in field, autofill is displayed

React Native Version

0.73.6

Affected Platforms

Runtime - iOS

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: macOS 14.3.1
  CPU: (10) arm64 Apple M2 Pro
  Memory: 94.11 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.2
    path: ~/Library/Caches/fnm_multishells/18549_1710269055352/bin/node
  Yarn:
    version: 1.22.19
    path: ~/code/seb/Spark-blackbird/apps/blackbird/node_modules/.bin/yarn
  npm:
    version: 9.8.1
    path: ~/Library/Caches/fnm_multishells/18549_1710269055352/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/rickard/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK:
    API Levels:
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11255304
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/rickard/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: "*"
  react-native:
    installed: 0.73.6
    wanted: "*"
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

None

Reproducer

https://snack.expo.dev/@believer/react-native-autofill-tooltip

Screenshots and Videos

Without contextMenuHidden With contextMenuHidden
IMG_1158 IMG_1159
jakex7 commented 5 months ago

Hello everyone, I've decided to try to fix this issue and have submitted my solution in Pull Request #43468 I would appreciate any feedback or suggestions on that 😃