Mobile Development
Mobile development involves creating mobile applications that run on mobile devices such as smartphones and tablets. It typically involves using mobile development frameworks and languages such as Swift, Kotlin, and React Native.
Example of a simple mobile application using React Native:
import React, { useState } from 'react';
import { StyleSheet, Text, View, TextInput, Button } from 'react-native';
export default function App() {
const [name, setName] = useState('');
const [greeting, setGreeting] = useState('');
const greet = () => {
setGreeting(`Hello, ${name}!`);
};
return (
<View style={styles.container}>
<Text style={styles.title}>Welcome to my app</Text>
<Text>Enter your name:</Text>
<TextInput
style={styles.input}
onChangeText={text => setName(text)}
value={name}
/>
<Button title="Greet" onPress={greet} />
<Text style={styles.greeting}>{greeting}</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 16,
},
input: {
borderWidth: 1,
borderColor: '#ccc',
padding: 8,
marginVertical: 16,
width: '80%',
},
greeting: {
fontSize: 18,
marginVertical: 16,
},
});
No comments:
Post a Comment