title: restrict special characters in reactNative TextInput
body: <p>I'm trying to prevent my TextInput from getting values like <code>$,%,^,&amp;,(,) etc</code>. Basically my TextInput should allow letters only. My approach is as follows. But still i'm able to input these other characters. How can i prevent special characters from the TextInput</p>
  
  <pre><code>restrict(event) {
          const regex = new RegExp("^[a-zA-Z]+$");
          const key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
          if (!regex.test(key)) {
              event.preventDefault();
              return false;
          }
      }
  
                           &lt;TextInput
                                  underlineColorAndroid='transparent'
                                  allowFontScaling={false}
                                  style={styles.questionText}
                                  onKeyPress={e =&gt; this.restrict(e)}
                                  value={firstNameState}
                              /&gt;
  </code></pre>