import { ThemedView } from '@/components/themed-view';
import { useState } from 'react';
import { Button, GestureResponderEvent, ScrollView, StyleSheet, TextInput, View } from 'react-native';
import "@/components/Theme";

export default function SelectChantier() {

    const [search, setSearch] = useState('');
    const [isOpen,setIsOpen] = useState(false);
    const [chantiers,setChantiers] = useState([]);
    

  function onPressOpen(event: GestureResponderEvent): void {
    setIsOpen(!isOpen);
  }


    const renderChantier = ()  => {
      return(
      <View style={styles.chantier}>
      </View>
      );
    };

    return (
        <View style={styles.selectZone}>
          {!isOpen && (
             <Button onPress={onPressOpen} title={"Open"}/>
          )}
           {isOpen && (
            <ScrollView>
               <Button onPress={onPressOpen} title={"Close"}/>
                <View style={styles.searchZone}>
                    <View style={styles.searchMenu}>
                        <TextInput
                            placeholder='Rechercher un chantier'
                            value={search}
                            onChangeText={setSearch}
                        />
                    </View>
                </View>
                
                <View>

                </View>
            </ScrollView>
           )}
        </View>

    );
}

const styles = StyleSheet.create({
    selectZone:{
    position: 'absolute',
    backgroundColor: global.theme.colors.c0,
    width: "100%",
    margin: 0,
    borderRadius: 5,
    zIndex: 9999,
    elevation: 9999,
  },
  titleContainer: {
    flexDirection: 'row',
    alignItems: 'center',
    gap: 8,
  },
  searchMenu:{
    backgroundColor: global.theme.colors.c2,
    borderRadius: 5,
    width: "100%",
    margin: 0,

    
  },
    searchZone:{
    width: "100%",
    padding:20,
    marginTop:50,
    alignItems: 'center',
  },
  chantier:{
    backgroundColor:'#202020'
  }
});
