Skip to content

propTypes is not defined #16288

@milad1367

Description

@milad1367

i want use proptypes in my react native- redux projects . but i got the error "propTypes is not defined.

in this code:

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';



class AntiHack extends React.Component {
  render() {
    return <div>{this.props.steps}</div>;
  }
}

AntiHack.PropTypes = {

    steps: propTypes.number.isRequired,
    
  }



  export default AntiHack

function degreesToRadians(degrees) {
    return degrees * Math.PI / 180;
  }

  
  function distanceInKmBetweenEarthCoordinates(lat1, lon1, lat2, lon2) {
    var earthRadiusKm = 6371;
  
    var dLat = degreesToRadians(lat2-lat1);
    var dLon = degreesToRadians(lon2-lon1);
  
    lat1 = degreesToRadians(lat1);
    lat2 = degreesToRadians(lat2);
  
    var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
            Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); 
    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
    return earthRadiusKm * c;
  }

console:

and package.json:

{
“name”: “sirin”,
“version”: “0.1.0”,
“private”: true,
“devDependencies”: {
“jest-expo”: “~20.0.0”,
“react-native-scripts”: “1.2.1”,
“react-test-renderer”: “16.0.0-alpha.12”
},
“main”: “./node_modules/react-native-scripts/build/bin/crna-entry.js”,
“scripts”: {
“start”: “react-native-scripts start”,
“eject”: “react-native-scripts eject”,
“android”: “react-native-scripts android”,
“ios”: “react-native-scripts ios”,
“test”: “node node_modules/jest/bin/jest.js --watch”
},
“jest”: {
“preset”: “jest-expo”
},
“dependencies”: {
“art”: “^0.10.1”,
“d3”: “^4.10.2”,
“d3-array”: “^1.2.1”,
“d3-path”: “^1.0.5”,
“d3-shape”: “^1.2.0”,
“expo”: “^20.1.3”,
“prop-types”: “^15.5.10”,
“react”: “16.0.0-alpha.12”,
“react-native”: “^0.47.0”,
“react-native-chart”: “^1.0.8-beta”,
“react-native-charts-wrapper”: “^0.2.10”,
“react-native-circular-progress”: “^0.0.8”,
“react-native-customisable-switch”: “^0.1.0”,
“react-native-datepicker”: “^1.6.0”,
“react-native-device-info”: “^0.11.0”,
“react-native-drawer”: “^2.5.0”,
“react-native-elements”: “^0.16.0”,
“react-native-filesystem”: “^0.1.0”,
“react-native-installed-apps”: “0.0.6”,
“react-native-keyboard-aware-scroll-view”: “^0.3.0”,
“react-native-modal”: “^3.1.0”,
“react-native-pathjs-charts”: “0.0.31”,
“react-native-progress”: “^3.4.0”,
“react-native-responsive-image”: “^2.1.0”,
“react-native-shadow”: “^1.2.1”,
“react-native-side-menu”: “^1.0.2”,
“react-native-snap-carousel”: “^3.2.2”,
“react-native-svg”: “^5.4.1”,
“react-native-svg-image”: “^2.0.0”,
“react-native-svg-uri”: “^1.2.1”,
“react-native-switch”: “^1.1.0”,
“react-native-vector-icons”: “^4.3.0”,
“react-navigation”: “^1.0.0-beta.11”
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions