react-native-sortable-list icon indicating copy to clipboard operation
react-native-sortable-list copied to clipboard

Using order? prop to initial rows order

Open dinhlang opened this issue 6 years ago • 1 comments

I have a warning message as using order prop in sortable list <SortableList style={styleSheet.btn_container_content_skill} scrollEnabled={false} contentContainerStyle={styles.contentContainer} data={data} order={['0','2','1','3','4']} sortingEnabled={this.state.sortableFlag} onChangeOrder={this._onChangeOrder} renderRow={this._renderRow} /> Data to show : const data = { 0: { text: '0 : One such example is a solar panel which could charge an LED lamp to create hours of light each day', }, 1: { text: '1 : In addition to being fairly costly, these create smoke pollution and carbon emissions', }, 2: { text: '2 : Therefore, alternatives are being investigated', }, 3: { text: '3 : A result of not being connected to the electricity grid in rural areas of some countries means people light their homes using kerosene lamps', }, 4: { text: '4 : However, most of these workers would not consider career alternatives', } }; screen shot 2018-04-14 at 8 55 35 pm screen shot 2018-04-14 at 8 44 20 pm

I want to update the order of data when pressing button, does anyone have the solution to resolve it? Thank you.

dinhlang avatar Apr 14 '18 11:04 dinhlang

I think you could/should pass a unique key down to a ListView or SectionList when rendering a list. It will improve rendering! FlatList/ListView/SectionList all use keyExtractor to get the job done FlatList

M-Jas avatar Apr 17 '18 15:04 M-Jas