SHARE
TWEET

Untitled

a guest Jul 17th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import { StyleSheet, View, Alert } from 'react-native';
  3. import {
  4.   Container, Header, Content, Card, Input,
  5.   CardItem, Text, Right, Icon, Footer, FooterTab,
  6.   Left, Body, Title, Button, Item }
  7. from 'native-base';
  8. import { Avatar } from 'react-native-elements';
  9. import FontAwesome from 'react-native-vector-icons/FontAwesome';
  10. import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
  11. import NumberFormat from 'react-number-format';
  12.  
  13. class Test extends Component {
  14.  
  15.   constructor(props) {
  16.     super(props);
  17.     this.state = {
  18.       myData: {}
  19.     };
  20.   }
  21.  
  22.   componentDidMount() {
  23.     const obj = { ...this.state.myData };
  24.  
  25.     obj.Amount = '1000';
  26.  
  27.     this.setState({
  28.       myData: obj
  29.     });
  30.   }
  31.  
  32.   onChangeText = (text, input) => {
  33.     const obj = { ...this.state.myData };
  34.  
  35.     obj[input] = text;
  36.  
  37.     this.setState({
  38.       myData: obj
  39.     });
  40.   };
  41.  
  42.   render() {
  43.     const { Amount } = this.state.myData;
  44.     return (
  45.     <Container>
  46.       <Header>
  47.         <Left>
  48.           <Button>
  49.             <Icon name='arrow-back' />
  50.           </Button>
  51.         </Left>
  52.         <Body>
  53.           <Title>Test Page</Title>
  54.         </Body>
  55.         <Right />
  56.       </Header>
  57.       <Content>
  58.         <Card>
  59.           <CardItem cardBody>
  60.             <Left>
  61.               <FontAwesome name="money" />
  62.               <Text>Amount</Text>
  63.             </Left>
  64.             <Right>
  65.               <Item>
  66.                 <Input
  67.                       value=<NumberFormat
  68.                         value={Amount} displayType={'text'} thousandSeparator prefix={'$'}
  69.                       />
  70.                       onChangeText={(text) => this.onChangeText(text, 'Amount')}
  71.                       style={styles.valueText}
  72.                 />
  73.               </Item>
  74.             </Right>
  75.           </CardItem>
  76.         </Card>
  77.       </Content>
  78.     </Container>
  79.     );
  80.   }
  81. }
  82.  
  83. const styles = StyleSheet.create({
  84.   valueText: {
  85.     color: 'rgb(192, 186, 186)',
  86.     fontSize: 15,
  87.   },
  88. });
  89.  
  90. export default Test;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top