Issue
Someone can explain why I get this error when I import PropTypes :
Component CustomBackground declared PropTypes
instead of propTypes
. Did you misspell the property assignment?
CustomBackground.js :
import PropTypes from 'prop-types';
const CustomBackground=({children})=>(
<ImageBackground source={background} style={styles.imagebackground}>
{children}
</ImageBackground>
)
CustomBackground.PropTypes={
children:PropTypes.element.isRequired,
}
export default CustomBackground;
Solution
You should use camelCase instead of TitleCase when defining propTypes.
Do this:
CustomBackground.propTypes = {...}
instead of
CustomBackground.PropTypes = {...}
Answered By - gutterball
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.