Input will hide behind other inputs
See original GitHub issueDescribe the bug
The input will hide behind other inputs and the list wont show up at all
Reproduction - (required - issue will be closed without this)
Here is the snack link snack
Please provide a FULLY REPRODUCIBLE example.
Click to expand!
import * as React from 'react';
import { View, StyleSheet, TextInput } from 'react-native';
import Constants from 'expo-constants';
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
const GOOGLE_PLACES_API_KEY = ''; // never save your real api key in a snack!
const App = () => {
return (
<View style={styles.container}>
<View style={{ height: 100 }}>
<TextInput
style={{ height: 40, borderColor: 'gray', borderWidth: 1 }}
/>
<GooglePlacesAutocomplete
query={{
key: GOOGLE_PLACES_API_KEY,
language: 'en', // language of the results
}}
onPress={(data, details = null) => console.log(data)}
onFail={(error) => console.error(error)}
requestUrl={{
url:
'https://cors-anywhere.herokuapp.com/https://maps.googleapis.com/maps/api',
useOnPlatform: 'web',
}} // this in only required for use on the web. See https://git.io/JflFv more for details.
styles={{
textInputContainer: {
backgroundColor: 'rgba(0,0,0,0)',
borderTopWidth: 0,
borderBottomWidth: 0,
},
textInput: {
marginLeft: 0,
marginRight: 0,
height: 38,
color: '#5d5d5d',
fontSize: 16,
},
predefinedPlacesDescription: {
color: '#1faadb',
},
}}
/>
<TextInput
style={{ height: 40, borderColor: 'gray', borderWidth: 1 }}
/>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
padding: 8,
},
});
export default App;
Additional context
-
Library Version: latest
-
React Native Version: 0.62
-
iOS
-
Android
-
Web
If you are using expo please indicate here:
- I am using expo
Add any other context about the problem here, screenshots etc https://i.imgur.com/zeFDWKL.png
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
<input type="hidden"> - HTML: HyperText Markup Language
Hidden inputs are completely invisible in the rendered page, and there is no way to make it visible in the page's content. Note:...
Read more >html - inputs getting hidden behind image - Stack Overflow
Problem is the inputs are placed "absolute" over top of the images and in IE (of course IE!!) the form inputs arent realy...
Read more >HTML input type="hidden" - W3Schools
The <input type="hidden"> defines a hidden input field. A hidden field lets web developers include data that cannot be seen or modified by...
Read more >Hide input field when second input field is in focus
When the user clicks on one input (Search, for example), I want the second (Subscribe) to disappear so the other input can grow...
Read more >How to Hide Form Fields Based Upon User Selection - Solodev
Hiding certain form fields until a user triggers them with a previous answer can be a simple way to withhold certain questions until...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is a simple solution to this, Jus create a separate view and put the Googleautocomplete tag inside the view.
First off, thank you for taking the time to reproduce this and dig into it.
Just so other people reading this know, the correct way to solve this (currently) is to set the
zIndex
in the container style andposition: absolute
orfixed
in thelistView
style.Example
You are right. Feel free to put in a PR
If you take out all the styles it would have fit in the box.
If you feel there is a better approach to this (or anything), I would be more than happy to discuss and/or review/merge a PR.