i have just copied your example code and it works fine when app is in foreground but when we put the app in background and open it up again that time the picker opens up automatically.please refer to the video attacked bellow.
versions
import Navigator from "@navigation/Router";
import rootReducer from "@redux/RootReducer";
import { ThemeContextProvider } from "@theme/ThemeHelper";
// import React from "react";
import Apps from "./src/App";
import { name as appName } from "./app.json";
import { AppRegistry } from "react-native";
i have just copied your example code and it works fine when app is in foreground but when we put the app in background and open it up again that time the picker opens up automatically.please refer to the video attacked bellow. versions
"react": "16.13.1", "react-native": "^0.63.1", "react-native-month-year-picker": "^1.3.2",
my code
` /**
import Navigator from "@navigation/Router"; import rootReducer from "@redux/RootReducer"; import { ThemeContextProvider } from "@theme/ThemeHelper"; // import React from "react"; import Apps from "./src/App"; import { name as appName } from "./app.json"; import { AppRegistry } from "react-native";
// const App = () => ( //
//
//
// );
AppRegistry.registerComponent(appName, () => App);
import React, { useState, useCallback } from "react"; import { SafeAreaView, StyleSheet, Text, TouchableOpacity } from "react-native"; import moment from "moment";
import MonthPicker from "react-native-month-year-picker";
const styles = StyleSheet.create({ container: { flex: 1, justifyContent: "center", alignItems: "center", backgroundColor: "#dfe6e9" }, button: { justifyContent: "center", alignItems: "center", backgroundColor: "#b2bec3", borderRadius: 4, padding: 10 }, buttonText: { color: "#2d3436" } });
const DEFAULT_FORMAT = "MM-YYYY"; const DEFAULT_OUTPUT_FORMAT = "MMM-YYYY";
const App = () => { const [date, setDate] = useState(new Date()); const [show, setShow] = useState(false);
const showPicker = useCallback((value) => setShow(value), []);
const onValueChange = useCallback( (event, newDate) => { const selectedDate = newDate || date;
);
return (
); };
`