react-native-transformable-image
react-native-transformable-image copied to clipboard
undefined is not an object (evaluating 'react3.default.PropTypes.bool)
After I downloaded this package and tried to use it I am geting an error. My code is in the below
import Image from 'react-native-transformable-image'
```
return (
<Image source={{uri: 'http'}} style={s.backgroundImage} />
);
me too
@uguryiilmz @zk6859
This is because PropTypes used to be defined in the React module, but has since been extracted to a separate module prop-types
Try this:
yarn add prop-types
then in a file that is required before all others:
const React = require('react');
React.PropTypes = require('prop-types');
Remeber that import
is hoisted, so in your bootstrap file, best to use all requires and no imports. For example this fixed this issue for me:
in ~/Project/index.js
// require React first
const React = require('react');
// Augment React module with PropTypes
React.PropTypes = require('prop-types');
// Now require our project files. At this point, all references to React will have React.PropTypes defined
const { AppRegistry } = require('react-native');
const { App } = require('./App');
AppRegistry.registerComponent("Project", () => App);
@chrismcleod It dosn't work this way for me.
I've done this:
import React from 'react';
import PropTypes from 'prop-types';
...
import {Image} from 'react-native-transformable-image';
...
render....:
<Image
style={styles.detailImageAnfahrt}
source={{uri: data.picture_url}}
/>
Still got the same error. Any Idea?
BTW: The fork of dflourusso
works quite well: https://github.com/dflourusso/react-native-transformable-image
Install it via: yarn add https://github.com/dflourusso/react-native-transformable-image.git
, and all just work fine.
@chrismcleod Thank you,I got it.
@xstable you need to add "import PropTypes from 'prop-types';" in /node_modules/react-native-view-transformer/library/transform/ViewTransformer.js and change React.PropTypes to PropTypes
@chrismcleod It dosn't work this way for me.
I've done this:
import React from 'react'; import PropTypes from 'prop-types'; ... import {Image} from 'react-native-transformable-image'; ... render....: <Image style={styles.detailImageAnfahrt} source={{uri: data.picture_url}} />
Still got the same error. Any Idea?
BTW: The fork of
dflourusso
works quite well: https://github.com/dflourusso/react-native-transformable-image Install it via:yarn add https://github.com/dflourusso/react-native-transformable-image.git
, and all just work fine.
the fork also works for me
@chrismcleod It dosn't work this way for me.
I've done this:
import React from 'react'; import PropTypes from 'prop-types'; ... import {Image} from 'react-native-transformable-image'; ... render....: <Image style={styles.detailImageAnfahrt} source={{uri: data.picture_url}} />
Still got the same error. Any Idea?
BTW: The fork of
dflourusso
works quite well: https://github.com/dflourusso/react-native-transformable-image Install it via:yarn add https://github.com/dflourusso/react-native-transformable-image.git
, and all just work fine.
Just got the same issue and read the source code found out it imports another lib as below : import ViewTransformer from 'react-native-view-transformer'; So you have to find this lib and refactor all React.PropTypes to PropTypes. And don't forget to import PropTypes from prop-types. Hope this will help you