Skip to content
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

PickerIOS and DatePickerIOs generate warnings about refs when mocked by jest #16045

Closed
jmoutte opened this issue Sep 21, 2017 · 1 comment
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jmoutte
Copy link
Contributor

jmoutte commented Sep 21, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 7.7.2
Yarn: Not Found
npm: 4.1.2
Watchman: 4.7.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: 2.3 AI-162.3934792

Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: 0.48.3 => 0.48.3

Steps to Reproduce

  1. Run the attached test with jest

Expected Behavior

No warning should be generated.

Actual Behavior

Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.
    
    Check the render method of `PickerIOS`.
        in Unknown (created by PickerIOS)
        in View (created by View)
        in View (created by PickerIOS)
        in PickerIOS

Reproducible Demo

import React from 'react';
import { PickerIOS } from 'react-native';
import renderer from 'react-test-renderer';

describe('StateLessMocks', () => {
  it('generates a warning', () => {
    const tree = renderer.create(<PickerIOS />).toJSON();
    expect(tree).toMatchSnapshot();
  });
});
@davidbq
Copy link

davidbq commented Sep 28, 2017

Facing the same problem here

@facebook facebook locked as resolved and limited conversation to collaborators Oct 10, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants