1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import React, { useState } from 'react';
- import {View , Text, TextInput, Button,StyleSheet} from 'react-native';
- import { Icon } from 'react-native-elements'
- export default function Numbers(props) {
- let [number , setNumber] = useState(props.value || '')
- let title = props.title || "Input";
- return(
- <View style={styles.container}>
- <Text style={[styles.title, styles.capFirst]}>{title}</Text>
- <TextInput
- onChangeText={(number) => {
- try{
- number = parseInt(number);
- } catch(e) {
- return;
- }
- props.onChange && props.onChange(number);
- setNumber(number);
-
- }}
- keyboardType={'numeric'}
- value={number.toString()}
- style={[styles.defaultInput]}
- />
- </View>
- )
- }
- const styles = StyleSheet.create({
- container:{
- flex:1,
- flexDirection: 'row',
- justifyContent:'space-between',
- opacity:1,
- alignItems: 'baseline'
- },
- capFirst: {
- fontSize: 14,
- fontFamily: 'roboto-light',
- textTransform: 'capitalize'
- },
- defaultInput: {
- width:62,
- height:21,
- borderWidth:1,
- backgroundColor: 'white',
- borderColor: '#00000030',
- borderRadius:14,
- paddingLeft: 10,
- paddingRight: 10
-
- }
- })
|