-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
291 additions
and
79 deletions.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
android/src/main/java/com/mjstudio/reactnativenavermap/event/NaverMapCameraChangeEvent.kt
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,23 @@ | ||
package com.mjstudio.reactnativenavermap.event | ||
|
||
import com.facebook.react.bridge.Arguments | ||
import com.facebook.react.bridge.WritableMap | ||
import com.facebook.react.uimanager.events.Event | ||
|
||
class NaverMapCameraChangeEvent( | ||
surfaceId: Int, viewId: Int, private val latitude: Double, private val longitude: Double, private val zoom: Double | ||
) : Event<NaverMapCameraChangeEvent>(surfaceId, viewId) { | ||
override fun getEventName(): String = EVENT_NAME | ||
override fun canCoalesce(): Boolean = false | ||
override fun getCoalescingKey(): Short = 0 | ||
override fun getEventData(): WritableMap = Arguments.createMap().apply { | ||
putDouble("latitude", latitude) | ||
putDouble("longitude", longitude) | ||
putDouble("zoom", zoom) | ||
} | ||
|
||
companion object { | ||
const val EVENT_NAME = "onCameraChanged" | ||
} | ||
} | ||
|
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,77 @@ | ||
/** | ||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). | ||
* <p> | ||
* Do not edit this file as changes may cause incorrect behavior and will be lost | ||
* once the code is regenerated. | ||
* | ||
* @generated by codegen project: GeneratePropsJavaDelegate.js | ||
*/ | ||
|
||
|
||
import android.view.View; | ||
|
||
import com.facebook.react.bridge.ReadableArray; | ||
import com.facebook.react.bridge.ReadableMap; | ||
import com.facebook.react.uimanager.BaseViewManagerDelegate; | ||
import com.facebook.react.uimanager.BaseViewManagerInterface; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
public class RNCNaverMapViewManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNCNaverMapViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> { | ||
public RNCNaverMapViewManagerDelegate(U viewManager) { | ||
super(viewManager); | ||
} | ||
|
||
@Override | ||
public void setProperty(T view, String propName, @Nullable Object value) { | ||
switch (propName) { | ||
case "mapType": | ||
mViewManager.setMapType(view, (String) value); | ||
break; | ||
case "layerGroups": | ||
mViewManager.setLayerGroups(view, (ReadableArray) value); | ||
break; | ||
case "isIndoorEnabled": | ||
mViewManager.setIsIndoorEnabled(view, value == null ? false : (boolean) value); | ||
break; | ||
case "isNightModeEnabled": | ||
mViewManager.setIsNightModeEnabled(view, value == null ? false : (boolean) value); | ||
break; | ||
case "isLiteModeEnabled": | ||
mViewManager.setIsLiteModeEnabled(view, value == null ? false : (boolean) value); | ||
break; | ||
case "lightness": | ||
mViewManager.setLightness(view, value == null ? 0f : ((Double) value).doubleValue()); | ||
break; | ||
case "buildingHeight": | ||
mViewManager.setBuildingHeight(view, value == null ? 1f : ((Double) value).doubleValue()); | ||
break; | ||
case "symbolScale": | ||
mViewManager.setSymbolScale(view, value == null ? 1f : ((Double) value).doubleValue()); | ||
break; | ||
case "symbolPerspectiveRatio": | ||
mViewManager.setSymbolPerspectiveRatio(view, value == null ? 1f : ((Double) value).doubleValue()); | ||
break; | ||
case "center": | ||
mViewManager.setCenter(view, (ReadableMap) value); | ||
break; | ||
case "mapPadding": | ||
mViewManager.setMapPadding(view, (ReadableMap) value); | ||
break; | ||
default: | ||
super.setProperty(view, propName, value); | ||
} | ||
} | ||
|
||
@Override | ||
public void receiveCommand(T view, String commandName, ReadableArray args) { | ||
switch (commandName) { | ||
case "animateToCoordinate": | ||
mViewManager.animateToCoordinate(view, args.getDouble(0), args.getDouble(1)); | ||
break; | ||
case "animateToBound": | ||
mViewManager.animateToBound(view, args.getString(0)); | ||
break; | ||
} | ||
} | ||
} |
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,43 @@ | ||
/** | ||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). | ||
* <p> | ||
* Do not edit this file as changes may cause incorrect behavior and will be lost | ||
* once the code is regenerated. | ||
* | ||
* @generated by codegen project: GeneratePropsJavaInterface.js | ||
*/ | ||
|
||
import android.view.View; | ||
|
||
import com.facebook.react.bridge.ReadableArray; | ||
import com.facebook.react.bridge.ReadableMap; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
public interface RNCNaverMapViewManagerInterface<T extends View> { | ||
void setMapType(T view, @Nullable String value); | ||
|
||
void setLayerGroups(T view, @Nullable ReadableArray value); | ||
|
||
void setIsIndoorEnabled(T view, boolean value); | ||
|
||
void setIsNightModeEnabled(T view, boolean value); | ||
|
||
void setIsLiteModeEnabled(T view, boolean value); | ||
|
||
void setLightness(T view, double value); | ||
|
||
void setBuildingHeight(T view, double value); | ||
|
||
void setSymbolScale(T view, double value); | ||
|
||
void setSymbolPerspectiveRatio(T view, double value); | ||
|
||
void setCenter(T view, @Nullable ReadableMap value); | ||
|
||
void setMapPadding(T view, @Nullable ReadableMap value); | ||
|
||
void animateToCoordinate(T view, double latitude, double longitude); | ||
|
||
void animateToBound(T view, String encodedJsonString); | ||
} |
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 |
---|---|---|
@@ -1,8 +1,20 @@ | ||
package com.mjstudio.reactnativenavermap | ||
|
||
import android.view.View | ||
import RNCNaverMapViewManagerDelegate | ||
import RNCNaverMapViewManagerInterface | ||
import android.view.ViewGroup | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
import com.facebook.react.uimanager.ViewGroupManager | ||
import com.facebook.react.uimanager.ViewManagerDelegate | ||
|
||
abstract class RNCNaverMapViewManagerSpec<T : ViewGroup> : ViewGroupManager<T>() {} | ||
abstract class RNCNaverMapViewManagerSpec<T : ViewGroup> : ViewGroupManager<T>(), | ||
RNCNaverMapViewManagerInterface<T> { | ||
private val mDelegate: ViewManagerDelegate<T> | ||
|
||
init { | ||
mDelegate = RNCNaverMapViewManagerDelegate(this) | ||
} | ||
|
||
override fun getDelegate(): ViewManagerDelegate<T>? { | ||
return mDelegate | ||
} | ||
} |
Oops, something went wrong.