contact_app/src/components/Input/DefaultText/index.js
2023-06-07 09:06:58 +07:00

41 lines
864 B
JavaScript

import React from 'react';
import {Text, TextInput, View, StyleSheet} from 'react-native';
const DefaultTextInput = props => (
<View style={props.containerStyle}>
<Text style={styles.label}>{props.label}</Text>
<TextInput
style={[styles.input]}
onChangeText={props.onChangeText}
value={props.value}
keyboardType={props.keyboardType}
/>
{props.isFilled && <Text style={styles.errorLabel}>Wajib diisi</Text>}
</View>
);
const styles = StyleSheet.create({
input: {
flex: 1,
marginHorizontal: 10,
marginTop: 5,
borderWidth: 1,
padding: 10,
color: 'black',
borderRadius: 10,
},
label: {
color: 'black',
marginLeft: 10,
fontSize: 12
},
errorLabel: {
color: 'red',
marginLeft: 10,
marginBottom: 5,
fontSize: 10
},
});
export default DefaultTextInput;