Hey guys,
I had build a simple character counter with React Native under the Expo Frame . However ,I had met a issue ,seems I can’t get the length of the input text … I have attached my code ,could you please help me to take a lool ?
Thank you so much!!
import React,{ useState } from 'react';
import { Text, View } from 'react-native';
import { StyleSheet } from 'react-native'
import AppTextInput from '../components/AppTextInput';
import AppFormFlied from './../components/AppFormFlied';
import AppButton from './../components/AppButton';
function CommentsHome(props) {
const [value,setValue] = useState("");
return (
<View style={styles.container}>
<AppTextInput icon='feather'
placeholder="Left something.."
maxLength={100}
multiline={true}
onChangeText={(text)=>setValue({text})}
/>
<Text>Character Left :{value.length === null ? 0 : value.length}/100</Text>
<AppButton title="Submit"/>
</View>
);
}
const styles = StyleSheet.create({
container : {
width : "100%",
justifyContent : "center",
alignItems : 'center',
flexDirection : 'column',
}
})
export default CommentsHome;