byteburgers / react-native-autocomplete-input

Pure javascript autocomplete input for react-native
https://byteburgers.com/autocomplete
MIT License
818 stars 255 forks source link

The keyboard disappears after each letter is typed or deleted #240

Closed roei133 closed 2 years ago

roei133 commented 2 years ago

The keyboard disappears after each letter is typed or deleted and it is not clear why this is happening.

my code example:

<Autocomplete
                data={
                  autoCompleteWaterSourceData?.length === 1 &&
                  autoCompleteWaterSourceData[0]
                    ? []
                    : autoCompleteWaterSourceData
                }
                placeholder={placeholder1}
                value={querySourceCode}
                autoCorrect={false}
                onChangeText={setQuerySourceCode}
                flatListProps={{
                  keyboardShouldPersistTaps: 'always',
                  keyExtractor: (_, idx) => idx.Water_Source_Code,
                  renderItem: ({
                    item: { Water_Source_Code, Water_Source_Name },
                  }) => (
                    <TouchableOpacity
                      onPress={() =>
                        setQuerySourceCode(
                          Water_Source_Code + ' ' + Water_Source_Name
                        )
                      }
                    >
                      <Text style={styles.autoCompleteText}>
                        {Water_Source_Code + ' ' + Water_Source_Name}
                      </Text>
                    </TouchableOpacity>
                  ),
                }}
              />
marlonschlosshauer commented 2 years ago

The README mentions a known issue with ScrollViews:

By default the autocomplete will not behave as expected inside a . Set the scroll view's prop to fix this: keyboardShouldPersistTaps={true} for RN <= 0.39, or keyboardShouldPersistTaps='always' for RN >= 0.40. (#5). Alternatively, you can use renderResultList to render a custom result list that does not use FlatList. See the tests for an example.

Perhaps that is causing the issue?

stale[bot] commented 2 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

keyut-shah commented 1 year ago

I counter this error and than resolve but don't know why it comes again any other solution.