gpt4 book ai didi

react-native-google-places-autocomplete 无法解析模块 `path/custom/left-icon`

转载 作者:行者123 更新时间:2023-12-03 09:26:38 31 4
gpt4 key购买 nike

我无法使用 react native autocomplete npm 包,我收到了这个错误“react-native-google-places-autocomplete unable to resolve module path/custom/left-icon”我正在使用 React Native V0.44.0我做错了什么?

simulator error

import React from 'react';
import { View, Image } from 'react-native';
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';

const homePlace = { description: 'Home', geometry: { location: { lat: 48.8152937, lng: 2.4597668 } }};
const workPlace = { description: 'Work', geometry: { location: { lat: 48.8496818, lng: 2.2940881 } }};

const GooglePlacesInput = () => {
return (
<GooglePlacesAutocomplete
placeholder='Search'
minLength={2}
autoFocus={false}
returnKeyType={'search'}
listViewDisplayed='auto'
fetchDetails={true}
renderDescription={(row) => row.description}
onPress={(data, details = null) => {
console.log(data);
console.log(details);
}}
getDefaultValue={() => {
return '';
}}
query={{

key: 'YOUR API KEY',
language: 'en',
types: '(cities)'
}}
styles={{
description: {
fontWeight: 'bold'
},
predefinedPlacesDescription: {
color: '#1faadb'
}
}}

currentLocation={true}
currentLocationLabel="Current location"
nearbyPlacesAPI='GooglePlacesSearch'
GoogleReverseGeocodingQuery={{

}}
GooglePlacesSearchQuery={{

rankby: 'distance',
types: 'food'
}}

filterReverseGeocodingByTypes={['locality', 'administrative_area_level_3']}
predefinedPlaces={[homePlace, workPlace]}

debounce={200}
renderLeftButton={() => <Image source={require('path/custom/left-icon')} />}
renderRightButton={() => <Text>Custom text after the inputg</Text>}
/>
);
}

最佳答案

把线拿出来

 renderLeftButton={() => <Image source={require('path/custom/left-icon')} />}

或将其替换为文本或您自己的图像。您应该将该路径替换为您自己的文本或图像,或者如果您不需要它,您应该将其完全删除。

例如试试这个:

renderLeftButton={() => <Text> Left Button or Left Icon </Text>}

关于react-native-google-places-autocomplete 无法解析模块 `path/custom/left-icon`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48255203/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com