question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autocomplete Pushes Down Other Components

See original GitHub issue

First of all thanks for making this wrapper around the places api. I have an issue here where i have another component below the autocomplete search box. I simply want to elevate the list view.I already tried playing with position, zindex, elevation and overflow, but instead of elevating it is showing below the component


          <ScrollView enableAutoAutomaticScroll={false} contentContainerStyle={{ borderRadius:6,borderColor:'rgba(112, 112, 112, 0.3)', borderWidth:1, shadowColor: '#000000', shadowOpacity: 0.16, shadowRadius:6, shadowOffset: {width:0, height:0}, elevation:5 ,backgroundColor: '#FFFFFF', marginHorizontal:15, marginVertical:25}}>

            <View style={{flex: 1,marginBottom:20 }}>

              <View style={{marginHorizontal:15,marginTop:20,flex:1,backgroundColor:'red'}}>
              <GooglePlacesAutocomplete
      placeholder='Enter Location'
      minLength={2} // minimum length of text to search
      autoFocus={false}
      returnKeyType={'search'} // Can be left out for default return key https://facebook.github.io/react-native/docs/textinput.html#returnkeytype
      keyboardAppearance={'light'} // Can be left out for default keyboardAppearance https://facebook.github.io/react-native/docs/textinput.html#keyboardappearance
      listViewDisplayed={false}   // true/false/undefined
      fetchDetails={true}
      keyboardShouldPersistTaps="handled"
      renderDescription={row => row.description} // custom description render
      onPress={(data, details = null) => { // 'details' is provided when fetchDetails = true
        console.log(data,details);
      }}
      enablePoweredByContainer={false}
      getDefaultValue={() => ''}
      query={{
        // available options: https://developers.google.com/places/web-service/autocomplete
        key: 'api_key',
        language: 'en', // language of the results
        types: '', // default: 'geocode'
      }}
      styles={{
        container: { zIndex: 999,
      overflow: 'visible',
      flexGrow: 0,
      flexShrink: 0},  //The conainer of the searchbox and list
        listView:{backgroundColor:'#FFF',position: 'absolute',
      top: 60,
      left: 10,
      right: 10,
      backgroundColor: 'white',
      borderRadius: 5,
      overflow:'visible',
      elevation:999,
      zIndex: 999},  //The listview styling listing all the placing
        textInputContainer: {},
        textInput: { },
        description: {color:'#808080', //The text color of the suggestion text },
      }}
      currentLocation={false} 
      nearbyPlacesAPI='GooglePlacesSearch' 
      GooglePlacesSearchQuery={{
        rankby: 'distance',
        type: 'cafe'
      }}
      
      GooglePlacesDetailsQuery={{
        fields: 'formatted_address',
      }}

      filterReverseGeocodingByTypes={['locality', 'administrative_area_level_3']} // filter the reverse geocoding results by types - ['locality', 'administrative_area_level_3'] if you want to display only cities
      debounce={200}
    />
</View>
              <View style={{marginHorizontal:15,marginVertical:15}}>
                  <Text style={{fontFamily:12,color:'rgba(128, 128, 128, 1)'}}>
                    Session Time
                  </Text>
                </View>

                <View>
                <View style={{ flexDirection: 'row', marginBottom:10}}>

                
                  <View style={{flex:1, marginHorizontal:5}}>
                    <DatePicker
                showIcon={false}
        style={{}}
        ref={(ref)=>this.date=ref}
        date={this.state.date}
        mode="date"
        placeholder='Select Date'
        format="YYYY-MM-DD"
        minDate={new Date()}
        confirmBtnText="Confirm"
        cancelBtnText="Cancel"
        customStyles={{
          placeholderText:{fontSize:10,color: '#808080'},
          dateTouchBody:{maxHeight:30,maxWidth:125,padding: 0,marginLeft: 0,borderBottomWidth:1, borderColor: '#000000',paddingHorizontal:15,
          backgroundColor:'#f1f1f1'},
        }}
        onDateChange={(date) => {this.setState({date: date})} }
      />
                   </View>
                   

              </View>
                 
              <View style={{flexDirection: 'row'}}>

              <View style={{flex:1, maxWidth:100,marginHorizontal:5}}>
                    <DatePicker
                showIcon={false}
        style={{}}
        date={this.state.start_time}
        mode="time"
        placeholder='Select time'
        format="HH:MM"
        minDate="2016-05-01"
        maxDate="2016-06-01"
        confirmBtnText="Confirm"
        cancelBtnText="Cancel"
        customStyles={{
          placeholderText:{fontSize:10,color: '#808080', fontFamily: Platform.OS == 'ios' ? "Krub" : "Krub Medium Italic", fontWeight:Platform.OS == 'ios' ? "normal" : "normal",fontStyle: Platform.OS == 'ios' ? "italic" : "normal",},
          dateTouchBody:{maxHeight:30,maxWidth:100,padding: 0,marginLeft: 0,borderBottomWidth:1, borderColor: '#000000',paddingHorizontal:15,
          backgroundColor:'#f1f1f1',fontFamily: Platform.OS == 'ios' ? "Krub" : "Krub Medium Italic", fontStyle: Platform.OS == 'ios' ? "italic" : "normal",},
          dateInput: {borderWidth:0
          }
          // ... You can check the source to find the other keys.
        }}
        onDateChange={(start_time) => {this.setState({start_time: start_time})}}
      />
                </View>

                <View style={{flex:1, marginHorizontal:10,justifyContent: 'center',alignItems: 'center',backgroundColor: 'transparent'}}>
                    <Text style={{fontFamily: Platform.OS == 'ios' ? "Krub" : "Krub Medium Italic", fontWeight:Platform.OS == 'ios' ? "normal" : "normal",fontStyle: Platform.OS == 'ios' ? "italic" : "normal", color: '#808080'}}>Until</Text>
                  </View>
                  <View style={{flex:1,maxWidth:100, marginHorizontal:5}}>
                      <DatePicker
                showIcon={false}
        style={{}}
        date={this.state.end_time}
        mode="time"
        placeholder='Select time'
        format="HH:MM"
        minDate="2016-05-01"
        maxDate="2016-06-01"
        confirmBtnText="Confirm"
        cancelBtnText="Cancel"
        customStyles={{
          placeholderText:{fontSize:10,color: '#808080', fontFamily: Platform.OS == 'ios' ? "Krub" : "Krub Medium Italic", fontWeight:Platform.OS == 'ios' ? "normal" : "normal",fontStyle: Platform.OS == 'ios' ? "italic" : "normal",},
          dateTouchBody:{maxHeight:30,maxWidth:100,padding: 0,marginLeft: 0,borderBottomWidth:1, borderColor: '#000000',paddingHorizontal:15,
          backgroundColor:'#f1f1f1',fontFamily: Platform.OS == 'ios' ? "Krub" : "Krub Medium Italic", fontStyle: Platform.OS == 'ios' ? "italic" : "normal",},
          dateInput: {borderWidth:0
          }
          // ... You can check the source to find the other keys.
        }}
        onDateChange={(end_time) => {this.setState({end_time: end_time})}}
      />
                  </View>
              </View>

              </View>
              </View>
      </View>  
          </ScrollView>

Thanks for an answer Screenshot_2019-04-25-20-26-36-732_com clutchrun

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
sostenesg7commented, Aug 23, 2019

I do not have my old code any more, i completely changed this component to work for me. But i remember code that i put is only:

styles={{
    listView:{
      position: 'absolute',
      backgroundColor: '#FFF',
      zIndex: 10,//Forcing it to front
  }
}}
2reactions
ws7onecommented, Oct 24, 2019

The absolute position works, but weirdly it looks like this image

The background, given is a solid color, still it’s not fully opaque. Plus when i try to click on the first or second element, the textbox behind it gets in focus.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - react-places-autocomplete pushing down the other ...
I have been struggling with this issue for sometime. Using the same example given in the latest README.md githun repo is pushing the...
Read more >
react-places-autocomplete pushing down the other ...
Coding example for the question react-places-autocomplete pushing down the other components below-Reactjs.
Read more >
auto complete push down other forms fields - PrimeFaces forum
I have a form with 4 elements in the following order autocompleTe selectmen. Slider button. When I do a auto search the result...
Read more >
Autocomplete API - Material UI - MUI
Name Type Default options * array renderInput * func autoComplete bool false
Read more >
Dropdowns Components | React Widgets
A set of <select> alternatives, and autocomplete components, Dropdowns map a selection from list of options or suggestions to a form value.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found