React Native Month and Year Picker

Shaiikh picture Shaiikh · Nov 3, 2018 · Viewed 7.3k times · Source

i have successfully selected date and time in my react app using a react-native-modal-datetime-picker it worked smooth i want a picker in which i can select month and year only:

Month & Year Picker

How can I add a month and year picker?

i tried to find examples and any tutorial which can help but didn't find any relative to my problem.

Answer

Jamkoko picture Jamkoko · Nov 7, 2018

Maybe look at https://github.com/beefe/react-native-picker.

Allows you to have multiple columns of selections in one like so:

enter image description here

Example code looks like this:

Picker.init({
    pickerData: data,
    selectedValue: [59],
    onPickerConfirm: data => {
        console.log(data);
    },
    onPickerCancel: data => {
        console.log(data);
    },
    onPickerSelect: data => {
        console.log(data);
    }
});
Picker.show();