0

I am using the newest version of NPM, the version of exp is 57.0.0. When I add to my code in render method, I get an error "undefined is not an object (evaluating '_react2.proptypes.string')". Without adding everything works perfect.

Both Prop-Types and React-native-prompt are installed.

I have already tried to write import Prompt from 'prop-types'; instead of writing import Prompt from 'react-native-prompt'; but then I am getting the error that hasn't been found in Prop-Types.

Any suggestions on how to fix it? Thank you

1
  • Can you provide some of your code samples? Also, you say you use react-native-prompt, is is some third party lib or the builtin RNT component? Commented Oct 22, 2018 at 12:02

1 Answer 1

1

PropTypes moved into separate package. Use prop-types package.

react-native-prompt use outdated style of prop-types so you have to manually solve it.

go to /node-modules/react-native-prompt and edit main files in this way:

import { PropTypes } from 'react'

the above line is incorrect and must be like this:

import PropTypes from 'prop-types'

You have to import PropTypes in this way.

More info here.

Note: React.PropTypes has moved into a different package since React v15.5. Please use the prop-types library instead. We provide a codemod script to automate the conversion.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! That helped me :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.