Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with React v18.2.0 #8

Open
walker007 opened this issue May 29, 2024 · 1 comment
Open

Issue with React v18.2.0 #8

walker007 opened this issue May 29, 2024 · 1 comment

Comments

@walker007
Copy link

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/rn-slide-button/src/components/SlideButton.tsx b/node_modules/rn-slide-button/src/components/SlideButton.tsx
index 20d55f6..e646adf 100644
--- a/node_modules/rn-slide-button/src/components/SlideButton.tsx
+++ b/node_modules/rn-slide-button/src/components/SlideButton.tsx
@@ -83,29 +83,29 @@ export type SlideButtonCommonProps = {
 
 const SlideButton = ({
   width,
-  height,
-  borderRadius,
-  completeThreshold,
-  disabled,
-  padding,
-  title,
+  height= DEFAULT_HEIGHT,
+  borderRadius= DEFAULT_BORDER_RADIUS,
+  completeThreshold= DEFAULT_COMPLETE_THRESHOLD,
+  disabled=false,
+  padding= DEFAULT_CONTAINER_PADDING,
+  title= DEFAULT_TITLE,
   titleContainerStyle,
   titleStyle,
   icon,
   thumbStyle,
   containerStyle,
   underlayStyle,
-  onReachedToStart,
-  onReachedToEnd,
-  onSlideEnd,
-  onSlideStart,
-  reverseSlideEnabled,
-  autoReset,
-  autoResetDelay,
-  animation,
-  animationDuration,
-  dynamicResetEnabled,
-  dynamicResetDelaying,
+  onSlideStart= () => {},
+  onSlideEnd= () => {},
+  onReachedToStart= () => {},
+  onReachedToEnd=() => {},
+  reverseSlideEnabled= true,
+  autoReset= DEFAULT_AUTO_RESET,
+  autoResetDelay= DEFAULT_AUTO_RESET_DELAY,
+  animation= DEFAULT_ANIMATION,
+  animationDuration= DEFAULT_ANIMATION_DURATION,
+  dynamicResetEnabled= false,
+  dynamicResetDelaying= false,
 }: SlideButtonProps) => {
   const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 });
   const [endReached, setEndReached] = React.useState<boolean>(false);
@@ -346,26 +346,6 @@ const SlideButton = ({
 
 export default React.memo(SlideButton);
 
-SlideButton.defaultProps = {
-  height: DEFAULT_HEIGHT,
-  borderRadius: DEFAULT_BORDER_RADIUS,
-  padding: DEFAULT_CONTAINER_PADDING,
-  title: DEFAULT_TITLE,
-  completeThreshold: DEFAULT_COMPLETE_THRESHOLD,
-  disabled: false,
-  reverseSlideEnabled: true,
-  autoReset: DEFAULT_AUTO_RESET,
-  autoResetDelay: DEFAULT_AUTO_RESET_DELAY,
-  animation: DEFAULT_ANIMATION,
-  animationDuration: DEFAULT_ANIMATION_DURATION,
-  dynamicResetEnabled: false,
-  dynamicResetDelaying: false,
-  onSlideStart: () => {},
-  onSlideEnd: () => {},
-  onReachedToStart: () => {},
-  onReachedToEnd: () => {},
-};
-
 const styles = StyleSheet.create({
   container: {
     backgroundColor: DEFAULT_CONTAINER_COLOR,

This issue body was partially generated by patch-package.

@alexisnsns
Copy link

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/rn-slide-button/src/components/SlideButton.tsx b/node_modules/rn-slide-button/src/components/SlideButton.tsx
index 20d55f6..e646adf 100644
--- a/node_modules/rn-slide-button/src/components/SlideButton.tsx
+++ b/node_modules/rn-slide-button/src/components/SlideButton.tsx
@@ -83,29 +83,29 @@ export type SlideButtonCommonProps = {
 
 const SlideButton = ({
   width,
-  height,
-  borderRadius,
-  completeThreshold,
-  disabled,
-  padding,
-  title,
+  height= DEFAULT_HEIGHT,
+  borderRadius= DEFAULT_BORDER_RADIUS,
+  completeThreshold= DEFAULT_COMPLETE_THRESHOLD,
+  disabled=false,
+  padding= DEFAULT_CONTAINER_PADDING,
+  title= DEFAULT_TITLE,
   titleContainerStyle,
   titleStyle,
   icon,
   thumbStyle,
   containerStyle,
   underlayStyle,
-  onReachedToStart,
-  onReachedToEnd,
-  onSlideEnd,
-  onSlideStart,
-  reverseSlideEnabled,
-  autoReset,
-  autoResetDelay,
-  animation,
-  animationDuration,
-  dynamicResetEnabled,
-  dynamicResetDelaying,
+  onSlideStart= () => {},
+  onSlideEnd= () => {},
+  onReachedToStart= () => {},
+  onReachedToEnd=() => {},
+  reverseSlideEnabled= true,
+  autoReset= DEFAULT_AUTO_RESET,
+  autoResetDelay= DEFAULT_AUTO_RESET_DELAY,
+  animation= DEFAULT_ANIMATION,
+  animationDuration= DEFAULT_ANIMATION_DURATION,
+  dynamicResetEnabled= false,
+  dynamicResetDelaying= false,
 }: SlideButtonProps) => {
   const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 });
   const [endReached, setEndReached] = React.useState<boolean>(false);
@@ -346,26 +346,6 @@ const SlideButton = ({
 
 export default React.memo(SlideButton);
 
-SlideButton.defaultProps = {
-  height: DEFAULT_HEIGHT,
-  borderRadius: DEFAULT_BORDER_RADIUS,
-  padding: DEFAULT_CONTAINER_PADDING,
-  title: DEFAULT_TITLE,
-  completeThreshold: DEFAULT_COMPLETE_THRESHOLD,
-  disabled: false,
-  reverseSlideEnabled: true,
-  autoReset: DEFAULT_AUTO_RESET,
-  autoResetDelay: DEFAULT_AUTO_RESET_DELAY,
-  animation: DEFAULT_ANIMATION,
-  animationDuration: DEFAULT_ANIMATION_DURATION,
-  dynamicResetEnabled: false,
-  dynamicResetDelaying: false,
-  onSlideStart: () => {},
-  onSlideEnd: () => {},
-  onReachedToStart: () => {},
-  onReachedToEnd: () => {},
-};
-
 const styles = StyleSheet.create({
   container: {
     backgroundColor: DEFAULT_CONTAINER_COLOR,

This issue body was partially generated by patch-package.

This solution works fine 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants