Roc*_*che 5 colors placeholder reactjs react-native google-places-autocomplete
我一直在尝试找到一种方法来更改 React Native 中 GooglePlacesAutocomplete 组件的占位符文本。我尝试查看官方文档,但没有看到任何相关内容。有人有解决办法吗?我尝试过使用 placeholderTextColor 等道具,但这对我不起作用。谢谢。
代码
<GooglePlacesAutocomplete
renderLeftButton={() => <Icon name='location'
type='evilicon' color={colors.middlegray} style={styles.icon}/>}
placeholder="Where is it?"
styles={toInputBoxStyles}
returnKeyType={"search"}
fetchDetails={true}
name="location"
enablePoweredByContainer={false}
nearbyPlacesAPI="GooglePlacesSearch"
debounce={400}
value={searchWords.searchKeyword}
query={{
key: GOOGLE_MAPS_APIKEY,
language: 'en'
}}
onPress={(data, details = null) => {
setSearch({searchKeyword: data.description});
}}
/>
Run Code Online (Sandbox Code Playgroud)
Ste*_*ell 12
您可以使用textInputPropsset placeholderTextColor,如下所示:
<GooglePlacesAutocomplete
...
placeholder="Where is it?"
textInputProps={{
placeholderTextColor: '#32a852',
returnKeyType: "search"
}}
...
query={{
key: GOOGLE_MAPS_APIKEY,
language: 'en'
}}
onPress={(data, details = null) => {
setSearch({searchKeyword: data.description});
}}
/>
Run Code Online (Sandbox Code Playgroud)
您可以在此处查看所有可用的道具
| 归档时间: |
|
| 查看次数: |
6379 次 |
| 最近记录: |