forked from reactjs/react-autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathListOption.js
More file actions
38 lines (29 loc) · 866 Bytes
/
ListOption.js
File metadata and controls
38 lines (29 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var React = require('react/addons');
var {PureRenderMixin} = React.addons;
/**
* <ListOption> is a default implementation for rows rendered for the
* `options` in the <List> component. For the row content, it displays the
* string label as determined by the `getLabelForOption` function.
*/
var ListOption = React.createClass({
mixins: [PureRenderMixin],
propTypes: {
/**
* Function that takes an `option` value, and returns a string label.
*/
getLabelForOption: React.PropTypes.func.isRequired,
/**
* Option value that the row is representing.
*/
option: React.PropTypes.any.isRequired
},
render: function() {
var {option, getLabelForOption, ...otherProps} = this.props;
return (
<li {...otherProps}>
{getLabelForOption(option)}
</li>
);
}
});
module.exports = ListOption;