Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLindhout committed Jun 19, 2023
1 parent 27fdcd4 commit 9beff44
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,22 @@ 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';




export default function App() {
const scrollViewRef = useRef<ScrollView>(null);
const [
{ errors, submit, formProps, hasError },
{ email, telephone, password },
Expand All @@ -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
Expand All @@ -117,7 +121,8 @@ export default function App() {
}
);
return (
<View
<ScrollView
ref={scrollViewRef}
style={{
flex: 1,
maxWidth: 500,
Expand Down Expand Up @@ -158,7 +163,7 @@ export default function App() {
Save
</Button>
</Form>
</View>
</ScrollView>
);
}

Expand Down

0 comments on commit 9beff44

Please sign in to comment.