Skip to content

Commit

Permalink
Add dynamic size prop for NativeList
Browse files Browse the repository at this point in the history
  • Loading branch information
metagrover committed Aug 23, 2017
1 parent e9b2ab2 commit 1812780
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/sensors/NativeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ export default class NativeList extends Component {
manager.update(this.channelId, this.react, nextProps.size, 0, false);
}

if (this.props.size !== nextProps.size) {
this.setReact(nextProps);
manager.update(this.channelId, this.react, nextProps.size, 0, false);
}

if (!_.isEqual(this.props.defaultSelected, nextProps.defaultSelected)) {
this.defaultValue = nextProps.defaultSelected;
this.changeValues(this.defaultValue);
Expand Down Expand Up @@ -217,12 +222,12 @@ export default class NativeList extends Component {
// Set the react - add self aggs query as well with react
const react = Object.assign({}, props.react);
react.aggs = {
key: this.props.appbaseField,
sort: this.props.sortBy,
size: this.props.size,
sortRef: `${this.props.componentId}-sort`
key: props.appbaseField,
sort: props.sortBy,
size: props.size,
sortRef: `${props.componentId}-sort`
};
const reactAnd = [`${this.props.componentId}-sort`, "nativeListChanges"]
const reactAnd = [`${props.componentId}-sort`, "nativeListChanges"];
this.react = helper.setupReact(react, reactAnd);
}

Expand Down

0 comments on commit 1812780

Please sign in to comment.