import { useChantier } from '@/app/ContextChantier'; import { useState } from 'react'; import { Dimensions, LayoutAnimation, Pressable, StyleSheet, View } from 'react-native'; import Animated, { LinearTransition } from 'react-native-reanimated'; import { ThemedButton } from './themed-button'; import { ThemedText } from './themed-text'; import { ThemedTextInput } from './themed-textinput'; import { ThemedView } from "./themed-view"; const screenHeight = Dimensions.get("window").height; export default function SetStatus() { const { chantier, setChantier} = useChantier(); const [currentSatus, setCurrentSearch] = useState("En cours"); const [isOpen,setIsOpen] = useState(false); const AnimatedThemedView = Animated.createAnimatedComponent(ThemedView); const AnimatedThemedText = Animated.createAnimatedComponent(ThemedText); const AnimatedThemedButton = Animated.createAnimatedComponent(ThemedButton); const AnimatedThemedTextInput = Animated.createAnimatedComponent(ThemedTextInput); const choices = ["En cours","Interrompu","Terminé","Non réalisé"] function onPressOpen(): void { LayoutAnimation.configureNext( LayoutAnimation.Presets.easeInEaseOut ); setIsOpen(!isOpen); } function selectSatus(status: string): void { setCurrentSearch(status); setIsOpen(false); } const choice = (status:string, index: number) => { return( selectSatus(status)}> {status} ); }; return( onPressOpen()}> {currentSatus} {isOpen && {choices.map((str, index) => ( str!==currentSatus && choice(str, index) ))} } ) } const styles = StyleSheet.create({ windowClose:{ //backgroundColor: '#00FFFF', //borderRadius:10, padding: 10, width:"50%", //height:60, overflow: 'hidden', }, windowOpean:{ width:"50%", padding: 10, }, window:{ borderRadius:15, //backgroundColor: '#00FF00', overflow: 'hidden', }, menu:{ padding:0, flex: 1, //backgroundColor:'#FF00FF', }, list:{ flex: 1, overflow: 'hidden', borderRadius:10, }, satus:{ padding:10, flexDirection: 'row', }, button:{ width:'100%', margin: 0, borderRadius: 15, padding: 10, height:40, }, centeredText:{ textAlign: 'center', } });