-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
177 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,41 @@ | ||
### How do I get the input field? | ||
<a name="gettingTheInputElement"></a> | ||
### How do I get the input element? | ||
|
||
The input field is available on the Autosuggest instance as `input`. | ||
The input element is available on the Autosuggest instance as `input`. | ||
|
||
For example, you could store the input field like this: | ||
You could store the input element like this: | ||
|
||
```js | ||
<Autosuggest ref={autosuggest => this.input = autosuggest.input} ... /> | ||
function storeInputReference(autosuggest) { | ||
if (autosuggest !== null) { | ||
this.input = autosuggest.input; | ||
} | ||
} | ||
|
||
<Autosuggest ref={storeInputReference} ... /> | ||
``` | ||
|
||
[Codepen example](http://codepen.io/moroshko/pen/WryOMP) | ||
|
||
<a name="limitSuggestionsContainerScrolling"></a> | ||
### How do I limit the scrolling of the suggestions container to the container itself? | ||
|
||
When the suggestions container has a scroll bar, and you scroll beyond the start/end of the container, the page starts scrolling. To stop that, you can use [`react-isolated-scroll`](https://github.com/markdalgleish/react-isolated-scroll): | ||
|
||
```js | ||
import IsolatedScroll from 'react-isolated-scroll'; | ||
|
||
function renderSuggestionsContainer({ ref, ...rest }) { | ||
const callRef = isolatedScroll => { | ||
if (isolatedScroll !== null) { | ||
ref(isolatedScroll.component); | ||
} | ||
}; | ||
|
||
return ( | ||
<IsolatedScroll {...rest} ref={callRef} /> | ||
); | ||
} | ||
|
||
<Autosuggest renderSuggestionsContainer={renderSuggestionsContainer} ... /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.