Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showsMyLocationButton을 클릭 후 콜백 함수 또는 animate 사용 방법이 있을까요? #183

Open
kdn0325 opened this issue Jun 9, 2023 · 1 comment

Comments

@kdn0325
Copy link

kdn0325 commented Jun 9, 2023

안녕하세요 감사하게 네이티브로 라이브러리 잘 쓰고 있습니다..

Version of react-native-naver-map libraries

react-native-nmap": "^0.0.66"

Version of react-native

react-native: ^0.70.6 => 0.70.6

Platforms you faced the error (IOS or Android or both?)

Android

Expected behavior

Actual behavior

  <NaverMapView
    ref={naverMapViewRef}
    mapType={0}
    compass={false} //나침반
    showsMyLocationButton={true}
    zoomControl={true}
    style={{ flex: 1 }}
    tiltGesturesEnabled={true}
    center={{ ...startCoord, zoom: 14 }}
    onTouch={(e) => console.warn("onTouch", JSON.stringify(e.nativeEvent))}
    onMapClick={handleMapClick}
  >

showsMyLocationButton을 클릭하고 나서의 동작을 콜백함수로 받을 수 있을까요?
showsMyLocationButton 클릭 후 getCurrentPosition의 위도 경도를 받아서 현재 위치에 animate 동작을 하고싶습니다

showsMyLocationButton을 클릭 후에 콜백 함수 또는 동작을 구현하는 방법

Tested environment (Emulator? Real Device?)

실제 디바이스 , 에뮬레이터

Screen Shot

스크린샷 2023-06-09 오후 3 04 26

스크린샷 2023-06-09 오후 3 04 59

###react native 환경

System:
OS: macOS 12.5.1
CPU: (8) arm64 Apple M1 Pro
Memory: 103.94 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.19.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.19.3 - /usr/local/bin/npm
Watchman: 2023.04.03.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.1 - /Users/name/.rvm/gems/ruby-2.7.5/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 23, 27, 28, 29, 30, 31, 32, 33, 33
Build Tools: 23.0.1, 27.0.3, 28.0.3, 29.0.2, 30.0.0, 30.0.1, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0, 33.0.1, 33.0.2
System Images: android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play ARM 64 v8a, android-30 | Google APIs ARM 64 v8a, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play ARM 64 v8a, android-30 | Google Play Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-32 | Desktop ARM 64 v8a, android-32 | Desktop Intel x86 Atom_64, android-32 | Google APIs ARM 64 v8a, android-32 | Google APIs Intel x86 Atom_64, android-32 | Google Play ARM 64 v8a, android-32 | Google Play Intel x86 Atom_64, android-33-ext4 | Google Play Intel x86_64 Atom, android-33 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_361 - /Users/name/.jenv/shims/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^18.2.0 => 18.2.0
react-native: ^0.70.6 => 0.70.6
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

@lazyflog
Copy link

커스텀으로 버튼 만드신 후 아래의 코드를 활용하셔서 함수 만드셔서 사용하시면 될것같네요 :)

const handleButtonPress = () => {
  naverMapViewRef.current?.setLocationTrackingMode(TrackingMode.NoFollow);
  // 하고싶으신 다음엑션
};
<Button onPress={handleButtonPress} />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants