React-native: [android] .focus() causes "illegal number of arguments for 'updateHotspot' command." error.

Created on 15 Oct 2019  路  7Comments  路  Source: facebook/react-native

On Android when i try to apply focus to a TouchableOpacity element i greeted with an error
illegal number of arguments for 'updateHotspot' command.

export class Test extends Component {
  render() {
    return (
        <>
            <TouchableOpacity ref={(ref) => (this._ref = ref)} onFocus={() => console.log("I HAVE BEEN FOCUSSED")}>
                <Text>Should get focus</Text>
            </TouchableOpacity>


            <TouchableOpacity onPress={() => this._ref.focus()}>
                <Text>Should trigger focus</Text>
            </TouchableOpacity>
        </>
    )
  }
}

please note that in my actuall code i DO check if this._ref exists first before calling focus etc.

React Native version:

info 
 System:
    OS: macOS Mojave 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
    Memory: 23.23 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.10.0 - /usr/local/bin/node
    npm: 6.11.3 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-25 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.0/11A420a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Repoduce

  1. create a ref from a TouchableOpacity on Android.
  2. try to focus to that ref.
  3. observe error.

Expected
the TouchableOpacity to be focussed and onFocus to be called..

Bug Android Stale

Most helpful comment

This issue is still ongoing.

All 7 comments

It looks like you are using an older version of React Native. Please update to the latest release, v0.61 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@react-native-bot have tried the same scenario on react-native 0.61.2 and get the same error.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Still relevant.

This issue is still ongoing.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings