Satish Mavani
Satish Mavani

Reputation: 5075

Undefined is not an object(evaluating 'a.PropTypes.string') in ReactNative while building an android and ios app

There are many similar kinds of questions are available there, But mine is still different because the most of the questions have given the solution like use:

import PropTypes from 'prop-types';

as a separate package and not from:

import React, { Component, PropTypes } from 'react';

Which I am already doing since I have started my project. Still,I am facing the same issue. Below is one of the place in my code where I am using proptypes:

ListItem.propTypes = {
  imageUrl: PropTypes.number,
  itemTitle: PropTypes.string,
  careerText: PropTypes.string,
  distanceText: PropTypes.number,
  imageWidth: PropTypes.number,
  imageHeight: PropTypes.number,
  onPressButton: PropTypes.func,
  isSpecial: PropTypes.bool,
};

Any help will be appreciated, thanks in advance.

Upvotes: 1

Views: 101

Answers (1)

Sandip Nirmal
Sandip Nirmal

Reputation: 2459

I was facing some problem using react-native version 0.50. You can try upgrading react and react-native versions. I think this should fix the problem for you.

Upvotes: 1

Related Questions