2019-12-04 16:39:53 +00:00
|
|
|
import React from 'react';
|
2021-09-13 20:41:05 +00:00
|
|
|
import { I18nManager, StyleSheet, TextInput, TextInputProps } from 'react-native';
|
2019-12-04 16:39:53 +00:00
|
|
|
|
|
|
|
import { themes } from '../constants/colors';
|
|
|
|
|
2020-11-30 21:47:05 +00:00
|
|
|
const styles = StyleSheet.create({
|
|
|
|
input: {
|
2021-09-13 20:41:05 +00:00
|
|
|
...(I18nManager.isRTL ? { textAlign: 'right' } : { textAlign: 'auto' })
|
2020-11-30 21:47:05 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
interface IThemedTextInput extends TextInputProps {
|
|
|
|
style: object;
|
|
|
|
theme: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ThemedTextInput = React.forwardRef(({ style, theme, ...props }: IThemedTextInput, ref: any) => (
|
2019-12-04 16:39:53 +00:00
|
|
|
<TextInput
|
|
|
|
ref={ref}
|
2020-11-30 21:47:05 +00:00
|
|
|
style={[{ color: themes[theme].titleText }, style, styles.input]}
|
2019-12-04 16:39:53 +00:00
|
|
|
placeholderTextColor={themes[theme].auxiliaryText}
|
|
|
|
keyboardAppearance={theme === 'light' ? 'light' : 'dark'}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
));
|
|
|
|
|
|
|
|
export default ThemedTextInput;
|