Skip to content

Instantly share code, notes, and snippets.

@bogoslavskiy
Created March 5, 2020 17:51
Show Gist options
  • Save bogoslavskiy/bb1ea0ab23fe72be19e14c4558fdf8ea to your computer and use it in GitHub Desktop.
Save bogoslavskiy/bb1ea0ab23fe72be19e14c4558fdf8ea to your computer and use it in GitHub Desktop.
import * as React from "react";
import { ViewStyle, StyleSheet, TextInputProps, View, TextInput } from "react-native";
interface InputProps extends TextInputProps {
noWrapper?: boolean;
containerStyle?: ViewStyle;
}
export const Input = (props: InputProps) => {
const { noWrapper, containerStyle, ...other } = props;
return (
<View style={[!noWrapper && styles.wrapper, containerStyle]}>
<View style={styles.container}>
<TextInput
{...other}
placeholderTextColor={'#8D8D8D'}
allowFontScaling={false}
selectionColor={'#007BFF'}
style={[props.style, styles.input]}
/>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
borderRadius: 10,
backgroundColor: '#F2F3F5'
},
wrapper: {
marginHorizontal: 16,
marginBottom: 16
},
input: {
fontSize: 17,
lineHeight: 22,
fontWeight: '400',
color: '#262626',
flexGrow: 1,
height: 54,
minHeight: 54,
paddingHorizontal: 16,
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment