@@ -2,7 +2,7 @@ import React, {Component} from "react";
22import { Text , TextInput , TouchableHighlight , View } from "react-native" ;
33import PropTypes from "prop-types" ;
44import { Style } from "./style" ;
5- import { isEmpty , isStringEmpty , debounce } from "./utils" ;
5+ import { debounce , isNumeric , isEmpty , isStringEmpty } from "./utils" ;
66
77/**
88 * Default Color
@@ -123,7 +123,7 @@ class InputSpinner extends Component {
123123 const res = await this . props . onChange ( num ) ;
124124 if ( res === false ) {
125125 return ;
126- } else if ( this . isNumeric ( res ) ) {
126+ } else if ( isNumeric ( res ) ) {
127127 num = this . parseNum ( res ) ;
128128 }
129129 }
@@ -285,7 +285,7 @@ class InputSpinner extends Component {
285285 const res = await this . props . onIncrease ( increased_num ) ;
286286 if ( res === false ) {
287287 return ;
288- } else if ( this . isNumeric ( res ) ) {
288+ } else if ( isNumeric ( res ) ) {
289289 num = this . parseNum ( res ) ;
290290 }
291291 }
@@ -313,7 +313,7 @@ class InputSpinner extends Component {
313313 const res = await this . props . onDecrease ( decreased_num ) ;
314314 if ( res === false ) {
315315 return ;
316- } else if ( this . isNumeric ( res ) ) {
316+ } else if ( isNumeric ( res ) ) {
317317 num = this . parseNum ( res ) ;
318318 }
319319 }
@@ -327,20 +327,6 @@ class InputSpinner extends Component {
327327 this . onChange ( num ) ;
328328 }
329329
330- /**
331- * Detect if is a numeric value
332- * @param num
333- * @returns {boolean }
334- */
335- isNumeric ( num ) {
336- return (
337- num !== null &&
338- num !== false &&
339- ! isNaN ( parseFloat ( num ) ) &&
340- ! isNaN ( num - 0 )
341- ) ;
342- }
343-
344330 /**
345331 * On Submit keyboard
346332 * @returns {* }
0 commit comments