React-native-google-places-autocomplete: No way to style placeholder

Created on 1 Apr 2018  路  5Comments  路  Source: FaridSafi/react-native-google-places-autocomplete

Most helpful comment

@nica0012 can you provide an example of how you made it work? I can't figure out how to style the placeholder.

You want to pass the textInputProps as a prop to the GooglePlacesAutocomplete. Not into the styles obj like you pass most of the other styling. For example see below:

placeholder={'Search'}
fetchDetails={true}
query={{
key: '...',
language: 'en',
}}
textInputProps={{ placeholderTextColor: 'pink' }}
styles={{
container: {
backgroundColor: theme.color.screen,
},
textInput: {
backgroundColor: theme.color.secondaryScreen,
color: theme.color.boneIcon,
},
textInputContainer: {
backgroundColor: theme.color.screen,
},
}}
onFail={(error) => console.log('error:', error)}
/>

All 5 comments

This doesn't work?

Never mind, you can achieve this via textInputProps

@nica0012 can you provide an example of how you made it work? I can't figure out how to style the placeholder.

@nica0012 can you provide an example of how you made it work? I can't figure out how to style the placeholder.

You want to pass the textInputProps as a prop to the GooglePlacesAutocomplete. Not into the styles obj like you pass most of the other styling. For example see below:

placeholder={'Search'}
fetchDetails={true}
query={{
key: '...',
language: 'en',
}}
textInputProps={{ placeholderTextColor: 'pink' }}
styles={{
container: {
backgroundColor: theme.color.screen,
},
textInput: {
backgroundColor: theme.color.secondaryScreen,
color: theme.color.boneIcon,
},
textInputContainer: {
backgroundColor: theme.color.screen,
},
}}
onFail={(error) => console.log('error:', error)}
/>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukBakTsh picture lukBakTsh  路  3Comments

RajanPN picture RajanPN  路  3Comments

GervaisYO picture GervaisYO  路  4Comments

quandevelopment picture quandevelopment  路  4Comments

frankfaustino picture frankfaustino  路  4Comments