Comments (10)
I changed location
or ...rest
and everything is working now
from react-native-mock.
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.
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.
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.
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.
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.
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.
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.
I'm not actually sure. I didnt write that bit. Maybe a question for @lelandrichardson
from react-native-mock.
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)
- React v15.5.0 Deprecation Warnings HOT 3
- Need a way to reset _animationFrame count HOT 2
- Mock for i18nManager HOT 3
- Missing support for percentage widths HOT 1
- Does it support mock fetch? HOT 3
- Invariant Violation: Native module cannot be null. HOT 6
- TypeError: Cannot read property 'number' of undefined HOT 23
- Cannot find module 'react/lib/ReactComponentTreeHook' from 'ReactDebugTool.js' HOT 35
- not able to install from npm HOT 6
- Plans to support FlatList HOT 1
- Should `babel-preset-airbnb` be in `dependencies`? HOT 1
- Warning: ReactTestUtils has been moved to react-dom/test-utils HOT 1
- Issue using via package manager since build is required HOT 6
- View.PropTypes is depricated but still used here. HOT 2
- emitting event from native ios working example
- Animated Delay is not exported HOT 1
- Animated is not fully mocked
- No wiki page now HOT 1
- Cannot find module 'ReactPerf' from 'react-native.js'
- Maintainers wanted HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-mock.