Skip to content

Commit

Permalink
feat: basic impl
Browse files Browse the repository at this point in the history
  • Loading branch information
SkipperQ93 committed Feb 25, 2024
1 parent 825786e commit 82271e9
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
49 changes: 49 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,55 @@ export default function App() {
onPointTap={(data) => {
console.log('data', JSON.stringify(data.nativeEvent));
}}
onMapViewLoad={() => {
mapRef.current?.addPoints([
{
latitude: '24.863053760789168',
longitude: '51.10819798512265',
attributes: {
isActive: true,
user: {
id: 532,
callSign: 'User1',
},
member: {
id: 487,
},
pictureUrl: 'https://i.imgur.com/1QY2ldB.png',
},
},
{
latitude: '25.933428249335368',
longitude: '51.25955023735113',
attributes: {
isActive: true,
user: {
id: 553,
callSign: 'User1',
},
member: {
id: 487,
},
pictureUrl: 'https://i.imgur.com/1QY2ldB.png',
},
},
{
latitude: '24.861246157675627',
longitude: '51.11047339547602',
attributes: {
isActive: true,
user: {
id: 554,
callSign: 'User1',
},
member: {
id: 487,
},
pictureUrl: 'https://i.imgur.com/1QY2ldB.png',
},
},
]);
}}
/>
<Pressable
style={{
Expand Down
1 change: 1 addition & 0 deletions ios/UaReactNativeArcgisViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ @interface RCT_EXTERN_MODULE(UaReactNativeArcgisViewManager, RCTViewManager)
RCT_EXPORT_VIEW_PROPERTY(pinpointMode, BOOL)
RCT_EXPORT_VIEW_PROPERTY(layers, NSArray)
RCT_EXPORT_VIEW_PROPERTY(onPointTap, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onMapViewLoad, RCTBubblingEventBlock)
RCT_EXTERN_METHOD(addPoints:(nonnull NSNumber*)node pointsDict:(NSArray*)pointsDict)
RCT_EXTERN_METHOD(changeOnlineStatus:(nonnull NSNumber*)node userId:(int)userId onlineStatus:(BOOL)onlineStatus)
RCT_EXTERN_METHOD(changeLocation:(nonnull NSNumber*)node userInformation:(NSDictionary*)userInformation latitude:(NSString*)latitude longitude:(NSString)longitude)
Expand Down
10 changes: 10 additions & 0 deletions ios/UaReactNativeArcgisViewManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ class UaReactNativeArcgisView : UIView, AGSGeoViewTouchDelegate {
@objc var pinpointUrlString: String = ""
@objc var pinpointMode: Bool = false
@objc var onPointTap: RCTBubblingEventBlock?
@objc var onMapViewLoad: RCTBubblingEventBlock? {
didSet {
if let mapView = mapView {
onMapViewLoad?([:])
}
}
}


override init(frame: CGRect) {
Expand All @@ -78,6 +85,9 @@ class UaReactNativeArcgisView : UIView, AGSGeoViewTouchDelegate {
NSLayoutConstraint.activate([leftConstraint, topConstraint, rightConstraint, bottomConstraint])

mapView.touchDelegate = self

onMapViewLoad?([:])

}

required init?(coder: NSCoder) {
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type UaReactNativeArcgisProps = {
pinpointUrlString?: string;
pinpointMode?: boolean;
onPointTap?: (data: { nativeEvent: object }) => void;
onMapViewLoad?: () => void;
};

type UaReactNativeArcgisInternalRefProps = {
Expand Down

0 comments on commit 82271e9

Please sign in to comment.