From 9beff445c48562c5d03855b0817234a8c8253c19 Mon Sep 17 00:00:00 2001 From: Richard Lindhout Date: Mon, 19 Jun 2023 21:34:56 +0200 Subject: [PATCH] Update README.md --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 989277d..204a31d 100644 --- a/README.md +++ b/README.md @@ -84,12 +84,14 @@ registerTranslation("en", { }) ``` -## Usage +## Advanced example + +Also see /demo folder in this repository to see advanced usage! ```tsx import * as React from 'react'; -import { View } from 'react-native'; +import { View, ScrollView } from 'react-native'; import { useFormState, Form } from 'react-native-use-form'; import { Button, HelperText, TextInput } from 'react-native-paper'; @@ -97,6 +99,7 @@ import { Button, HelperText, TextInput } from 'react-native-paper'; export default function App() { + const scrollViewRef = useRef(null); const [ { errors, submit, formProps, hasError }, { email, telephone, password }, @@ -107,6 +110,7 @@ export default function App() { password: '', }, { + scrollViewRef, // optional if you want to scroll to error on submit (long forms) locale: 'en', // optional override onChange: (latestValues) => { // optional: do something with latestValues @@ -117,7 +121,8 @@ export default function App() { } ); return ( - - + ); }