Open ToniChaz opened 7 years ago
That's a very strange error, possibly an issue to do with proptypes? Are your components using the number
proptype validator?
Also, possibly unrelated, you seem to be using both jest
, and a far newer version of react-native
than react-native-mock
supports. This may also be a factor in this issue.
Hi, i don´t use any proptypes validator in my components.
You are right, i think is relationated with this
Note: React.PropTypes is deprecated as of React v15.5. Please use the prop-types library instead.
What versions of jest and react-native supports react-native-mock?
Documentation on support is unfortunately kinda lacking.
I dont have support for any version of jest
, as it has a builtin mock of react-native
, however there's theoretically nothing stopping it working. The latest version of react-native
i've tested this on is 0.42
, however i'm planning to add better support for current a newer versions soon
Ok, thank you very much, I'll wait for the new version.
@ToniChaz you can test out #140 by installing the latest commit from github: npm install --save-dev github:RealOrangeOne/react-native-mock#master
According to me it is because the package still imports the propTypes from react.
It should use the package prop-types
to get the propTypes.
Any expectations when it will be fixed?
Has anyone figured out a way around this besides downgrading react/react-native?
Any updated here?
you need react < 16, one fix would be to fork it and set dependency of react < 16. If your project is on react >= 16 I think that's what you'd have to do.
@RealOrangeOne you should consider this
It should use the package prop-types to get the propTypes.
@RealOrangeOne Any fix for this issue ? Im using latest RN v51 & React 16.
I have a pull request that fixes this https://github.com/RealOrangeOne/react-native-mock/pull/158
Once you have the updated package, you'll need to go into node_modules/react-native-mock and run npm run build
before it will compile.
I have the same issue 😕
@gabrielrotbart i'm trying to install your version of react-native-mock
but ran into duplicated module error with the dependencies of the mock.
The name `setupDevtools` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or blacklist files until there remains only one of these:
* `/<project_root>/node_modules/react-native-mock/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/<project_root>/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
at ModuleMap._assertNoDuplicates (node_modules/jest-haste-map/build/module_map.js:128:11)
at Object.<anonymous> (node_modules/react-native/jest/setup.js:30:1)
Am I missing something here?
Also, when will this be fixed officially in here :(
I haven't encountered that, sorry. I'm away from my laptop on leave for two weeks so will have to have a look at it then. Hopefully the rewrite branch is ready by then anyway
Any updates on this?
you miss import PropTypes from 'prop-types';
Encountered this just now and I am using flow. Could it be an issue with flow, I have the latest version of Flow, Jest and RN
@Quadriphobs1
No, this library is no longer maintained and it doesn't work with React 15.5 and up because it uses deprecated React features.
I recommend checking out https://github.com/mfncooper/mockery.
Thanks @jdzak
@Quadriphobs1
Actually, I just realized mockery is no longer maintained. Jest has mocking functionality built in, that's probably worth checking out. https://jestjs.io/docs/en/manual-mocks
React.PropTypes is deprecated as of React v15.5. Please use the prop-types library instead
use the following
import PropTypes from 'prop-types';
Note: instead of using React.PropTypes.number use simply PropTypes.number
I have an error with all my Views components
My deps: