-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
일단 qr추가 #15
- Loading branch information
Showing
18 changed files
with
27,654 additions
and
4,563 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useState,useRef, useEffect } from 'react'; | ||
import { Map,CustomOverlayMap } from 'react-kakao-maps-sdk'; | ||
|
||
export const KakaoAPIMap = () => { | ||
|
||
const mapRef = useRef(null); | ||
const [myLocation, setMyLocation] = useState(''); | ||
const latitude=0, longitude=0; | ||
const currentPosition=[]; | ||
useEffect(() => { | ||
// geolocation 이용 현재 위치 확인, 위치 미동의 시 기본 위치로 지정 | ||
if (navigator.geolocation) { | ||
navigator.geolocation.getCurrentPosition((position) => { | ||
setMyLocation({ | ||
latitude: position.coords.latitude, | ||
longitude: position.coords.longitude, | ||
|
||
}); | ||
}); | ||
} else { | ||
window.alert('현재 위치를 알 수 없어 기본 위치로 지정합니다.'); | ||
setMyLocation({ latitude: 37.4862618, longitude: 127.1222903 }); | ||
} | ||
}, []); | ||
|
||
useEffect(() => { | ||
if (typeof myLocation !== 'string') { | ||
// 현재 위치 추적 | ||
currentPosition = [myLocation.latitude, myLocation.longitude]; | ||
console.log(currentPosition[0], currentPosition[1]); | ||
} | ||
|
||
}); | ||
|
||
|
||
return ( | ||
<Map | ||
center={{ lat: 37.496313, lng: 126.957037 }} | ||
style={{ width: "100%", height: "100vh" }} | ||
> | ||
<CustomOverlayMap position={{ lat: 37.496313, lng: 126.957037 }}> | ||
<div | ||
style={{padding:"10px", backgroundColor:"#fff", color:"#000"}} | ||
> | ||
숭실대학교 SSUMC | ||
</div> | ||
</CustomOverlayMap> | ||
</Map> | ||
) | ||
}; | ||
|
||
export default KakaoAPIMap; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useState,useRef, useEffect } from 'react'; | ||
import { Map,CustomOverlayMap } from 'react-kakao-maps-sdk'; | ||
|
||
export const KakaoAPIMap = () => { | ||
|
||
|
||
|
||
|
||
|
||
return ( | ||
|
||
|
||
); | ||
}; | ||
|
||
export default KakaoAPIMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React, {useState, useEffect} from "react"; | ||
import { QrReader } from "react-qr-reader"; | ||
|
||
export default function QrcodeScanner () { | ||
const [data, setData] = useState('No result'); | ||
const [hasRendered, setHasRendered] = useState(false); | ||
useEffect(() => { | ||
setHasRendered(true) | ||
}, []) | ||
|
||
return ( | ||
<> | ||
<div> | ||
{hasRendered && ( | ||
<QrReader | ||
onResult = {(result, error) =>{ | ||
if(!result) { | ||
setData(result?.text); | ||
console.log(result?.text); | ||
} | ||
if(!error) { | ||
console.info(error); | ||
} | ||
}} | ||
styles={{width : '100%'}}> | ||
</QrReader> | ||
)} | ||
|
||
</div> | ||
<p>{data}</p> | ||
|
||
</> | ||
) | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.