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;
You should use camelCase instead of TitleCase when defining propTypes.
Do this:
CustomBackground.propTypes = {...}
instead of
CustomBackground.PropTypes = {...}