From a3e73aed19c3e6ea484039c0b72eff4d65ef44fa Mon Sep 17 00:00:00 2001 From: mym0404 Date: Thu, 9 May 2024 00:09:14 +0900 Subject: [PATCH] fix(android): add missing ground view manager --- .../reactnativenavermap/RNCNaverMapPackage.kt | 2 ++ .../mapview/RNCNaverMapViewManager.kt | 13 +++++++++++++ android/src/oldarch/RNCNaverMapViewManagerSpec.kt | 5 +++++ example/src/App.tsx | 1 + src/component/NaverMapView.tsx | 13 +++++++++++++ src/spec/RNCNaverMapViewNativeComponent.ts | 1 + 6 files changed, 35 insertions(+) diff --git a/android/src/main/java/com/mjstudio/reactnativenavermap/RNCNaverMapPackage.kt b/android/src/main/java/com/mjstudio/reactnativenavermap/RNCNaverMapPackage.kt index e4862bcb..d4071b8a 100644 --- a/android/src/main/java/com/mjstudio/reactnativenavermap/RNCNaverMapPackage.kt +++ b/android/src/main/java/com/mjstudio/reactnativenavermap/RNCNaverMapPackage.kt @@ -7,6 +7,7 @@ import com.facebook.react.uimanager.ViewManager import com.mjstudio.reactnativenavermap.mapview.RNCNaverMapViewManager import com.mjstudio.reactnativenavermap.overlay.arrowheadpath.RNCNaverMapArrowheadPathManager import com.mjstudio.reactnativenavermap.overlay.circle.RNCNaverMapCircleManager +import com.mjstudio.reactnativenavermap.overlay.ground.RNCNaverMapGroundManager import com.mjstudio.reactnativenavermap.overlay.marker.RNCNaverMapMarkerManager import com.mjstudio.reactnativenavermap.overlay.path.RNCNaverMapPathManager import com.mjstudio.reactnativenavermap.overlay.polygon.RNCNaverMapPolygonManager @@ -22,6 +23,7 @@ class RNCNaverMapPackage : ReactPackage { add(RNCNaverMapPolylineManager()) add(RNCNaverMapPathManager()) add(RNCNaverMapArrowheadPathManager()) + add(RNCNaverMapGroundManager()) } } diff --git a/android/src/main/java/com/mjstudio/reactnativenavermap/mapview/RNCNaverMapViewManager.kt b/android/src/main/java/com/mjstudio/reactnativenavermap/mapview/RNCNaverMapViewManager.kt index b67be281..12f35334 100644 --- a/android/src/main/java/com/mjstudio/reactnativenavermap/mapview/RNCNaverMapViewManager.kt +++ b/android/src/main/java/com/mjstudio/reactnativenavermap/mapview/RNCNaverMapViewManager.kt @@ -87,6 +87,11 @@ class RNCNaverMapViewManager : RNCNaverMapViewManagerSpec locale(Locale.forLanguageTag(locale)) } + initialProps?.getInt("fpsLimit", -1)?.also { fps -> + if (fps > 0) { + fpsLimit(fps) + } + } } return super.createViewInstance(reactTag, reactContext, initialProps, stateWrapper) } @@ -594,6 +599,14 @@ class RNCNaverMapViewManager : RNCNaverMapViewManagerSpec { view: T, value: ReadableMap?, ) + + fun setFpsLimit( + view: T, + value: Int, + ) } abstract class RNCNaverMapViewManagerSpec : diff --git a/example/src/App.tsx b/example/src/App.tsx index 97ab4681..e6d4a091 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -321,6 +321,7 @@ export default function App() { TRAFFIC: false, TRANSIT: false, }} + fpsLimit={0} isIndoorEnabled={indoor} lightness={lightness} isNightModeEnabled={nightMode} diff --git a/src/component/NaverMapView.tsx b/src/component/NaverMapView.tsx index 45daade0..48f6c3df 100644 --- a/src/component/NaverMapView.tsx +++ b/src/component/NaverMapView.tsx @@ -377,6 +377,17 @@ export interface NaverMapViewProps extends ViewProps { animate?: boolean; }[]; + /** + * 지도의 최대 초당 프레임 수(FPS, frames per second)를 지정합니다. + * + * 지도 객체가 생길때의 초기값만 동작하고 동적으로 바꿀 수 없습니다. + * + * 기본값은 제한을 두지 않음을 의미하는 0입니다. + * + * @default 0 + */ + fpsLimit?: number; + /** * 지도 객체가 초기화가 완료된 뒤에 호출됩니다. * @@ -574,6 +585,7 @@ export const NaverMapView = forwardRef( isUseTextureViewAndroid = false, locale, clusters, + fpsLimit = 0, ...rest }: NaverMapViewProps, @@ -910,6 +922,7 @@ export const NaverMapView = forwardRef( clusters={_clusters} onScreenToCoordinate={onScreenToCoordinate} onCoordinateToScreen={onCoordinateToScreen} + fpsLimit={fpsLimit} {...rest} /> ); diff --git a/src/spec/RNCNaverMapViewNativeComponent.ts b/src/spec/RNCNaverMapViewNativeComponent.ts index dcb273b8..93512a1a 100644 --- a/src/spec/RNCNaverMapViewNativeComponent.ts +++ b/src/spec/RNCNaverMapViewNativeComponent.ts @@ -125,6 +125,7 @@ interface Props extends ViewProps { locale?: string; clusters?: NativeClustersProp; + fpsLimit?: Int32; onInitialized?: DirectEventHandler>; onOptionChanged?: DirectEventHandler>;