({ habit, habitInput })
| 4 | import HabitsData from "../../../Database/HabitsData"; |
| 5 | |
| 6 | export default function SelectHabit({ habit, habitInput }) { |
| 7 | const [selected, setSelected] = useState( |
| 8 | habit?.habitName ? habit?.habitName : "-" |
| 9 | ); |
| 10 | const [data, setData] = useState(); |
| 11 | |
| 12 | useEffect(() => { |
| 13 | if (habit?.habitArea === "Mente") { |
| 14 | setData(HabitsData.dataMind); |
| 15 | } |
| 16 | if (habit?.habitArea === "Financeiro") { |
| 17 | setData(HabitsData.dataMoney); |
| 18 | } |
| 19 | if (habit?.habitArea === "Corpo") { |
| 20 | setData(HabitsData.dataBody); |
| 21 | } |
| 22 | if (habit?.habitArea === "Humor") { |
| 23 | setData(HabitsData.dataFun); |
| 24 | } |
| 25 | habitInput(habit?.habitName ? habit?.habitName : undefined); |
| 26 | }, []); |
| 27 | |
| 28 | return ( |
| 29 | <> |
| 30 | <SelectList |
| 31 | setSelected={setSelected} |
| 32 | data={data} |
| 33 | search={false} |
| 34 | onSelect={() => { |
| 35 | habitInput(selected); |
| 36 | }} |
| 37 | placeholder={selected} |
| 38 | boxStyles={styles.boxStyle} |
| 39 | inputStyles={styles.inputStyle} |
| 40 | dropdownStyles={styles.dropdownStyle} |
| 41 | dropdownItemStyles={styles.dropdownItemStyle} |
| 42 | dropdownTextStyles={styles.dropdownTextStyle} |
| 43 | arrowicon={ |
| 44 | <Image |
| 45 | source={require("../../../assets/icons/arrowDropdown.png")} |
| 46 | style={styles.arrow} |
| 47 | /> |
| 48 | } |
| 49 | /> |
| 50 | </> |
| 51 | ); |
| 52 | } |
| 53 | |
| 54 | const styles = StyleSheet.create({ |
| 55 | boxStyle: { |
nothing calls this directly
no outgoing calls
no test coverage detected