title: How to use onChange in custom textinput react native
body: <p>So im new at react native and i built an custom text input that gives suggestions by following a tutorial.But now i cant use onChange  in that custom text input.I tried to  create a state in App.js  and change it in AutoCompleteText.js file but didnt worked.How can i get the value inmy custom text input ?</p>
  <p>my App.js file :</p>
  <pre><code>import { StatusBar } from 'expo-status-bar';
  import React from 'react';
  import { StyleSheet, Text, View } from 'react-native';
  import AutoCompleteText from './AutoCompleText'
  import './AutoCompleteText.css';
  
  export default function App() {
    return (
      &lt;View style={styles.container}&gt;
        &lt;View style={styles.AutoComp}&gt;
        &lt;AutoCompleteText items={['Ali','Veli','Ahmet']} /&gt;
        &lt;/View&gt;
        &lt;StatusBar style=&quot;auto&quot; /&gt;
      &lt;/View&gt;
    );
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      backgroundColor: '#fff',
      alignItems: 'center',
      justifyContent: 'center',
  
    },
    AutoComp:{
      width:600
  
    }
  });
  </code></pre>
  <p>my AutoCompleteText.js file</p>
  <pre><code>import React from 'react'
  import './AutoCompleteText.css';
  
  export default class AutoCompleteText extends React.Component{
  
  
  
      constructor(props){
          super(props);
          this.state={
              suggestions:[],
              text:'',
              
          };
  
      }
  
  
      onTextChanged = (e) =&gt;{
          const {items} = this.props;
          const value = e.target.value;
          let suggestions = [];
          if (value.length &gt; 0){
              const regex = new RegExp(`^${value}`,'i');
              suggestions = items.sort().filter(v =&gt; regex.test(v));
              
              
      }
      this.setState(() =&gt; ({ suggestions , text: value }));
  
  }
  
  
  
      suggestionSelected(value){
          this.setState(() =&gt;({
              text: value,
              suggestions:[],
          }) )
  
      }
  
  
      renderSuggestions(){
  
      const {suggestions} = this.state;
      if (suggestions.length === 0){
  
          return null;
      }
      return(
          &lt;ul&gt;
              {suggestions.map((item) =&gt; &lt;li onClick={() =&gt; this.suggestionSelected(item)}&gt;{item}&lt;/li&gt;)}
          &lt;/ul&gt;
      );
  }
  
  
  
  
      render(){
          const { text } = this.state;
          return(
              &lt;div className=&quot;AutoCompleteText&quot;&gt;
                  &lt;input value={text} onChange={this.onTextChanged} type ='text'/&gt;
                  {this.renderSuggestions()}
               
              &lt;/div&gt;
  
  
          )
  
  
      }
  }
  </code></pre>