Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native react native google autocomplete将结果限制为位置和半径_React Native - Fatal编程技术网

React native react native google autocomplete将结果限制为位置和半径

React native react native google autocomplete将结果限制为位置和半径,react-native,React Native,有人能给我解释一下如何将结果限制在某个位置周围的半径范围内吗 使用react native google autocomplete: 我试图在代码中的不同位置添加它,但locationResults没有任何过滤方式 我在官方文档中找到了一些资源,但由于我已经在使用这个库,我希望暂时保留它 我应该使用组件、道具吗? 现在,我限制在用户输入的末尾添加城市,但这是非常有限和丑陋的^^ 希望你能抽出时间回答我, 致意 我的代码如下: <GoogleAutoComplete apiKey

有人能给我解释一下如何将结果限制在某个位置周围的半径范围内吗

使用react native google autocomplete:

我试图在代码中的不同位置添加它,但locationResults没有任何过滤方式

我在官方文档中找到了一些资源,但由于我已经在使用这个库,我希望暂时保留它

我应该使用组件、道具吗? 现在,我限制在用户输入的末尾添加城市,但这是非常有限和丑陋的^^

希望你能抽出时间回答我, 致意

我的代码如下:

<GoogleAutoComplete 
    apiKey="*****"
    debounce={500}
    predefinedPlaces={notLocatedPlace}
    minLength={4}
    language="fr"
    components="country:fr"
    // location={{lat:45.526298,lng: 4.873333}}
    // radius={"20000"}
>
    {({ 
        handleTextChange, 
        locationResults, 
        fetchDetails, 
        isSearching, 
        inputValue, 
        clearSearchs,
        // location,
        // radius,
    }) => (
        <React.Fragment>
            {console.log('locationResults', locationResults)}
            <View 
                style={styles.adressContainer}
                // style={{flexDirection:"row", justifyContent:"center", alignItems:"center"}}
            >
                <TextInput 
                    underlineColorAndroid="#dfdfdf"
                    placeholder="Rechercher une adresse"
                    onChangeText={handleTextChange}
                    value={inputValue}
                    style={styles.streetInput}

                />
                {/* <Button 
                    title="clear" 
                    onPress={clearSearchs} 
                    style={styles.streetNumberInput}
                    // color="#aaa"
                /> */}
            </View>
            {isSearching && <ActivityIndicator size="large" color="#1faadb" />}
            <ScrollView>
                {locationResults.map(el =>(
                    <LocationResultItem 
                        {...el}
                        key={el.id.toString()}
                        fetchDetails={fetchDetails}
                        {...{clearSearchs}}
                        // query={{
                        //     location: '45.526298, 4.873333',
                        //     radius: '15000', //15 km
                        //     strictbounds: true,
                        // }}
                    />
                ))}
            </ScrollView>
            {/* <Text></Text> details a importer 2 way binding*/}
        </React.Fragment>
    )}
</GoogleAutoComplete>

{({ 
零钱,
位置结果,
获取详细信息,
我正在研究,
输入值,
清除搜索,
//位置,
//半径,
}) => (
{console.log('locationResults',locationResults)}
{/*  */}
{isSearching&&}
{locationResults.map(el=>(
))}
{/*详细说明导入器双向绑定*/}
)}