Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose renderAheadOffset prop #37

Merged
merged 2 commits into from
May 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ npx babel-node scripts/compile.js
| `loggingFunction` | Logging function to be called when applicable.\* | function | none |
| `verboseLoggingFunction` | Same as loggingFunction but also provides strategy used to determine failed search | boolean | false |
| `filterFunctions` | Array of functions that are used to limit which emojis should be rendered. Each of this function will be invoked with single parameter being `emoji` data and if every function returns `true` for `emoji` then this emoji will be included and displayed.| Array(function) | [] |
| `renderAheadOffset` | Specify how many pixels in advance you want views to be rendered. Increasing this value can help reduce blanks (if any). However, keeping this as low as possible should be the intent. Higher values also increase re-render compute | number | 1500 |
> \* When the search function yields this function is called. Additionally when the user clears the query box this function is called with the previous longest query since the last time the query box was empty. By default the function is called with one parameter, a string representing the query. If the verbose logging function parameter is set to true the function is called with a second parameter that is a string specifying why the function was called (either 'emptySearchResult' or 'longestPreviousQuery').

## Usage
Expand Down
8 changes: 5 additions & 3 deletions src/EmojiInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ class EmojiInput extends React.PureComponent {

render() {
const { selectedEmoji, offsetY } = this.state;
const { enableSearch, width } = this.props;
const { enableSearch, width, renderAheadOffset } = this.props;
return (
<View
style={{
Expand Down Expand Up @@ -509,7 +509,7 @@ class EmojiInput extends React.PureComponent {
)}
<RecyclerListView
style={{ flex: 1 }}
renderAheadOffset={1500}
renderAheadOffset={renderAheadOffset}
layoutProvider={this._layoutProvider}
dataProvider={this.state.dataProvider}
rowRenderer={this._rowRenderer}
Expand Down Expand Up @@ -643,7 +643,9 @@ EmojiInput.defaultProps = {
emojiFontSize: 40,
categoryFontSize: 20,
resetSearch: false,
filterFunctions: []
filterFunctions: [],

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove empty line

renderAheadOffset: 1500
};

EmojiInput.propTypes = {
Expand Down