facebook / react-native

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

iOS Speech-to-text clears input after pressing the space during speech #38747

Open gurbela opened 11 months ago

gurbela commented 11 months ago

Description

When using TextInput with multiline=true, after using speech-to-text to input text, if you enter Space, The speech-to-text inputted text is deleting. This flow works well when we use a 1-line TextInput

React Native Version

0.71.11

Output of npx react-native info

System:
    OS: macOS 13.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 5.38 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 14.21.3 - ~/.nvm/versions/node/v14.21.3/bin/node
    Yarn: 1.22.19 - ~/Code/node_modules/.bin/yarn
    npm: 6.14.18 - ~/.nvm/versions/node/v14.21.3/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK:
      API Levels: 21, 23, 28, 29, 30, 31, 32, 33
      Build Tools: 21.1.2, 28.0.0, 29.0.2, 30.0.0, 30.0.1, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
      System Images: android-28 | ARM 64 v8a, android-31 | ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-33 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a
      Android NDK: 24.0.8215888
  IDEs:
    Android Studio: 2022.1 AI-221.6008.13.2211.9619390
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.19 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.11 => 0.71.11

Steps to reproduce

  1. Run any RN app with a TextInput
  2. Tap the text input
  3. On the iOS keyboard, tap the microphone icon
  4. Say something
  5. Tap the Space button on the Keyboard

Snack, screenshot, or link to a repository

https://github.com/facebook/react-native/assets/19289032/7cb29d12-15ba-41de-8358-f7288c923f8b

github-actions[bot] commented 11 months ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
github-actions[bot] commented 11 months ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.71.12. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
cortinico commented 11 months ago

Thanks for the video @gurbela could you put the code in a Snack or a repo?

gurbela commented 11 months ago

@cortinico thanks for your attention, here is a sample code: https://snack.expo.dev/b0glHl3BL

gurbela commented 10 months ago

any news?

cortinico commented 10 months ago

any news?

This looks like a bug. We're happy to review a PR to address it

bekatom commented 9 months ago

@cortinico, Any updates on this, or any ideas how to fix this?

Samwell1996 commented 8 months ago

problem is when the user onPress on a keyboard to stop speech audio, text is immediately cleared.

there is console.log onChange func from react-native textInput, where they are get native.text in callback

LOG {"currentText": ""} LOG {"currentText": ""} LOG {"currentText": " 123"} LOG {"currentText": " 1234"} LOG {"currentText": " 12345"} LOG {"currentText": " 123456"} LOG {"currentText": " 1234567"} LOG {"currentText": " 12345678"} LOG {"currentText": " 12345678"} LOG {"currentText": " 12345678"} LOG {"currentText": " 123456789 "} LOG {"currentText": " "} LOG {"currentText": " "} LOG {"currentText": " 123456789"}

also we getting error <_UIKBFeedbackGenerator: 0x600002d4b000>: Couldn't update haptics muting for dictation audio recording. No engine.

In my opinion, the instance of the class is deleted before the audio recording itself is closed

DenisPostnikov commented 5 months ago

The same issue. Any updates?