We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 220baaf commit 8777182Copy full SHA for 8777182
mobile/ReactNativeTutorial/app/bundles/comments/components/Index/List/List.js
@@ -2,6 +2,7 @@
2
import React from 'react';
3
import { ListView } from 'react-native';
4
import Item from './Item/Item';
5
+import _ from 'lodash/fp';
6
7
import styles from './ListStyle';
8
@@ -26,7 +27,12 @@ class List extends React.Component {
26
27
}
28
29
componentWillReceiveProps(nextProps) {
- this.setState({ dataSource: this.state.dataSource.cloneWithRows(nextProps.comments) })
30
+ const data = _.compose(
31
+ _.reverse,
32
+ _.sortBy(_.get('id')),
33
+ _.values
34
+ )(nextProps.comments);
35
+ this.setState({ dataSource: this.state.dataSource.cloneWithRows(data) })
36
37
38
render() {
0 commit comments