Skip to content

Commit

Permalink
doc: add docs on how to handle pickers in forms
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Pader committed Jan 20, 2023
1 parent 8edc865 commit 3505fd9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions contributingGuides/FORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,19 @@ Any `Form.js` that has a button will also add safe area padding by default. If t
</Form>
</ScreenWrapper>
```

### Handling Picker's in forms

#### Enable ScrollContext

In case there's a Picker nested in a ScrollView in the form we need to add one or two additional props to the `<Form />`.

To enable "scrolling-up" behaviour when a `<Picker />` is pressed, we need to add the `scrollContextEnabled` prop and set it to `true`.

This is because in this case, instead of a regular `ScrollView` the `<ScrollViewWithContext />` component will be used, so that a ref to the `ScrollView` and the current vertical scroll offset get passed to the picker over a context. The picker then handles scrolling up when it gets pressed.

#### Enable scrolling to overflow

Additionally to the section above, we can also enable the `scrollToOverflowEnabled` prop in case a there is a nested `<Picker />` component relatively far at the end of the ScrollView's content.

In this case, the opening Picker modal would get rendered over the Picker. (tbs., over the `TextInput` rendered by the `Picker`). We can prevent this behaviour by enabling scrolling to overflow in the `ScrollView`.

0 comments on commit 3505fd9

Please sign in to comment.