Posts

Showing posts from March, 2022

form validation react native

import React from 'react' ; import { StyleSheet , ScrollView , View , Text , TouchableOpacity , Image , TextInput , Button } from 'react-native' ; export default class ChangePasswordScreen extends React . Component {     constructor ( props ) {         super ( props );         this . state = {             password : "" ,               // to store password             passwordErrorMessage : "" ,         // password error message             confirmPassword : "" ,               // to store password             confirmPasswordErrorMessage : "" ,         // password error message             loading : false ,             // manage loader ...

To make state true or false

  class Topup extends Component {   constructor ( props ) {     super ( props );     this . state = {       ondiv : false ,       ondiv1 : false ,       ondiv2 : false ,       ondiv3 : false ,       text : '' ,       isloading : false ,     };   }   afterclickfivehundred () {     this . setState ({ ondiv : true });     this . setState ({ ondiv1 : false });     this . setState ({ ondiv2 : false });     this . setState ({ ondiv3 : false });     this . setState ({ text : '500' });     //alert("500");   }   in View >>>>>>>>>>>>>>>>>>>>>>>>>>                        < TouchableOpacity         ...

currency format react native

  currencyFormat = ( num ) => {     var hhj = parseFloat ( num );     var length = hhj . toString (). length ;     if ( length < 4 ) {       var fin_num = hhj ;     } else {       var fin_num = hhj . toFixed (). replace ( / ( \d )(?=( \d {3} ) + (?! \d )) / g , '$1,' );     }     return fin_num ;   };