vn-verdnaturachat/app/presentation/TextInput.tsx

28 lines
734 B
TypeScript
Raw Normal View History

2019-12-04 16:39:53 +00:00
import React from 'react';
import { I18nManager, StyleSheet, TextInput, TextInputProps } from 'react-native';
2019-12-04 16:39:53 +00:00
import { themes } from '../constants/colors';
const styles = StyleSheet.create({
input: {
...(I18nManager.isRTL ? { textAlign: 'right' } : { textAlign: 'auto' })
}
});
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}
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;