Vaibhav Shukla
Vaibhav Shukla

Reputation: 547

how to capitalize the input in TextInput in react native? i cant capitalize the sentence, words or characters by autoCapitalize property of TextField

import React, { Component } from 'react';   
import { AppRegistry, Text, TextInput, View } from 'react-native';

class PizzaTranslator extends Component {
  constructor(props) {
  super(props);
  this.state = {text: ''};
  }
render() {
  return (
    <View style={{padding: 10}}>
      <TextInput
        style={{height: 40}}
        placeholder="Type here to translate!"
        autoCapitalize="characters"

here autoCapitalize doesnt works on my android.

        autoFocus="true"
        onChangeText={(text) => this.setState({text:text})}
      /> 
      <Text style={{padding: 10, fontSize: 42}}>
        {this.state.text.split(' ').map((word) => word && '🍕').join(' ')}
      </Text>
    </View>
 );
}
}

AppRegistry.registerComponent('testapp', () => PizzaTranslator);

I have samsung galaxy S6 with marshmallow api level 23 and i am currently testing on that. This autocapitalize works on other android but not on mine . I just noticed this. Does mobile effects the property?

Upvotes: 1

Views: 17384

Answers (1)

Vaibhav Shukla
Vaibhav Shukla

Reputation: 547

I noticed that this happens only on my samsung default keyboard. I downloaded another keyboards and autoCapitalize was working on other keyboards.

Upvotes: 3

Related Questions