From 181278053552313ae5d9e73838fac5087b3f8d2e Mon Sep 17 00:00:00 2001 From: Deepak Grover Date: Wed, 23 Aug 2017 15:00:08 +0530 Subject: [PATCH] Add dynamic size prop for NativeList --- app/sensors/NativeList.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/sensors/NativeList.js b/app/sensors/NativeList.js index a97ed4b..4379a73 100644 --- a/app/sensors/NativeList.js +++ b/app/sensors/NativeList.js @@ -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); @@ -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); }