pixielabs / cavy

An integration test framework for React Native.

Home Page:https://cavy.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: Can't find variable component on v.2.2.0

keith-kurak opened this issue · comments

I upgraded to version 2.2.0 yesterday, and got the error "ReferenceError: Can't find variable component" when using an old-style ref with generateTestHook(), like:

<TextInput
            ref={this.props.generateTestHook('LoginForm.Password', c => {
              this._passwordTextbox = c;
            })}
</TextInput>

Seems like generateTestHook.js:35 might be the culprit, since it's trying to access a component variable that isn't one of the function arguments:

// Either calls the ref generating function or returns the ref attribute.
  function preservedRef(ref) {
    if (typeof ref == 'function') return ref(component);
    return ref;
  }

When I downgraded to 2.1.1, everything was fine, again.

Thanks!

Uhoh! Thanks for the report @llamaluvr, I'm getting right on this and we'll release 2.2.1 ASAP.