diff --git a/components/Channels/SortButton.tsx b/components/Channels/SortButton.tsx new file mode 100644 index 000000000..dd8e70cb3 --- /dev/null +++ b/components/Channels/SortButton.tsx @@ -0,0 +1,97 @@ +import * as React from 'react'; +import { ActionSheetIOS, Platform, View } from 'react-native'; +import { Picker } from '@react-native-picker/picker'; + +import Button from '../../components/Button'; +import { themeColor } from '../../utils/ThemeUtils'; +import { localeString } from '../../utils/LocaleUtils'; + +interface SortButtonProps { + onValueChange: (value: any) => void; + values: Array; +} + +export default class SortButton extends React.Component { + render() { + const { onValueChange, values } = this.props; + + // TODO for some reason it will not responsd to item 0 so a cancel item + // is placed here + const pickerValuesAndroid: Array = [ + + ]; + const pickerValuesIOS: Array = [localeString('general.cancel')]; + values.forEach((value: { key: string; value: any }) => { + pickerValuesAndroid.push( + + ); + pickerValuesIOS.push(value.key); + }); + + return ( + + {Platform.OS === 'android' && ( + + + onValueChange(itemValue) + } + style={{ + marginTop: -2, + width: 48, + color: themeColor('text'), + backgroundColor: themeColor('secondary') + }} + dropdownIconColor={themeColor('text')} + > + {pickerValuesAndroid} + + + )} + + {Platform.OS === 'ios' && ( + +