sidevesh / react-native-snackbar-component

A snackbar component for Android and iOS
MIT License
186 stars 75 forks source link

Fix ViewPropTypes #81

Open amornpic opened 1 year ago

amornpic commented 1 year ago

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch react-native-snackbar-component@1.1.12 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-snackbar-component/index.js b/node_modules/react-native-snackbar-component/index.js
index ae1e313..96d4fc5 100644
--- a/node_modules/react-native-snackbar-component/index.js
+++ b/node_modules/react-native-snackbar-component/index.js
@@ -5,8 +5,8 @@ import {
   Text,
   Animated,
   Easing,
-  ViewPropTypes,
 } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import { Touchable } from './src';

 /* Values are from https://material.io/guidelines/motion/duration-easing.html#duration-easing-dynamic-durations */
diff --git a/node_modules/react-native-snackbar-component/src/Touchable.js b/node_modules/react-native-snackbar-component/src/Touchable.js
index 0b08723..f5a6bbc 100644
--- a/node_modules/react-native-snackbar-component/src/Touchable.js
+++ b/node_modules/react-native-snackbar-component/src/Touchable.js
@@ -4,8 +4,8 @@ import {
   View,
   TouchableOpacity,
   TouchableNativeFeedback,
-  ViewPropTypes,
 } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import {
   IS_ANDROID,
   IS_LT_LOLLIPOP,

This issue body was partially generated by patch-package.

andres-torres-marroquin commented 1 year ago

Definitely this fixes the issue

JapeshFlyFin commented 1 year ago

Hey guys any plans to implement this fix?

Liquid2Sky commented 1 year ago

The patch fixes the problem only partially, there are more deprecated PropTypes in use.

diff --git a/node_modules/react-native-snackbar-component/index.js b/node_modules/react-native-snackbar-component/index.js
index ae1e313..7cc710f 100644
--- a/node_modules/react-native-snackbar-component/index.js
+++ b/node_modules/react-native-snackbar-component/index.js
@@ -2,11 +2,10 @@ import React, { Component } from 'react';
 import PropTypes from 'prop-types';
 import {
   StyleSheet,
-  Text,
   Animated,
   Easing,
-  ViewPropTypes,
 } from 'react-native';
+import { ViewPropTypes, TextPropTypes } from 'deprecated-react-native-prop-types';
 import { Touchable } from './src';

 /* Values are from https://material.io/guidelines/motion/duration-easing.html#duration-easing-dynamic-durations */
@@ -192,8 +191,8 @@ SnackbarComponent.propTypes = {
   // eslint-disable-next-line react/no-unused-prop-types
   autoHidingTime: PropTypes.number, // How long (in milliseconds) the snack bar will be hidden.
   containerStyle: ViewPropTypes.style,
-  messageStyle: Text.propTypes.style,
-  actionStyle: Text.propTypes.style,
+  messageStyle: TextPropTypes.style,
+  actionStyle: TextPropTypes.style,
 };

 const styles = StyleSheet.create({
diff --git a/node_modules/react-native-snackbar-component/src/Touchable.js b/node_modules/react-native-snackbar-component/src/Touchable.js
index 0b08723..f5a6bbc 100644
--- a/node_modules/react-native-snackbar-component/src/Touchable.js
+++ b/node_modules/react-native-snackbar-component/src/Touchable.js
@@ -4,8 +4,8 @@ import {
   View,
   TouchableOpacity,
   TouchableNativeFeedback,
-  ViewPropTypes,
 } from 'react-native';
+import { ViewPropTypes } from 'deprecated-react-native-prop-types';
 import {
   IS_ANDROID,
   IS_LT_LOLLIPOP,