obipawan / react-native-dash

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

this package was not compatible with react native0.74.3 version,,earlier was receiving related to prop-types error #43

Open priyankagupta23pg opened 3 months ago

priyankagupta23pg commented 3 months 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..d923319 100644
--- a/node_modules/react-native-dash/Dash.js
+++ b/node_modules/react-native-dash/Dash.js
@@ -5,8 +5,8 @@
 */

 import React from 'react'
-import PropTypes from 'prop-types'
-import { View, StyleSheet, ViewPropTypes } from 'react-native'
+
+import { View, StyleSheet,  } from 'react-native'
 import MeasureMeHOC from 'react-native-measureme'
 import { getDashStyle, isStyleRow } from '../util'

@@ -42,14 +42,7 @@ const styles = StyleSheet.create({
    column: { flexDirection: 'column' },
 })

-Dash.propTypes = {
-   style: ViewPropTypes.style,
-   dashGap: PropTypes.number.isRequired,
-   dashLength: PropTypes.number.isRequired,
-   dashThickness: PropTypes.number.isRequired,
-   dashColor: PropTypes.string,
-   dashStyle: ViewPropTypes.style,
-}
+

 Dash.defaultProps = {
    dashGap: 2,
diff --git a/node_modules/react-native-dash/dist/index.js b/node_modules/react-native-dash/dist/index.js
index 4034e31..c80b214 100644
--- a/node_modules/react-native-dash/dist/index.js
+++ b/node_modules/react-native-dash/dist/index.js
@@ -8,9 +8,7 @@ var _react = require('react');

 var _react2 = _interopRequireDefault(_react);

-var _propTypes = require('prop-types');

-var _propTypes2 = _interopRequireDefault(_propTypes);

 var _reactNative = require('react-native');

@@ -19,6 +17,7 @@ var _reactNativeMeasureme = require('react-native-measureme');
 var _reactNativeMeasureme2 = _interopRequireDefault(_reactNativeMeasureme);

 var _util = require('../util');
+const { any } = require('prop-types');

 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -54,12 +53,12 @@ var styles = _reactNative.StyleSheet.create({
 });

 Dash.propTypes = {
-   style: _reactNative.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
+   style: any,
+   dashGap: any,
+   dashLength: any,
+   dashThickness: any,
+   dashColor: any,
+   dashStyle: any
 };

 Dash.defaultProps = {
diff --git a/node_modules/react-native-dash/index.d.ts b/node_modules/react-native-dash/index.d.ts
index a234223..c703c8f 100644
--- a/node_modules/react-native-dash/index.d.ts
+++ b/node_modules/react-native-dash/index.d.ts
@@ -3,15 +3,14 @@
 // Definitions by: alex-blair <https://github.com/alex-blair>

 import React from 'react';
-import { ViewStyle, StyleProp } from 'react-native';

 export interface DashProps {
   dashGap: number;
   dashLength: number;
   dashThickness: number;
-  style?: StyleProp<ViewStyle>;
+  style?: any;
   dashColor?: string;
-  dashStyle?: StyleProp<ViewStyle>;
+  dashStyle?: any;
 }

 export default class Dash extends React.Component<DashProps> {}

This issue body was partially generated by patch-package.

FantWings commented 2 months ago

thanks for your work! it solved my problems, but i got a console warning:

Dash: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. Warning: %s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.%s Dash