Numbers.js 772 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React, { useState } from 'react';
  2. import {View , Text, TextInput, Button,StyleSheet} from 'react-native';
  3. import { Icon } from 'react-native-elements'
  4. export default function Numbers(props) {
  5. let [number , setNumber] = useState(props.number || '')
  6. let title = props.title || "Input";
  7. return(
  8. <View style={styles.container}>
  9. <Text style={styles.title}>{title}</Text>
  10. <TextInput style={styles.defaultInput}
  11. onChangeText={(number) => {
  12. props.onChange && props.onChange(number);
  13. setNumber(number);
  14. }}
  15. keyboardType={'numeric'}
  16. value={number.toString()}/>
  17. </View>
  18. )
  19. }
  20. const styles = StyleSheet.create({
  21. container:{
  22. padding:10
  23. },
  24. defaultInput: {
  25. marginTop:6,
  26. borderWidth:1,
  27. width:100
  28. },
  29. title: {
  30. }
  31. })