From 9a990351b23e04a59e5896862698f443e3d1b583 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Wed, 8 Jun 2022 02:46:33 +0430 Subject: [PATCH] update 6 files --- android/build.gradle | 1 + ios/Podfile | 1 + ios/Podfile.lock | 29 ++++++++++++++++++++++----- src/components/MapSelector.js | 37 ++++++++++++++++------------------- src/screens/Address/index.js | 2 +- 5 files changed, 44 insertions(+), 26 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 90ad89d..f55f240 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -16,6 +16,7 @@ buildscript { // Otherwise we default to the side-by-side NDK version from AGP. ndkVersion = "21.4.7075529" } + } repositories { google() diff --git a/ios/Podfile b/ios/Podfile index 85c087e..327e586 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -20,6 +20,7 @@ target 'danovin' do ) permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-Camera', :path => "#{permissions_path}/Camera" + pod 'react-native-mapbox-gl', :path => '../node_modules/@react-native-mapbox-gl/maps' target 'danovinTests' do inherit! :complete diff --git a/ios/Podfile.lock b/ios/Podfile.lock index de9cf7e..ccdfe56 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -74,6 +74,9 @@ PODS: - fmt (6.2.1) - glog (0.3.5) - libevent (2.1.12) + - Mapbox-iOS-SDK (5.9.0): + - MapboxMobileEvents (= 0.10.2) + - MapboxMobileEvents (0.10.2) - OpenSSL-Universal (1.1.1100) - Permission-Camera (3.3.1): - RNPermissions @@ -292,8 +295,20 @@ PODS: - React-Core - react-native-camera/RN (4.2.1): - React-Core - - react-native-mapbox-gl (2.0.6): + - react-native-mapbox-gl (8.6.0-beta.0): + - Mapbox-iOS-SDK (~> 5.9.0) - React + - React-Core + - react-native-mapbox-gl/DynamicLibrary (= 8.6.0-beta.0) + - react-native-mapbox-gl/StaticLibraryFixer (= 8.6.0-beta.0) + - react-native-mapbox-gl/DynamicLibrary (8.6.0-beta.0): + - Mapbox-iOS-SDK (~> 5.9.0) + - React + - React-Core + - react-native-mapbox-gl/StaticLibraryFixer (8.6.0-beta.0): + - Mapbox-iOS-SDK (~> 5.9.0) + - React + - React-Core - react-native-safe-area-context (4.3.1): - RCT-Folly - RCTRequired @@ -429,7 +444,7 @@ DEPENDENCIES: - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - react-native-camera (from `../node_modules/react-native-camera`) - - react-native-mapbox-gl (from `../node_modules/mapir-mapbox`) + - "react-native-mapbox-gl (from `../node_modules/@react-native-mapbox-gl/maps`)" - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) - react-native-video (from `../node_modules/react-native-video`) - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) @@ -464,6 +479,8 @@ SPEC REPOS: - FlipperKit - fmt - libevent + - Mapbox-iOS-SDK + - MapboxMobileEvents - OpenSSL-Universal - SocketRocket - YogaKit @@ -510,7 +527,7 @@ EXTERNAL SOURCES: react-native-camera: :path: "../node_modules/react-native-camera" react-native-mapbox-gl: - :path: "../node_modules/mapir-mapbox" + :path: "../node_modules/@react-native-mapbox-gl/maps" react-native-safe-area-context: :path: "../node_modules/react-native-safe-area-context" react-native-video: @@ -568,6 +585,8 @@ SPEC CHECKSUMS: fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 476ee3e89abb49e07f822b48323c51c57124b572 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 + Mapbox-iOS-SDK: a5915700ec84bc1a7f8b3e746d474789e35b7956 + MapboxMobileEvents: 2bc0ca2eedb627b73cf403258dce2b2fa98074a6 OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c Permission-Camera: bae27a8503530770c35aadfecbb97ec71823382a RCT-Folly: 4d8508a426467c48885f1151029bc15fa5d7b3b8 @@ -584,7 +603,7 @@ SPEC CHECKSUMS: React-jsinspector: c5989c77cb89ae6a69561095a61cce56a44ae8e8 React-logger: a0833912d93b36b791b7a521672d8ee89107aff1 react-native-camera: 3eae183c1d111103963f3dd913b65d01aef8110f - react-native-mapbox-gl: 80e6a70380f3dea6e8087fce0e08354267258562 + react-native-mapbox-gl: b92795f61ff130323e6d25693bd68b081e105455 react-native-safe-area-context: 6c12e3859b6f27b25de4fee8201cfb858432d8de react-native-video: 0bb76b6d6b77da3009611586c7dbf817b947f30e React-perflogger: a18b4f0bd933b8b24ecf9f3c54f9bf65180f3fe6 @@ -607,6 +626,6 @@ SPEC CHECKSUMS: Yoga: 99652481fcd320aefa4a7ef90095b95acd181952 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 3f6a032cec3c6ad798a7c435ab88ab63cc1c0148 +PODFILE CHECKSUM: b0d4cfa3a5bd4fa03605ffeda7fbfe9a6b27f860 COCOAPODS: 1.11.3 diff --git a/src/components/MapSelector.js b/src/components/MapSelector.js index 7283bed..b25a23b 100644 --- a/src/components/MapSelector.js +++ b/src/components/MapSelector.js @@ -1,17 +1,19 @@ import React from 'react'; -// import Mapir from 'mapir-react-native-sdk'; +import MapboxGL from '@react-native-mapbox-gl/maps'; + +MapboxGL.setAccessToken( + 'pk.eyJ1IjoicmV6YS1hc2hyYWZpNzciLCJhIjoiY2txdGNwZTUxMDZ1eTJwbHpwcDhhdWJ3ZCJ9.avkn_XgUReNTLAcQQelTYA', +); export default function MapSelector({setAddress}) { - const [markerCoordinates, setMarkerCoordinates] = React.useState({ - latitude: 35.7219, - longitude: 51.3347, - }); + const [coordinates, setCoordinates] = React.useState([51.3347, 35.7219]); const getLocation = location => { - setMarkerCoordinates(location); + console.log(location); + setCoordinates(location); try { fetch( - `https://map.ir/reverse/no?lat=${location.latitude}&lon=${location.longitude}`, + `https://map.ir/reverse/no?lat=${location[1]}&lon=${location[0]}`, { headers: { 'Content-Type': 'application/json', @@ -27,19 +29,14 @@ export default function MapSelector({setAddress}) { } }; - const onRegionDidChange = e => { - console.log('onRegionDidChange', e.geometry.coordinates); - }; - return ( - <> - // onRegionDidChange(e)} - // style={{width: '100%', height: '100%'}}> - // - // + { + getLocation(e.geometry.coordinates); + }}> + + + ); } diff --git a/src/screens/Address/index.js b/src/screens/Address/index.js index 9e755f2..df7e14c 100644 --- a/src/screens/Address/index.js +++ b/src/screens/Address/index.js @@ -550,7 +550,7 @@ const Address = ({ {!profilePage ? ( <> - + setMapAddress(text)} />