我是Learnig React-native,我使用Expo创建了一个应用。
import React, { useState, useEffect } from 'react';
import { Text, StyleSheet, View, Button, TouchableOpacity, Platform, TextInput } from 'react-native';
const HomeScreen = ({ navigation }) => {
const [platform, setPlatform] = useState('');
const [age, setAge] = useState('35')
return (
<View style={styles.container}>
<Text>Enter Age</Text>
<TextInput
style={styles.input}
value={age}
onChangeText = {(val) => {
console.log(val)
setAge(val)
}}/>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center'
},
input: {
borderWidth: 1,
borderColor: '#777',
padding: 8,
margin: 10,
width: 200,
height: 35
}
});
export default HomeScreen;
在android设备以及Genymotion中,一切正常运行,但不可编辑。
请帮助。