Q:

React native + Appium, how to find an element

I'm trying (for too long...) to get appium working with react native, but can't seem to find any element.
I'm using an emulator, Nexus 6, android 6.0, ubuntu, appium 1.6.0, RN 0.39.2.
I'm trying to get the most basic example to work:
// foo.js
render () {
  return (
    <Text>foo</Text>
  )
}

// spec.js
// ... some setup ...
      driver
        .elementByAccessibilityId('foo')
          .click()

and I'm getting...
      1) should be able to find 'Buttons' and click it

  0 passing (13s)
  1 failing

  1) Android find and click should be able to find 'Buttons' and click it:
     Error: [elementByAccessibilityId("foo")] Error response status: 7, , NoSuchElement - An element could not be located on the page using the given search parameters. Selenium error: An element could not be located on the page using the given search parameters.

I also tried setting:
<Text accessible accessibilityLabel={ 'foo' }>foo</Text>
same response ...
any ideas?

A:

I ended up using this solution:
<Text accessibilityLabel={ 'FOO' } testID={ 'FOO' }>some stuff here</Text>

and then in the test:
driver
  .elementByAccessibilityId('FOO')

Credit goes to @jonesdar for pointing that out here

