Skip to content

Commit

Permalink
docs: add react-native usage guide (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
VinitSarvade authored Jan 11, 2024
1 parent 01ea65e commit 0a6278e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
{
"label": "UI Libraries",
"to": "framework/react/guides/ui-libraries"
},
{
"label": "React Native",
"to": "framework/react/guides/react-native"
}
]
},
Expand Down
29 changes: 29 additions & 0 deletions docs/framework/react/guides/react-native.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
id: react-native
title: Usage with React Native
---

Tanstack Form is headless and it should support React Native out-of-the-box without needing any additional configuration.

Here is an example:

```tsx
<form.Field
name="age"
validators={{
onChange: val => val < 13 ? "You must be 13 to make an account" : undefined
}}
>
{field => (
<>
<Text>Age:</Text>
<TextInput value={field.state.value} onChangeText={handleChange} />
{
field.state.meta.errors
? <Text>{field.state.meta.errors.join(', ')}</Text>
: null
}
</>
)}
</form.Field>
```

0 comments on commit 0a6278e

Please sign in to comment.