obipawan / react-native-dash

A super simple <Dash /> component for react-native to draw customisable dashed lines
176 stars 64 forks source link

ViewPropTypes error #42

Open Fr3nky88 opened 1 year ago

Fr3nky88 commented 1 year ago

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.

iway1 commented 1 year ago

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",
JordanMRichards commented 1 year ago

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 = {
vasylnahuliak commented 1 year ago

Put this file into the patches folder

react-native-dash+0.0.11.patch

Code from file ```javascript 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 = { ```