Skip to content

show 'previosu' and 'next' button triggering even tho the value is not wanted #398

@MSetnik

Description

@MSetnik

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-calendar-picker@8.0.5 for the project I'm working on.

Im facing the problem when i dont want to show 'previosu' and 'next' button in the calendar header for month change, im still triggering the TouchableOpacity press even tho i have forwarded in nextComponent null value or empty view

nextComponent={() => <></>}
nextComponent={() => null}
nextComponent={null}

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-calendar-picker/CalendarPicker/Controls.js b/node_modules/react-native-calendar-picker/CalendarPicker/Controls.js
index ab9b9f5..cda0d3b 100644
--- a/node_modules/react-native-calendar-picker/CalendarPicker/Controls.js
+++ b/node_modules/react-native-calendar-picker/CalendarPicker/Controls.js
@@ -16,6 +16,8 @@ export default function Controls(props) {
     disabled,
   } = props;
 
+  if(component === null) return
+
   return (
     <TouchableOpacity
       onPress={() => onPressControl()}

This issue body was partially generated by patch-package.

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