vn-verdnaturachat/app/containers/UIKit/MultiSelect/Input.tsx

41 lines
1.3 KiB
TypeScript
Raw Normal View History

2020-02-11 14:01:35 +00:00
import React from 'react';
import { Text, View } from 'react-native';
2020-02-11 14:01:35 +00:00
import Touchable from 'react-native-platform-touchable';
import { CustomIcon } from '../../CustomIcon';
2020-02-11 14:01:35 +00:00
import ActivityIndicator from '../../ActivityIndicator';
import styles from './styles';
import { useTheme } from '../../../theme';
2020-02-11 14:01:35 +00:00
interface IInput {
children?: JSX.Element;
onPress: () => void;
inputStyle?: object;
disabled?: boolean | null;
placeholder?: string;
loading?: boolean;
innerInputStyle?: object;
}
const Input = ({ children, onPress, loading, inputStyle, placeholder, disabled, innerInputStyle }: IInput) => {
const { colors } = useTheme();
return (
<Touchable
onPress={onPress}
style={[{ backgroundColor: colors.backgroundColor }, styles.inputBorder, inputStyle]}
background={Touchable.Ripple(colors.bannerBackground)}
disabled={disabled}
>
<View style={[styles.input, styles.inputBorder, { borderColor: colors.separatorColor }, innerInputStyle]}>
{placeholder ? <Text style={[styles.pickerText, { color: colors.auxiliaryText }]}>{placeholder}</Text> : children}
{loading ? (
<ActivityIndicator style={styles.icon} />
) : (
<CustomIcon name='chevron-down' size={22} color={colors.auxiliaryText} style={styles.icon} />
)}
</View>
</Touchable>
);
};
2020-02-11 14:01:35 +00:00
export default Input;