Skip to content

NativeBase form inputs with floating labels can't be found #161

@AbigailMcP

Description

@AbigailMcP

As discovered in issue #156 , adding the floatingLabel prop to a Native Base form <Item> makes the enclosed <Input> field undiscoverable by Cavy.

How to replicate

The component:

import { Form, Item, Label, Input } from 'native-base';
import { hook } from 'cavy';

class AuthScreen extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      someValue: '',
    };
  }

  render() {
    return (
      <Form>
        <Item floatingLabel>
          <Label>Some Input</Label>
          <Input
            ref={this.props.generateTestHook('NativeBaseTextInput')}
            onChangeText={(someValue) => this.setState({ someValue })}
          />
        </Item>
      </Form>
    );
  }
}
export default hook(AuthScreen);

The failing test:

export default function(spec) {

  spec.describe('Logging in', function() {

    spec.it('works', async function() {
      await spec.findComponent('NativeBaseTextInput');
      // findComponent times out
    }
  }
}

See comment posted by @PoetiCode for a starter: #156 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions