Skip to content

Commit e928978

Browse files
committed
update ListView to Flatlist
1 parent eee01b1 commit e928978

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

components/ModalDropdown.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
Dimensions,
1414
View,
1515
Text,
16+
FlatList,
1617
TouchableWithoutFeedback,
1718
TouchableNativeFeedback,
1819
TouchableOpacity,
@@ -21,7 +22,6 @@ import {
2122
ActivityIndicator,
2223
} from 'react-native';
2324

24-
import ListView from "deprecated-react-native-listview";
2525
import PropTypes from 'prop-types';
2626

2727
const TOUCHABLE_ELEMENTS = [
@@ -283,9 +283,9 @@ export default class ModalDropdown extends Component {
283283
_renderDropdown() {
284284
const {scrollEnabled, renderSeparator, showsVerticalScrollIndicator, keyboardShouldPersistTaps} = this.props;
285285
return (
286-
<ListView scrollEnabled={scrollEnabled}
286+
<FlatList scrollEnabled={scrollEnabled}
287287
style={styles.list}
288-
dataSource={this._dataSource}
288+
data={this.props.options}
289289
renderRow={this._renderRow}
290290
renderSeparator={renderSeparator || this._renderSeparator}
291291
automaticallyAdjustContentInsets={false}
@@ -295,14 +295,6 @@ export default class ModalDropdown extends Component {
295295
);
296296
}
297297

298-
get _dataSource() {
299-
const {options} = this.props;
300-
const ds = new ListView.DataSource({
301-
rowHasChanged: (r1, r2) => r1 !== r2
302-
});
303-
return ds.cloneWithRows(options);
304-
}
305-
306298
_renderRow = (rowData, sectionID, rowID, highlightRow) => {
307299
const {renderRow, dropdownTextStyle, dropdownTextHighlightStyle, accessible} = this.props;
308300
const {selectedIndex} = this.state;

0 commit comments

Comments
 (0)