byteburgers / react-native-autocomplete-input

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

Autocomplete suggestions are not displaying on ios #158

Closed hanaechahid closed 3 years ago

hanaechahid commented 4 years ago

this is my code:

<Autocomplete
       data={companies.length === 1 && comp(this.state.companySelected, companies[0].title) ? [] : companies}
       defaultValue={this.state.companySelected}
       onChangeText={text => {
           if (text.trim() !== this.state.companySelected.trim()) {
              this.setState({
                      hideResultsCompanies: false,
                       companySelected: text
               });
            } else {
               this.setState({
                      hideResultsCompanies: false,
                      companySelected: text
                });
            }
        }}
        placeholder={translate("enter_company")}
        containerStyle={{
               width: Metrics.WIDTH * 0.91,
                 left: Metrics.WIDTH * 0.05,
                 zIndex: 1
          }}
          inputContainerStyle={{
             borderWidth: 0,
             borderBottomWidth: Platform.OS == "ios" ? 0 : 0,
              marginTop: Platform.OS === "ios" ? 5 : null
         }}
         listContainerStyle={{zIndex: 1, position: 'absolute'}}
         placeholderTextColor={"#A5A0A0"}
         style={{
              backgroundColor: "#FFFFFF",
              fontSize: Fonts.moderateScale(15),
              color: "#000000",
              paddingBottom: 10,
              borderWidth: 1,
              borderColor: "#CCCCCC",
             width: Metrics.WIDTH * 0.9,
              alignItems: "center",
              fontSize: Fonts.moderateScale(12),
              ...Platform.select({
                    ios: {
                      height: 47,
                      paddingTop: 10,
                      paddingLeft: 5
                    }
              }),
              textAlign: I18nManager.isRTL ? "right": "left"
        }}
        hideResults={this.state.hideResultsCompanies}
        onFocus={ () => {this.setState({ hideResultsCompanies: false )} }
        renderItem={item => (
              <TouchableOpacity
                    onPress={() => {
                        this.setState({
                              hideResultsCompanies: true,
                              companySelected: item.name,
                              companyId: item.id
                        });
                    }}
                 >
                 <Text style={{ fontSize: 20, fontWeight: "700", marginBottom: 5 }} >
                            {item.name.toUpperCase()}
                  </Text>
               </TouchableOpacity>
         )}
   />

the suggesstions list doesn' displaying on ios instead is works well on android. also on Focus didn't fire i don't know why any help please? thank you

egeola commented 4 years ago

ios example doesn't display suggestions. Dropdown shows blank text. RN 0.61.5

hanaechahid commented 4 years ago

Hi @egeola for me, I had just separate android and iOS code in different files then it works well

egeola commented 4 years ago

Still doesn't work for me. The list returns title and release date as undefined.

bogan27 commented 4 years ago

Had the same issue. In the function I was passing in for renderItem, I was expecting one argument, the item (same as what you have in the code sample above. This worked in previous versions (I was using ^3.6.0). The fix that worked for me was to change the argument I was expecting in renderItem to { item, index, separators }. E.g. renderItem={({ item, index, separators }) => { ...render your suggestion }}

stale[bot] commented 3 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 3 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.