vbea преди 2 години
родител
ревизия
2c5a7124c4
променени са 2 файла, в които са добавени 23 реда и са изтрити 25 реда
  1. 11 6
      Strides-APP/app/pages/home/maps/Maps1.js
  2. 12 19
      Strides-APP/ios/Strides/AppDelegate.mm

+ 11 - 6
Strides-APP/app/pages/home/maps/Maps1.js

@@ -4,7 +4,7 @@
  */
 import React, { useEffect, useRef } from 'react';
 import { PROVIDER_GOOGLE } from 'react-native-maps';
-import { ClusterMap } from 'react-native-cluster-map';
+import MapView from "react-native-map-clustering";
 import { ClusterView, MyCluster, MyMarker } from './Cluster';
 
 export default Maps = ({ region, onMapReady, stopList, onMarkerPress }) => {
@@ -46,15 +46,20 @@ export default Maps = ({ region, onMapReady, stopList, onMarkerPress }) => {
   }
 
   return (
-    <ClusterMap
+    <MapView
       ref={mapRef}
+      superClusterRef={superClusterRef}
       style={ui.flex1}
-      region={region}
-      superClusterOptions={superClusterOptions}
+      minZoom={10}
+      maxZoom={15}
+      radius={45}
+      extent={512}
+      nodeSize={64}
       provider={PROVIDER_GOOGLE}
       onMapReady={onMapReady}
       showsUserLocation={true}
-      renderClusterMarker={getMyCluster}> 
+      initialRegion={region}
+      renderCluster={(info) => renderCluster(info)}>
       { stopList.map((marker, index) => {
         return (
           <MyMarker
@@ -65,6 +70,6 @@ export default Maps = ({ region, onMapReady, stopList, onMarkerPress }) => {
           />
         );
       })}
-    </ClusterMap>
+    </MapView>
   );
 }

+ 12 - 19
Strides-APP/ios/Strides/AppDelegate.mm

@@ -1,14 +1,16 @@
 #import "AppDelegate.h"
-
-#import <React/RCTBridge.h>
 #import <React/RCTBundleURLProvider.h>
-#import <React/RCTRootView.h>
+
 #import <GoogleMaps/GoogleMaps.h>
 
 #import <UserNotifications/UserNotifications.h>
 #import <RNCPushNotificationIOS.h>
+// 引入Firebase
+@import UserNotifications;
+#import "FirebaseCore.h"
+#import "FirebaseMessaging.h"
 
-#ifdef FB_SONARKIT_ENABLED
+/*#ifdef FB_SONARKIT_ENABLED
 #import <FlipperKit/FlipperClient.h>
 #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
 #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
@@ -25,11 +27,7 @@ static void InitializeFlipper(UIApplication *application) {
   [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
   [client start];
 }
-#endif
-
-@import UserNotifications;
-#import "FirebaseCore.h"
-#import "FirebaseMessaging.h"
+#endif*/
 
 @interface AppDelegate () <UNUserNotificationCenterDelegate>
 
@@ -52,18 +50,13 @@ static void InitializeFlipper(UIApplication *application) {
   [GMSServices provideAPIKey:@"AIzaSyAVzs860l2Iuu1zG80IT1Zu4w7OvbVmJ4g"]; // add this line using the api key obtained from Google Console
 
   //远程推送配置
-  // Define UNUserNotificationCenter
   [UNUserNotificationCenter currentNotificationCenter].delegate = self;
-  UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert |
-      UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
-  [[UNUserNotificationCenter currentNotificationCenter]
-      requestAuthorizationWithOptions:authOptions
-      completionHandler:^(BOOL granted, NSError * _Nullable error) {
-        // ...
-      }];
-
+  UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
+  [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions
+    completionHandler:^(BOOL granted, NSError * _Nullable error) {
+      // ...
+    }];
   [application registerForRemoteNotifications];
-  //return YES;
   return [super application:application didFinishLaunchingWithOptions:launchOptions];
 }