diff --git a/src/components/Input.tsx b/src/components/Input.tsx index f1db3ae..297d27b 100644 --- a/src/components/Input.tsx +++ b/src/components/Input.tsx @@ -26,7 +26,7 @@ export const Input:FC = ({name,label, control}) => { value={field.value} onChangeText={field.onChange} placeholder={label} - className='p-2 m-2 w-max border rounded-xl focus:outline-offset-4 focus:outline-sky-500 focus:border-solid border-sky-500' + className='p-2 m-2 w-max border rounded-xl border-sky-500' /> diff --git a/src/components/InputDate.tsx b/src/components/InputDate.tsx new file mode 100644 index 0000000..3d80c6a --- /dev/null +++ b/src/components/InputDate.tsx @@ -0,0 +1,43 @@ +import React from 'react'; +import { FC } from 'react' +import { useController } from 'react-hook-form'; +import { Datepicker, Icon, IconElement, Layout } from '@ui-kitten/components'; + + +interface Props { + name: string, + label: string, + control: any +} + +const CalendarIcon = (props:any): IconElement => ( + +); + +export const InputDate: FC = ({ name, label, control }) => { + + const { field } = useController({ + control, + defaultValue: 0.0, + name, + }) + + return ( + <> + + + + + ) +} \ No newline at end of file diff --git a/src/components/InputNumber.tsx b/src/components/InputNumber.tsx new file mode 100644 index 0000000..598cb97 --- /dev/null +++ b/src/components/InputNumber.tsx @@ -0,0 +1,34 @@ +import React from 'react'; +import { FC } from 'react' +import { useController } from 'react-hook-form'; +import { Text, TextInput, View } from 'react-native'; + +interface Props { + name: string, + label: string, + control: any +} + +export const InputNumber: FC = ({ name, label, control }) => { + + const { field } = useController({ + control, + defaultValue: 0.0, + name, + }) + + return ( + <> + + + + + ) +} \ No newline at end of file diff --git a/src/components/ManyToOne.tsx b/src/components/ManyToOne.tsx index 35774df..970eab5 100644 --- a/src/components/ManyToOne.tsx +++ b/src/components/ManyToOne.tsx @@ -1,13 +1,7 @@ -import React, { useEffect, useState } from 'react'; -import { FC } from 'react' -import { IndexPath, Select, SelectItem, Text } from '@ui-kitten/components'; -import { StyleSheet, TextInput, View } from 'react-native'; - - -import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome' -import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons/faMagnifyingGlass' - -import { FieldValues, Controller, Control } from 'react-hook-form'; +import React, { useEffect, useState, FC } from 'react'; +import { View } from 'react-native'; +import { IndexPath, Select, SelectItem } from '@ui-kitten/components'; +import { Controller} from 'react-hook-form'; import { useFetchWithAuth } from '../hooks/useFetchWithAuth'; interface Props { @@ -22,15 +16,13 @@ interface Props { export const ManyToOne: FC = ({ entity, control,columname,columnvalue }) => { const [values, setValues] = useState([{id:0, columnvalue: 'Seleccione'}]); - const [selectedIndex, setSelectedIndex] = React.useState(new IndexPath(0)); - const displayValue = values[(selectedIndex as IndexPath).row]; + const [selectedIndex] = React.useState(new IndexPath(0)); useEffect(() => { async function fetchData() { try { const { data, error } = await useFetchWithAuth(entity.toLowerCase()); const result = data as {id: number, columnvalue: string}[] setValues (result); - console.log(entity.toLowerCase()) } catch (error) { console.error(error); } @@ -41,24 +33,21 @@ export const ManyToOne: FC = ({ entity, control,columname,columnvalue }) return ( <> - + + + +