0

I am new to react-native. How do I downcase the first letter of a TextBox? I saw on https://facebook.github.io/react-native/docs/textinput to use enum('words') but don't know how to apply it.

Could you please help me?

EDITED

render() {
function capitalizeFirstLetter(string) {
    return string.charAt(0).toDownerCase()+ string.slice(1);
}
var newString = downcaseFirstLetter(value);
        <View style={styles.container}>
            <TextInput style={styles.inputBox}/>
            onChangeText={(email) => this.setState({email})}
            underlineColorAndroid='rgba(0,0,0,0)' 
            placeholder="Email"
            placeholderTextColor = "#232122"
            selectionColor="#232122"
            keyboardType="email-address"
            onSubmitEditing={()=> this.password.focus()}
    />

Perdon, I am new to JavaScript, but is it like this?

Tiago 2.0
  • 141
  • 3
  • 12

1 Answers1

0

To use autoCapitalize, the enum is an attribute/property of the TextBox, so it would be autoCapitalize="words"

<TextInput autoCapitalize="words" />

or as another example, capitalizing the first letter of each sentence (which is the default)

<TextInput autoCapitalize="sentences" />

Although this would capitalize, not downcase. You need javascript to do that as @Travis James said

function downcaseFirstLetter(string) {
    return string.charAt(0).toLowerCase() + string.slice(1);
}

var newString = downcaseFirstLetter(value);
chrisbyte
  • 1,408
  • 3
  • 11
  • 18