diff --git a/components/ModalDropdown.js b/components/ModalDropdown.js index ace1472..360fc58 100644 --- a/components/ModalDropdown.js +++ b/components/ModalDropdown.js @@ -9,6 +9,7 @@ import React, { } from 'react'; import { + FlatList, StyleSheet, Dimensions, View, @@ -21,7 +22,7 @@ import { ActivityIndicator, } from 'react-native'; -import ListView from "deprecated-react-native-listview"; +// import ListView from "deprecated-react-native-listview"; import PropTypes from 'prop-types'; const TOUCHABLE_ELEMENTS = [ @@ -109,7 +110,7 @@ export default class ModalDropdown extends Component { }); } - render() { + render () { return ( {this._renderButton()} @@ -168,16 +169,16 @@ export default class ModalDropdown extends Component { return ( this._button = button} - disabled={disabled} - accessible={accessible} - onPress={this._onButtonPress} + disabled={disabled} + accessible={accessible} + onPress={this._onButtonPress} > { children || ( {buttonText} @@ -203,15 +204,16 @@ export default class ModalDropdown extends Component { const frameStyle = this._calcPosition(); const animationType = animated ? 'fade' : 'none'; return ( - @@ -281,29 +283,35 @@ export default class ModalDropdown extends Component { } _renderDropdown() { - const {scrollEnabled, renderSeparator, showsVerticalScrollIndicator, keyboardShouldPersistTaps} = this.props; + const {scrollEnabled, showsVerticalScrollIndicator, keyboardShouldPersistTaps, options} = this.props; + const Separator = return ( - ); } - get _dataSource() { - const {options} = this.props; - const ds = new ListView.DataSource({ - rowHasChanged: (r1, r2) => r1 !== r2 - }); - return ds.cloneWithRows(options); - } + _keyExtractor = (item, index) => `${index}` + + // get _dataSource() { + // const {options} = this.props; + // const ds = new ListView.DataSource({ + // rowHasChanged: (r1, r2) => r1 !== r2 + // }); + // return ds.cloneWithRows(options); + // } - _renderRow = (rowData, sectionID, rowID, highlightRow) => { + _renderRow = ({item: rowData, index: rowID, separators}) => { const {renderRow, dropdownTextStyle, dropdownTextHighlightStyle, accessible} = this.props; const {selectedIndex} = this.state; const key = `row_${rowID}`; @@ -322,7 +330,7 @@ export default class ModalDropdown extends Component { const preservedProps = { key, accessible, - onPress: () => this._onRowPress(rowData, sectionID, rowID, highlightRow), + onPress: () => this._onRowPress(rowData, rowID), }; if (TOUCHABLE_ELEMENTS.find(name => name == row.type.displayName)) { const props = {...row.props}; @@ -369,10 +377,10 @@ export default class ModalDropdown extends Component { ); }; - _onRowPress(rowData, sectionID, rowID, highlightRow) { + _onRowPress(rowData, rowID) { const {onSelect, renderButtonText, onDropdownWillHide} = this.props; if (!onSelect || onSelect(rowID, rowData) !== false) { - highlightRow(sectionID, rowID); + // highlightRow(sectionID, rowID); const value = renderButtonText && renderButtonText(rowData) || rowData.toString(); this._nextValue = value; this._nextIndex = rowID; @@ -388,13 +396,8 @@ export default class ModalDropdown extends Component { } } - _renderSeparator = (sectionID, rowID, adjacentRowHighlighted) => { - const key = `spr_${rowID}`; - return ( - - ); + _renderSeparator = () => { + return }; } @@ -438,4 +441,4 @@ const styles = StyleSheet.create({ height: StyleSheet.hairlineWidth, backgroundColor: 'lightgray' } -}); +}); \ No newline at end of file