2020-02-11 14:01:35 +00:00
|
|
|
import React from 'react';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { Text, View } from 'react-native';
|
2020-02-11 14:01:35 +00:00
|
|
|
import Touchable from 'react-native-platform-touchable';
|
|
|
|
|
|
|
|
import { CustomIcon } from '../../../lib/Icons';
|
|
|
|
import { themes } from '../../../constants/colors';
|
|
|
|
import ActivityIndicator from '../../ActivityIndicator';
|
|
|
|
import styles from './styles';
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
interface IInput {
|
|
|
|
children: JSX.Element;
|
|
|
|
onPress: Function;
|
|
|
|
theme: string;
|
|
|
|
inputStyle: object;
|
2021-09-22 17:29:26 +00:00
|
|
|
disabled?: boolean | object;
|
|
|
|
placeholder?: string;
|
|
|
|
loading?: boolean;
|
|
|
|
innerInputStyle?: object;
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
|
2021-09-22 17:29:26 +00:00
|
|
|
const Input = ({ children, onPress, theme, loading, inputStyle, placeholder, disabled, innerInputStyle }: IInput) => (
|
2020-02-11 14:01:35 +00:00
|
|
|
<Touchable
|
2020-05-08 17:36:10 +00:00
|
|
|
onPress={onPress}
|
2020-03-30 19:50:27 +00:00
|
|
|
style={[{ backgroundColor: themes[theme].backgroundColor }, inputStyle]}
|
2020-02-11 14:01:35 +00:00
|
|
|
background={Touchable.Ripple(themes[theme].bannerBackground)}
|
2021-09-13 20:41:05 +00:00
|
|
|
disabled={disabled}>
|
2021-09-22 17:29:26 +00:00
|
|
|
<View style={[styles.input, { borderColor: themes[theme].separatorColor }, innerInputStyle]}>
|
2020-05-08 17:36:10 +00:00
|
|
|
{placeholder ? <Text style={[styles.pickerText, { color: themes[theme].auxiliaryText }]}>{placeholder}</Text> : children}
|
2021-09-13 20:41:05 +00:00
|
|
|
{loading ? (
|
|
|
|
<ActivityIndicator style={[styles.loading, styles.icon]} />
|
|
|
|
) : (
|
|
|
|
<CustomIcon name='chevron-down' size={22} color={themes[theme].auxiliaryText} style={styles.icon} />
|
|
|
|
)}
|
2020-02-11 14:01:35 +00:00
|
|
|
</View>
|
|
|
|
</Touchable>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default Input;
|