Skip to content

ViewPropTypes error #42

Open
Open

Description

@Fr3nky88

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-dash@0.0.11 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-dash/Dash.js b/node_modules/react-native-dash/Dash.js
index 32ff1ec..7aeae52 100644
--- a/node_modules/react-native-dash/Dash.js
+++ b/node_modules/react-native-dash/Dash.js
@@ -6,7 +6,8 @@
 
 import React from 'react'
 import PropTypes from 'prop-types'
-import { View, StyleSheet, ViewPropTypes } from 'react-native'
+import { View, StyleSheet } from 'react-native'
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import MeasureMeHOC from 'react-native-measureme'
 import { getDashStyle, isStyleRow } from '../util'
 

This issue body was partially generated by patch-package.

Activity

  1. iway1 commented on Mar 1, 2023

    @iway1

    This wasn't enough for me, had to do what you did plus some extra:

    diff --git a/node_modules/react-native-dash/Dash.js b/node_modules/react-native-dash/Dash.js
    index 32ff1ec..09b6e38 100644
    --- a/node_modules/react-native-dash/Dash.js
    +++ b/node_modules/react-native-dash/Dash.js
    @@ -6,9 +6,10 @@
     
     import React from 'react'
     import PropTypes from 'prop-types'
    -import { View, StyleSheet, ViewPropTypes } from 'react-native'
    +import { View, StyleSheet,  } from 'react-native'
    +import {ViewPropTypes} from 'deprecated-react-native-prop-types'
     import MeasureMeHOC from 'react-native-measureme'
    -import { getDashStyle, isStyleRow } from '../util'
    +import { getDashStyle, isStyleRow } from './util'
     
     const Dash = props => {
     	const isRow = isStyleRow(props.style)
    diff --git a/node_modules/react-native-dash/package.json b/node_modules/react-native-dash/package.json
    index dffa1c4..f509f23 100644
    --- a/node_modules/react-native-dash/package.json
    +++ b/node_modules/react-native-dash/package.json
    @@ -2,7 +2,7 @@
       "name": "react-native-dash",
       "version": "0.0.11",
       "description": "A <Dash /> component for react-native to draw dashed or dotted lines",
    -  "main": "dist/index.js",
    +  "main": "./Dash.js",
       "scripts": {
         "test": "echo \"Error: no test specified\" && exit 1",
         "build": "babel --presets=es2015,react --plugins=transform-object-rest-spread Dash.js --out-file dist/index.js",
    
  2. JordanMRichards commented on Mar 29, 2023

    @JordanMRichards

    Here's a full diff that doesn't require you to change the main path.

    index 32ff1ec..7570679 100644
    --- a/node_modules/react-native-dash/Dash.js
    +++ b/node_modules/react-native-dash/Dash.js
    @@ -6,7 +6,8 @@
     
     import React from 'react'
     import PropTypes from 'prop-types'
    -import { View, StyleSheet, ViewPropTypes } from 'react-native'
    +import { View, StyleSheet } from 'react-native'
    +import { ViewPropTypes } from 'deprecated-react-native-prop-types'
     import MeasureMeHOC from 'react-native-measureme'
     import { getDashStyle, isStyleRow } from '../util'
     
    diff --git a/node_modules/react-native-dash/dist/index.js b/node_modules/react-native-dash/dist/index.js
    index 4034e31..f317a2d 100644
    --- a/node_modules/react-native-dash/dist/index.js
    +++ b/node_modules/react-native-dash/dist/index.js
    @@ -14,6 +14,8 @@ var _propTypes2 = _interopRequireDefault(_propTypes);
     
     var _reactNative = require('react-native');
     
    +var _deprecatedReactNativePropTypes = require('deprecated-react-native-prop-types');
    +
     var _reactNativeMeasureme = require('react-native-measureme');
     
     var _reactNativeMeasureme2 = _interopRequireDefault(_reactNativeMeasureme);
    @@ -22,6 +24,12 @@ var _util = require('../util');
     
     function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     
    +/*
    +* Draws fully customizable dashed lines vertically or horizontally
    +*
    +* @providesModule Dash
    +*/
    +
     var Dash = function Dash(props) {
     	var isRow = (0, _util.isStyleRow)(props.style);
     	var length = isRow ? props.width : props.height;
    @@ -42,11 +50,7 @@ var Dash = function Dash(props) {
     		},
     		dash
     	);
    -}; /*
    -   * Draws fully customizable dashed lines vertically or horizontally
    -   *
    -   * @providesModule Dash
    -   */
    +};
     
     var styles = _reactNative.StyleSheet.create({
     	row: { flexDirection: 'row' },
    @@ -54,12 +58,12 @@ var styles = _reactNative.StyleSheet.create({
     });
     
     Dash.propTypes = {
    -	style: _reactNative.ViewPropTypes.style,
    +	style: _deprecatedReactNativePropTypes.ViewPropTypes.style,
     	dashGap: _propTypes2.default.number.isRequired,
     	dashLength: _propTypes2.default.number.isRequired,
     	dashThickness: _propTypes2.default.number.isRequired,
     	dashColor: _propTypes2.default.string,
    -	dashStyle: _reactNative.ViewPropTypes.style
    +	dashStyle: _deprecatedReactNativePropTypes.ViewPropTypes.style
     };
     
     Dash.defaultProps = {
  3. vasylnahuliak commented on Aug 8, 2023

    @vasylnahuliak

    Put this file into the patches folder

    react-native-dash+0.0.11.patch

    Code from file
    diff --git a/node_modules/react-native-dash/Dash.js b/node_modules/react-native-dash/Dash.js
    index 32ff1ec..7570679 100644
    --- a/node_modules/react-native-dash/Dash.js
    +++ b/node_modules/react-native-dash/Dash.js
    @@ -6,7 +6,8 @@
    
    import React from 'react'
    import PropTypes from 'prop-types'
    -import { View, StyleSheet, ViewPropTypes } from 'react-native'
    +import { View, StyleSheet } from 'react-native'
    +import { ViewPropTypes } from 'deprecated-react-native-prop-types'
    import MeasureMeHOC from 'react-native-measureme'
    import { getDashStyle, isStyleRow } from '../util'
    
    diff --git a/node_modules/react-native-dash/dist/index.js b/node_modules/react-native-dash/dist/index.js
    index 4034e31..d2b1cdd 100644
    --- a/node_modules/react-native-dash/dist/index.js
    +++ b/node_modules/react-native-dash/dist/index.js
    @@ -14,6 +14,8 @@ var _propTypes2 = _interopRequireDefault(_propTypes);
    
    var _reactNative = require('react-native');
    
    +var _deprecatedReactNativePropTypes = require('deprecated-react-native-prop-types');
    +
    var _reactNativeMeasureme = require('react-native-measureme');
    
    var _reactNativeMeasureme2 = _interopRequireDefault(_reactNativeMeasureme);
    @@ -54,12 +56,12 @@ var styles = _reactNative.StyleSheet.create({
    });
    
    Dash.propTypes = {
    -	style: _reactNative.ViewPropTypes.style,
    +	style: _deprecatedReactNativePropTypes.ViewPropTypes.style,
      dashGap: _propTypes2.default.number.isRequired,
      dashLength: _propTypes2.default.number.isRequired,
      dashThickness: _propTypes2.default.number.isRequired,
      dashColor: _propTypes2.default.string,
    -	dashStyle: _reactNative.ViewPropTypes.style
    +	dashStyle: _deprecatedReactNativePropTypes.ViewPropTypes.style
    };
    
    Dash.defaultProps = {
  4. rahulthakurhimachali commented on Feb 4, 2026

    @rahulthakurhimachali

    For anyone who’d prefer to avoid patch-package and deprecated ViewPropTypes, there’s also a maintained alternative like react-native-dashed-view that works out of the box with newer React Native versions.

    https://www.npmjs.com/package/react-native-dashed-view

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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