Skip to content

_reactNative.renderHook is not a function #990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ggunti opened this issue Jun 6, 2022 · 4 comments
Closed

_reactNative.renderHook is not a function #990

ggunti opened this issue Jun 6, 2022 · 4 comments

Comments

@ggunti
Copy link

ggunti commented Jun 6, 2022

Describe the bug

I get TypeError: (0 , _reactNative.renderHook) is not a function error.

Expected behavior

renderHook should be a function and work properly

Steps to Reproduce

This is what my Signin.test.js file contains:

import React from 'react';
import { useFormik } from 'formik';
import { render, fireEvent, renderHook } from '@testing-library/react-native';
import Signin from '../../../../src/modules/auth/components/Signin';
import CustomIntlProvider from '../../../__helpers__/CustomIntlProvider';

describe('Signin screen component', () => {
  test('signup function is called when the button is pressed', () => {
    const formik = renderHook(() =>
      useFormik({
        initialValues: { email: '', password: '' },
        onSubmit: jest.fn(),
        validateOnChange: false,
        validateOnBlur: false,
      }),
    );
    const signUp = jest.fn();
    const forgotPassword = jest.fn();
    const { getByText } = render(<Signin formik={formik} signUp={signUp} forgotPassword={forgotPassword} />, {
      wrapper: CustomIntlProvider,
    });
    expect(signUp).toHaveBeenCalledTimes(0);
    fireEvent.press(getByText('btn.signup'));
    expect(signUp).toHaveBeenCalledTimes(1);
  });
});

Screenshots

Captură de ecran din 2022-06-06 la 16 01 30

Versions

@testing-library/react-native: ^9.1.0 => 9.1.0 
react: 17.0.2 => 17.0.2 
react-native: 0.68.2 => 0.68.2 
react-test-renderer: 17.0.2 => 17.0.2 
@AugustinLF
Copy link
Collaborator

The version of RNTL with renderHook hasn't be released yet.

@ginnymin
Copy link

Anyone have any insight on when the next release will be? I'm also waiting on renderHook

@mdjastrzebski
Copy link
Member

@thymikee is there anything blocking the release? Seems like working 'renderHook' would be useful to many people.

@thymikee
Copy link
Member

There was a breaking change right before this feature and I reverted 9.2.0 which had renderHook. I've released v10 now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants