-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
48 lines (42 loc) · 1.01 KB
/
App.js
File metadata and controls
48 lines (42 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React from 'react';
import {useState} from 'react';
import {Text, Button, SafeAreaView, StyleSheet, TextInput, View} from 'react-native';
const App = () => {
const [inputValue,setInputValue] = useState('')
const checkValueIsNumberOrNot = () =>{
if(isNaN(inputValue)){
alert('It\'s not a Number.');
}else{
alert('It\'s a Number');
}
}
return(
<SafeAreaView style={{flex:1}}>
<View style = {styles.container}>
<TextInput
placeholder = "Enter Text"
style = {styles.textInputStyle}
onChangeText = {(inputValue)=>{setInputValue(inputValue)}}
/>
<Button
title = "Check Value is Number or not"
onPress = {checkValueIsNumberOrNot}
/>
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
marginTop: 60
},
textInputStyle: {
textAlign: 'center',
height: 50,
width: '70%',
marginBottom: 10,
}
});
export default App;