Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react native textInput numbers only

<TextInput 
   style={styles.textInput}
   keyboardType='numeric'
   onChangeText={(text)=> this.onChanged(text)}
   value={this.state.myNumber}
   maxLength={10}  //setting limit of input
/>
Comment

react allow only numbers in input

class App extends React.Component{
   constructor(){
      super();
      this.state = {value: ''};
      this.onChange = this.onChange.bind(this)
   }
   
   onChange(e){
      const re = /^[0-9]+$/;
      if (e.target.value === '' || re.test(e.target.value)) {
         this.setState({value: e.target.value})
      }
   }
   
   render(){
     return <input value={this.state.value} onChange={this.onChange}/>
   }
}

ReactDOM.render(<App/>,document.getElementById('app'))
Comment

react native text input number only

keyboardType='numeric'
Comment

PREVIOUS NEXT
Code Example
Javascript :: array loop pyramid js 
Javascript :: Sorting the Odd way! 
Javascript :: In Self Invoking Functions, the This Below Console.Logs The Created Object 
Javascript :: chrome page transitions 
Javascript :: replace text content with element node 
Javascript :: select next occurrence visual studio 
Javascript :: import local js file node 
Javascript :: miragejs createServer timing 
Javascript :: Set Up Model In MongoDB 
Javascript :: repeated click onchange javascript 
Javascript :: Calculator for two numbers 
Javascript :: prisma multiple relation counts 
Javascript :: 1--Reverse Bits Algo 
Javascript :: NG0100: Expression has changed after it was checked 
Javascript :: json to dart dummy api 
Javascript :: js beutify node.js 
Javascript :: var countdown = function(num) {} 
Javascript :: get data from multiple api in react 
Javascript :: how to close bootstrap modal after save 
Javascript :: A Note on Jest & React 
Javascript :: get number of new document firebasse 
Javascript :: types of variables in javascript 
Javascript :: javascript binary tree 
Javascript :: json stringify without quotes 
Javascript :: password validation in javascript 
Javascript :: nextjs apollo 
Javascript :: vs code ouput stack 
Javascript :: arjs marker+location 
Javascript :: javascript Implicit Boolean Conversion to Number 
Javascript :: javascript Arrow Function with Promises and Callbacks 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =