小编Roc*_*che的帖子

如何更改 React Native 中 Google Places 自动完成组件上的占位符文本?

我一直在尝试找到一种方法来更改 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)

colors placeholder reactjs react-native google-places-autocomplete

5
推荐指数
1
解决办法
6379
查看次数