Skip to content

Commit

Permalink
fix(android): add missing ground view manager
Browse files Browse the repository at this point in the history
  • Loading branch information
mym0404 committed May 8, 2024
1 parent b624561 commit a3e73ae
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,6 +23,7 @@ class RNCNaverMapPackage : ReactPackage {
add(RNCNaverMapPolylineManager())
add(RNCNaverMapPathManager())
add(RNCNaverMapArrowheadPathManager())
add(RNCNaverMapGroundManager())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ class RNCNaverMapViewManager : RNCNaverMapViewManagerSpec<RNCNaverMapViewWrapper
initialProps?.getString("locale")?.also { locale ->
locale(Locale.forLanguageTag(locale))
}
initialProps?.getInt("fpsLimit", -1)?.also { fps ->
if (fps > 0) {
fpsLimit(fps)
}
}
}
return super.createViewInstance(reactTag, reactContext, initialProps, stateWrapper)
}
Expand Down Expand Up @@ -594,6 +599,14 @@ class RNCNaverMapViewManager : RNCNaverMapViewManagerSpec<RNCNaverMapViewWrapper
}
}

@ReactProp(name = "fpsLimit")
override fun setFpsLimit(
view: RNCNaverMapViewWrapper?,
value: Int,
) {
// noop
}

// endregion

// region COMMANDS
Expand Down
5 changes: 5 additions & 0 deletions android/src/oldarch/RNCNaverMapViewManagerSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ internal interface RNCNaverMapViewManagerInterface<T : ViewGroup?> {
view: T,
value: ReadableMap?,
)

fun setFpsLimit(
view: T,
value: Int,
)
}

abstract class RNCNaverMapViewManagerSpec<T : ViewGroup> :
Expand Down
1 change: 1 addition & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export default function App() {
TRAFFIC: false,
TRANSIT: false,
}}
fpsLimit={0}
isIndoorEnabled={indoor}
lightness={lightness}
isNightModeEnabled={nightMode}
Expand Down
13 changes: 13 additions & 0 deletions src/component/NaverMapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,17 @@ export interface NaverMapViewProps extends ViewProps {
animate?: boolean;
}[];

/**
* 지도의 최대 초당 프레임 수(FPS, frames per second)를 지정합니다.
*
* 지도 객체가 생길때의 초기값만 동작하고 동적으로 바꿀 수 없습니다.
*
* 기본값은 제한을 두지 않음을 의미하는 0입니다.
*
* @default 0
*/
fpsLimit?: number;

/**
* 지도 객체가 초기화가 완료된 뒤에 호출됩니다.
*
Expand Down Expand Up @@ -574,6 +585,7 @@ export const NaverMapView = forwardRef(
isUseTextureViewAndroid = false,
locale,
clusters,
fpsLimit = 0,

...rest
}: NaverMapViewProps,
Expand Down Expand Up @@ -910,6 +922,7 @@ export const NaverMapView = forwardRef(
clusters={_clusters}
onScreenToCoordinate={onScreenToCoordinate}
onCoordinateToScreen={onCoordinateToScreen}
fpsLimit={fpsLimit}
{...rest}
/>
);
Expand Down
1 change: 1 addition & 0 deletions src/spec/RNCNaverMapViewNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ interface Props extends ViewProps {
locale?: string;

clusters?: NativeClustersProp;
fpsLimit?: Int32;

onInitialized?: DirectEventHandler<Readonly<{}>>;
onOptionChanged?: DirectEventHandler<Readonly<{}>>;
Expand Down

0 comments on commit a3e73ae

Please sign in to comment.