react-native-onth-year-picker
v1.0.9
Published
React Native Month Year Picker For Both Android And IOS
Downloads
20
Readme
react-native-month-year-picker
This is the React-Native-Month-Year Picker Supporting Both IOS and Android | |
Getting started
$ npm install react-native-onth-year-picker --save
Read more about autolinking here.
## Usage
import React, { useState, useEffect, useContext } from "react";
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
import MonthYearPicker from "react-native-onth-year-picker";
export default function App() {
const [datepicker, hideDatePicker] = useState(false);
return (
<View style={styles.container}>
<TouchableOpacity
style={{
width: "40%",
height: "8%",
backgroundColor: "green",
borderRadius: 10,
}}
onPress={() => {
hideDatePicker(true);
}}
>
<View
style={{ alignItems: "center", justifyContent: "center", flex: 1 }}
>
<Text style={{ color: "#fff", fontSize: 15, fontWeight: "bold" }}>
Click
</Text>
</View>
</TouchableOpacity>
<MonthYearPicker
isShow={datepicker}
close={() => {
hideDatePicker(false);
}}
onChangeYear={(year) => {
console.log("Year", year);
}}
onChangeMonth={(Month) => {
console.log("Month", Month);
}}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});