Expo Snack using React Hooks not working

I am trying to add React Hooks into Expo & getting an error.

TypeError: i.useState is not a function. (In ‘i.useState(e)’, ‘i.useState’ is undefined)

The whole code is

import useFormal from '@kevinwolf/formal-native'
import React from 'react'
import { Alert, SafeAreaView, StyleSheet, View } from 'react-native'
import { Button, Input, Text } from 'react-native-elements'
import * as yup from 'yup'

const schema = yup.object().shape({
  Username: yup.string().required(),
  Email: yup
    .email('Invalid Email Address')
  Password: yup
  ConfirmPassword: yup
    .oneOf([yup.ref('Password'), null], "Passwords don't match")

const initialValues = {
  Username: 'lmaowtf',
  Email: 'asshole',
  Password: 'wtf',
  ConfirmPassword: 'wtf',

const Field = ({ placeholder, error, ...props }) => (
    <Text style={styles.space}>{placeholder}</Text>
    <Input {...props} />
    {error && (
      <Text style={[styles.space, error && styles.error]}>{error}</Text>

function App() {
  const formal = useFormal(initialValues, {
    onSubmit: values => Alert.alert(JSON.stringify(values)),

  console.log({ getSubmitButtonProps: { ...formal.getSubmitButtonProps() } })

  return (
      <View style={styles.space}>
        <Text h1>Formal</Text>
        <Field {...formal.getFieldProps('Username')} placeholder="Username" />
        <Field {...formal.getFieldProps('Email')} placeholder="Email" />
          placeholder="Confirm Password"

const styles = StyleSheet.create({
  space: {
    margin: 10,
  error: {
    color: 'red',

export default App

It has 3 extra dependencies, namely, react-native-elements, @kevinwolf/formal-native & yup

I can’t get it to work on Expo Snack without error :sob:

Here’s the Snack URL :point_right:https://snack.expo.io/@deadcoder0904/react-native-formal

Hey @deadcoder0904,

This is expected. Hooks support is part of RN 0.59 and SDK32 (the latest version) is running a fork of 0.57. You’ll have to wait until we release SDK33 and add it to Snack to make use of hooks.


1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.