React-native: InputAccessoryView not working in react-native 0.55

Created on 18 Apr 2018  路  5Comments  路  Source: facebook/react-native

None of the provided examples related to InputAccessoryView feature in 0.55 are not working.

Environment

Environment:
OS: macOS High Sierra 10.13.4
Node: 8.5.0
Yarn: 1.5.1
npm: 5.3.0
Watchman: 4.9.0
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.3 => 0.55.3

Steps to Reproduce

  • react-native init sample
  • copy and paste the code from either here or here
  • run the code

Expected Behavior

Should work and not presented with red screen

Actual Behavior

provided an error in red screen as follows

simulator screen shot - iphone 6 - 2018-04-18 at 10 40 39

Locked

Most helpful comment

I had to use:
const InputAccessoryView = require('InputAccessoryView')

Rather than:
import { InputAccessoryView} from 'react-native'

All 5 comments

Thanks for posting this! It looks like your issue may be missing some necessary information. Can you run react-native info and edit your issue to include these results under the Environment section?

Thank you for your contributions.

I had to use:
const InputAccessoryView = require('InputAccessoryView')

Rather than:
import { InputAccessoryView} from 'react-native'

Thanks. Closing this issue.

@alinz Having a workaround doesn't mean the issue is resolved. The underlying issue is that InputAccessoryView hasn't been made available as an export on the main 'react-native' module, this contradicts the documentation about how to use it.

Looks like it's fixed in master though! 馃帀

Was this page helpful?
0 / 5 - 0 ratings