You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've completely redesigned scrollTo behaviour #70
From this very moment, you can control the behavior with newly introduced prop `scrollToItem` (defaults to true, which means default implementation, see the gif bellow)

If you are not satisfied you can pass your own function which takes (container: HTMLDivElement, Item: HTMLDivElement), [take a look for default implementation as an example](https://github.com/webscopeio/react-textarea-autocomplete/pull/76/files#diff-b5c8f479fd199c465e4e5fce91bed60dR3).
Example of usage:
```js
<ReactTextareaAutocomplete
...
scrollToItem={false} // to disable
```
```js
<ReactTextareaAutocomplete
...
scrollToItem={true} // to enable default implementation
```
```js
<ReactTextareaAutocomplete
...
scrollToItem={(container, item) => {/*do stuff*/}}
```
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,7 @@ or there is UMD build available. [Check out this pen as example](https://codepen
41
41
| **trigger*** | Object: Trigger type | Define triggers and their corresponding behavior
42
42
| **loadingComponent*** | React Component | Gets `data` props which is already fetched (and displayed) suggestion
43
43
| innerRef | Function: (HTMLTextAreaElement) => void) | Allows you to get React ref of the underlying textarea
44
+
| scrollToItem | boolean \| (container: HTMLDivElement, item: HTMLDivElement) => void) | Defaults to true. With default implementation it will scroll the dropdown every time when the item gets out of the view.
44
45
| minChar | Number | Number of characters that user should type for trigger a suggestion. Defaults to 1.
45
46
| onCaretPositionChange | Function: (number) => void | Listener called every time the textarea's caret position is changed. The listener is called with one attribute - caret position denoted by an integer number.
46
47
| closeOnClickOutside | boolean | When it's true autocomplete will close when use click outside. Defaults to false.
0 commit comments