Skip to content

TypeError: Cannot read property 'style' of undefined. ViewPropTypes is deprecated. #210

Open
@shubhamk-buzzybrains

Description

@shubhamk-buzzybrains

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-slider/lib/.Slider.js.swp b/node_modules/react-native-slider/lib/.Slider.js.swp
new file mode 100644
index 0000000..1e053c6
Binary files /dev/null and b/node_modules/react-native-slider/lib/.Slider.js.swp differ
diff --git a/node_modules/react-native-slider/lib/Slider.js b/node_modules/react-native-slider/lib/Slider.js
index c640410..5b56a09 100644
--- a/node_modules/react-native-slider/lib/Slider.js
+++ b/node_modules/react-native-slider/lib/Slider.js
@@ -5,6 +5,7 @@ var _react=require("react");var _react2=_interopRequireDefault(_react);
 
 
 var _reactNative=require("react-native");
+var _reactNativePropTypes=require("deprecated-react-native-prop-types");
 
 
 
@@ -549,13 +550,13 @@ return false;}}]);return Slider;}(_react.PureComponent);Slider.propTypes={ /**
      * the slider is released).
      */onSlidingComplete:_propTypes2.default.func, /**
      * The style applied to the slider container.
-     */style:_reactNative.ViewPropTypes.style, /**
+     */style:_reactNativePropTypes.ViewPropTypes.style, /**
      * The style applied to the track.
-     */trackStyle:_reactNative.ViewPropTypes.style, /**
+     */trackStyle:_reactNativePropTypes.ViewPropTypes.style, /**
      * The style applied to the thumb.
-     */thumbStyle:_reactNative.ViewPropTypes.style, /**
+     */thumbStyle:_reactNativePropTypes.ViewPropTypes.style, /**
      * Sets an image for the thumb.
-     */thumbImage:_reactNative.Image.propTypes.source, /**
+     */thumbImage:_reactNativePropTypes.ImagePropTypes.source, /**
      * Set this to true to visually see the thumb touch rect in green.
      */debugTouchArea:_propTypes2.default.bool, /**
      * Set to true to animate values with default 'timing' animation type
diff --git a/node_modules/react-native-slider/src/Slider.js b/node_modules/react-native-slider/src/Slider.js
index 37deee5..c6408c2 100644
--- a/node_modules/react-native-slider/src/Slider.js
+++ b/node_modules/react-native-slider/src/Slider.js
@@ -11,9 +11,10 @@ import {
   PanResponder,
   View,
   Easing,
-  ViewPropTypes
+  // ViewPropTypes
 } from "react-native";
-
+// @ts-ignore
+import { ViewPropTypes, ImagePropTypes } from "deprecated-react-native-prop-types";
 import PropTypes from 'prop-types';
 
 var TRACK_SIZE = 4;
@@ -146,7 +147,8 @@ export default class Slider extends PureComponent {
     /**
      * Sets an image for the thumb.
      */
-    thumbImage: Image.propTypes.source,
+    // thumbImage: Image.propTypes.source,
+    thumbImage: ImagePropTypes.source,
 
     /**
      * Set this to true to visually see the thumb touch rect in green.

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions