123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 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.number || '')
- let title = props.title || "Input";
- return(
- <View style={styles.container}>
- <Text style={styles.title}>{title}</Text>
- <TextInput style={styles.defaultInput}
- onChangeText={(number) => {
- try{
- number = parseInt(number);
- } catch(e) {
- return;
- }
- props.onChange && props.onChange(number);
- setNumber(number);
- }}
- keyboardType={'numeric'}
- value={number.toString()}/>
- </View>
- )
- }
- const styles = StyleSheet.create({
- container:{
- padding:10
- },
- defaultInput: {
- marginTop:6,
- borderWidth:1,
- width:100
- },
- title: {
- }
- })
|