JackDanielsAndCode / react-native-multi-slider

Pure JS react native slider component with one or two markers.
MIT License
150 stars 96 forks source link

undefined is not an object (evaluating 'PropTypes.bool') #57

Open elbuenrobin opened 5 years ago

elbuenrobin commented 5 years ago

Hi I have this code but I recibe this error "undefined is not an object (evaluating 'PropTypes.bool')"

import React, { Component } from 'react';
Import Slider from 'react-native-multi-slider';
render (){
    const
      {
        distanceRange,
      } = this.state;
return(){
 <Slider
          style={{ marginLeft: 15, marginRight: 15 }}
          min={2}
          max={120}
          step={1}
          values={distanceRange}
          onValuesChange={val => this.setState({ distanceRange: val })}
        />
}}
vygandas commented 5 years ago

+1

jamesdacombe17 commented 5 years ago

I am getting a similar thing, undefined is not an object (evaluating '_react2.PropTypes.bool')

remigallego commented 5 years ago

If you are using a newer version of React, PropTypes are deprecated and you need to import them from "prop-types" instead. I fixed this by running jscodeshift transforms to the library's folder:

jscodeshift -t ~/dev/react-codemod/transforms/class.js node_modules/react-native-multi-slider
jscodeshift -t ~/dev/react-codemod/transforms/React-PropTypes-to-prop-types.js node_modules/react-native-multi-slider
jscodeshift -t ~/dev/react-codemod/transforms/ReactNative-View-propTypes.js node_modules/react-native-multi-slider

You can hook them up to your postinstall script.

egoserg commented 2 years ago

Author can you remove your package? This package does not work. Your error weighs in since 2018 and you haven't fixed it