rajsuvariya / autocompletetextview

2 stars 5 forks source link

Trying to ReactEditText #18

Open Noitidart opened 6 years ago

Noitidart commented 6 years ago

I tried hard to extend ReactEditText, as that has all the multiline and fix for the nasty bug where focus stays locked in the field. However it seems to block text change events which doesnt trigger the suggestions box.

Usage:

import React, { Component } from 'react'
import { View, TextInput, ScrollView } from 'react-native'
import { AutoCompleteTextView } from 'autocompletetextview'

export default class App extends Component {
    render() {
        return (
            <ScrollView contentContainerStyle={{ flex:1, justifyContent:'center', alignItems:'center' }} keyboardShouldPersistTaps="handled">
                <TextInput
                    style={{ height:60, width:200 }}
                    placeholder="react native out of the box" />
                <AutoCompleteTextView
                    style={{ height:60, width:200 }}
                    dataSource={['Noitidart', 'Raj', 'Banglore', 'Bangladesh', 'Bangkok', 'Goa', 'Not Today', 'Ark', 'Alley', 'Gmail']}
                    placeholder="type a message"
                    placeholderTextColor="rgba(255, 0, 0, 0.5)"
                    disableFullscreenUI
                    threshold={1}
                    selectTextOnFocus />
            </ScrollView>
        )
    }
}
Noitidart commented 6 years ago

Ready for your troubleshooting please. Please don't merge this yet, as the auto complete thing doesn't work.

it uses AutoCompleteTextView. To swithc to MutliAutoCompleteTextView simply uncomment https://github.com/rajsuvariya/autocompletetextview/pull/18/files#diff-94913ce23b326fcbe965f78c7c245307R673 and then toggle comment from line 59 to line 60 here - https://github.com/rajsuvariya/autocompletetextview/pull/18/files#diff-c3adf912f6fbed7e00d9ed889fedf1d9R59

Noitidart commented 6 years ago

I posted on Stackoverflow too - https://stackoverflow.com/questions/49357761/trying-to-extend-reactedittext-for-native-android-autocompletetextview