Giter VIP home page Giter VIP logo

Comments (10)

evollu avatar evollu commented on August 14, 2024 3

I changed location or ...rest and everything is working now

from react-native-mock.

jasonfma avatar jasonfma commented on August 14, 2024 2

I think the culprit is in StyleSheetPropType.js


function StyleSheetPropType(shape) {
  const shapePropType = PropTypes.shape(shape);   <-------- here
  return function (props, propName, componentName, location) {
    let newProps = props;
    if (props[propName]) {
      // Just make a dummy prop object with only the flattened style
      newProps = {};
      newProps[propName] = flattenStyle(props[propName]);
    }
    return shapePropType(newProps, propName, componentName, location);  <-------- used here
  };
}

This seems like it's the part that's violating the new rule https://facebook.github.io/react/warnings/dont-call-proptypes.html#dont-call-proptypes-directly

var apiShape = React.PropTypes.shape({
  body: React.PropTypes.object,
  statusCode: React.PropTypes.number.isRequired
}).isRequired;

// Not supported!
var error = apiShape(json, 'response');

I think similarly in TransformPropTypes.js.

I'd love to help with a fix but I'm not sure what's actually going on here and what the best remediation would be.

from react-native-mock.

jasonfma avatar jasonfma commented on August 14, 2024 1

Any update on an expected release @RealOrangeOne ? My xcode just automatically updated and I need this to upgrade to RN 0.33. If not I can just install the old xcode. Thanks :)

from react-native-mock.

RealOrangeOne avatar RealOrangeOne commented on August 14, 2024

what component are you trying to test. Were you able to find examples in our library that call them or is it in some of our dependencies.

from react-native-mock.

jasonfma avatar jasonfma commented on August 14, 2024

This warning is new with RN 0.32.0 - specifically React 15.3.0.

Here's a sample test that is only using a View:

import React from 'react';
import {
  View,
} from 'react-native';
import { expect } from 'chai';
import { shallow } from 'enzyme';

describe.only('test spec', () => {
  it('should work', () => {
    const wrapper = shallow(<View style={{ height: 30 }} />);
    expect(wrapper).to.exist;
  });
});

with warning


Warning: You are manually calling a React.PropTypes validation function for the `style` prop on `View`. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.
Warning: You are manually calling a React.PropTypes validation function for the `transformMatrix` prop on `View`. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.

from react-native-mock.

RealOrangeOne avatar RealOrangeOne commented on August 14, 2024

I'm not sure what the problem is with that. The View component doesnt do anything. I fear it's in one of our dependancies

from react-native-mock.

RealOrangeOne avatar RealOrangeOne commented on August 14, 2024

ah, good to know. Yes that does look like the culprit. No, i'm not sure what the best solution is either. I think we may need to look at how proptypes are generated in the first place, and any other libraries that define custom ones to work out the nicest way of doing this

from react-native-mock.

jasonfma avatar jasonfma commented on August 14, 2024

Do we need to do whatever custom proptype stuff we're doing here? What was the original intent behind flattening the styles here?

from react-native-mock.

RealOrangeOne avatar RealOrangeOne commented on August 14, 2024

I'm not actually sure. I didnt write that bit. Maybe a question for @lelandrichardson

from react-native-mock.

jasonfma avatar jasonfma commented on August 14, 2024

This does prevent us from upgrading to the latest RN since we prefer to treat all warnings (especially proptype warnings) as errors in our tests. I'd be happy to dedicate some time to this to figure out a solution and submit a PR. @lelandrichardson can you provide more context into why the styles and transform proptype mocks were implemented this way?

from react-native-mock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.