diff --git a/App.tsx b/App.tsx index 0329d0c..6a58582 100644 --- a/App.tsx +++ b/App.tsx @@ -1,10 +1,18 @@ +import React from "react"; import { StatusBar } from 'expo-status-bar'; -import { StyleSheet, Text, View } from 'react-native'; +import { StyleSheet, View } from 'react-native'; +import Buttons from './components/Buttons'; +import CustomInput from './components/Input'; +import WelcomeForm from "./components/WelcomeForm"; +import BoxForm from "./components/BoxForm"; export default function App() { return ( - Open up App.tsx to start working on your app! + {/**/} + {/**/} + {/**/} + ); diff --git a/components/BoxForm/BoxForm.tsx b/components/BoxForm/BoxForm.tsx new file mode 100644 index 0000000..bbac694 --- /dev/null +++ b/components/BoxForm/BoxForm.tsx @@ -0,0 +1,75 @@ +import React, {useState} from 'react'; +import { View, Text, StyleSheet, TextInput, Button } from 'react-native'; + +type TBox = { width?: number, height?: number, color?: string }; +const defaultBox = [ + { + color: 'red', + }, + { + color: 'blue', + }, +] + +const BoxForm = () => { + const [height, setHeight] = useState(''); + const [width, setWidth] = useState(''); + const [color, setColor] = useState(''); + const [boxArray, setBoxArray] = useState(defaultBox); + + const onSubmit = () => { + const newBox = { + height: height ? Number.parseInt(height) : undefined, + width: width ? Number.parseInt(width) : undefined, + color: color ? color.toLocaleLowerCase() : undefined, + }; + setBoxArray([...boxArray, newBox]) + }; + + return ( + + {boxArray.map(({ color, width, height }, i) => + + )} + + + + + + +