React Native - Forms with Hooks

 Creating forms in React Native can be accomplished using various libraries and approaches. Here’s a basic overview of how to handle forms in React Native, including popular libraries you might consider.

1. Using Controlled Components

In React Native, you can create forms using controlled components where form elements' values are managed by React state. Here’s a simple example:

import React, { useState } from 'react';
import { View, TextInput, Button, Text } from 'react-native';

const SimpleForm = () => {
  const [name, setName] = useState('');
  const [email, setEmail] = useState('');

  const handleSubmit = () => {
    console.log('Name:', name);
    console.log('Email:', email);
  };

  return (
    <View>
      <TextInput
        placeholder="Name"
        value={name}
        onChangeText={setName}
      />
      <TextInput
        placeholder="Email"
        value={email}
        onChangeText={setEmail}
      />
      <Button title="Submit" onPress={handleSubmit} />
      {name && <Text>Your name is: {name}</Text>}
      {email && <Text>Your email is: {email}</Text>}
    </View>
  );
};

export default SimpleForm;