onTypingSymbolSuggest(text){
        if(text.text == ''){
            var helpText = 'Search for a company or ticker';
        }else{
            var helpText = 'Validating input'
        }
        this.setState({
            text: text.text,
            helpText: helpText,
        });
        //begin symbol suggest
        var url = 'http://d.yimg.com/aq/autoc?query=' + text.text + '&region=US&lang=en-US&callback=YAHOO.util.ScriptNodeDataSource.callbacks';
        fetch(url)
        .then((response) => response.text())
        .then((textResponse) => {
            textResponse = textResponse.slice(42,textResponse.length-2); //terrible way of getting the data but it works for now
            var data = JSON.parse(textResponse).ResultSet.Result;
            this.setState({
                dataSource: this.state.dataSource.cloneWithRows(data),
            });
        })
        .catch((error) => {
            Alert.alert(
                'An error has occurred',
                'Please try again',
                [
                    {text: 'Okay', onPress: () => console.log('OK Pressed')},
                ]
            );
        });
    }
//function will show suggested symbols based on what is typed
function will show suggested symbols based on what is typed
function will show suggested symbols based on what is typed
onTypingSymbolSuggest(text){
        if(text.text == ''){
            var helpText = 'Search for a company or ticker';
        }else{
            var helpText = 'Validating input'
        }
        this.setState({
            text: text.text,
            helpText: helpText,
        });
        var url = 'http://d.yimg.com/aq/autoc?query=' + text.text + '&region=US&lang=en-US&callback=YAHOO.util.ScriptNodeDataSource.callbacks';
        fetch(url)
        .then((response) => response.text())
        .then((textResponse) => {
            textResponse = textResponse.slice(42,textResponse.length-2); 
            var data = JSON.parse(textResponse).ResultSet.Result;
            this.setState({
                dataSource: this.state.dataSource.cloneWithRows(data),
            });
        })
        .catch((error) => {
            Alert.alert(
                'An error has occurred',
                'Please try again',
                [
                    {text: 'Okay', onPress: () => console.log('OK Pressed')},
                ]
            );
        });
    }
onTypingSymbolSuggest ( text ) { if ( text . text == '' ) { var helpText = 'Search for a company or ticker' ; } else { var helpText = 'Validating input' } this . setState ( { text : text . text , helpText : helpText , } ) ; var url = 'http://d.yimg.com/aq/autoc?query=' + text . text + '&region=US&lang=en-US&callback=YAHOO.util.ScriptNodeDataSource.callbacks' ; fetch ( url ) . then ( ( response ) => response . text ( ) ) . then ( ( textResponse ) => { textResponse = textResponse . slice ( 42 , textResponse . length - 2 ) ; var data = JSON . parse ( textResponse ) . ResultSet . Result ; this . setState ( { dataSource : this . state . dataSource . cloneWithRows ( data ) , } ) ; } ) . catch ( ( error ) => { Alert . alert ( 'An error has occurred' , 'Please try again' , [ { text : 'Okay' , onPress : ( ) => console . log ( 'OK Pressed' ) } , ] ) ; } ) ; }
function will show suggested symbols based on what is typed
function will show suggested symbols based on what is typed
//begin symbol suggest //terrible way of getting the data but it works for now