FRONTEND/ReactNative
React Native/개념[전기차 충전소 찾기 앱/ReactNative] 구글 클라우드
죠으닝
2024. 2. 14. 09:08
https://console.cloud.google.com/welcome/new?project=linear-rig-414323
Google 클라우드 플랫폼
로그인 Google 클라우드 플랫폼으로 이동
accounts.google.com
구글 클라우드 무료 시작하기
사용자 인증 정보
사용자 인증 정보 만들기로 api키를 발급한다.
사용설정된 API 및 서비스 에서
검색으로
두 개 사용 클릭한다.
env파일 추가해서
api키 붙여넣기한다.
Seacrbar에 적용
import { View, Text } from "react-native";
import { GooglePlacesAutocomplete } from "react-native-google-places-autocomplete";
import React from "react";
export default function SearchBar({ searchedLocation }) {
const apiKey = process.env.EXPO_PUBLIC_API_KEY;
return (
<View>
<GooglePlacesAutocomplete
placeholder="Search"
fetchDetails={true}
onPress={(data, details = null) => {
searchedLocation(details?.geometry?.location);
}}
query={{
key: apiKey,
language: "ko",
}}
/>
</View>
);
}