update 7 files

master
Reza_ashrafi 3 years ago
parent cb37a9b695
commit 78cdabb260
  1. 2
      package.json
  2. 92
      src/components/MapSelector.js
  3. 20
      src/screens/Address/index.js
  4. 34
      src/screens/DeliveryForm/index.js
  5. 2
      src/screens/ShoppingCart/index.js
  6. 4
      src/screens/Video/index.js
  7. 121
      yarn.lock

@ -35,7 +35,6 @@
"i18next": "^21.6.3",
"install": "^0.13.0",
"jalali-moment": "^3.3.11",
"mapir-react-native-sdk": "^2.2.4",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-i18next": "^11.15.1",
@ -43,7 +42,6 @@
"react-native-awesome-alerts": "^1.5.2",
"react-native-copilot": "^2.5.1",
"react-native-htmlview": "^0.16.0",
"react-native-maps": "0.29.4",
"react-native-openanything": "^0.0.6",
"react-native-qrcode-scanner": "^1.5.4",
"react-native-ratings": "^8.1.0",

@ -1,49 +1,49 @@
import React from "react";
import MapView, { Marker } from "react-native-maps";
// import React from "react";
// import MapView, { Marker } from "react-native-maps";
//assets
import markerIcon from "../assets/icons/marker.png";
// //assets
// import markerIcon from "../assets/icons/marker.png";
export default function MapSelector({ setAddress }) {
const [markerCoordinates, setMarkerCoordinates] = React.useState({
latitude: 35.7219,
longitude: 51.3347,
});
const getLocation = (location) => {
setMarkerCoordinates(location);
try {
fetch(
`https://map.ir/reverse/no?lat=${location.latitude}&lon=${location.longitude}`,
{
headers: {
"Content-Type": "application/json",
"x-api-key":
"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIn0.eyJhdWQiOiIxNjk2MSIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIiwiaWF0IjoxNjQ0MzE3MDA5LCJuYmYiOjE2NDQzMTcwMDksImV4cCI6MTY0NjgyMjYwOSwic3ViIjoiIiwic2NvcGVzIjpbImJhc2ljIl19.Gckmd77Vw-wmsaztsmVmjYmfp4zXRSy2f0tXS-1p7IY8VJmvCCrk64y7WvCLbH0YfGZI9rG9ZUi5hRJDDGXu70l1ZafCYq2-EkMzcbx-PGTTq2bHGNZujF4ur1xtGoXd2kwGuldiR_6SJdqYLHcupbscFI7hHaQnkN1xWJ-L8476ZOKzUgiBvwH9uElGZXwD6SwfXoGW_R38_isrnfTXKfW9PPixyLaN3404tcjOU1r02HIurrplXlIKRKG9CVXxKsESfJJ8trwtZw6O4erxrnisxfL0VwAR7l69P6KcFb57vvM4j4hKFqxUDr4YvSq1qOTt3urYbAKehhvoiLhZxw",
},
}
)
.then((response) => response.json())
.then((data) => setAddress(data.address));
} catch (err) {
console.log(err);
}
};
// export default function MapSelector({ setAddress }) {
// const [markerCoordinates, setMarkerCoordinates] = React.useState({
// latitude: 35.7219,
// longitude: 51.3347,
// });
// const getLocation = (location) => {
// setMarkerCoordinates(location);
// try {
// fetch(
// `https://map.ir/reverse/no?lat=${location.latitude}&lon=${location.longitude}`,
// {
// headers: {
// "Content-Type": "application/json",
// "x-api-key":
// "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIn0.eyJhdWQiOiIxNjk2MSIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIiwiaWF0IjoxNjQ0MzE3MDA5LCJuYmYiOjE2NDQzMTcwMDksImV4cCI6MTY0NjgyMjYwOSwic3ViIjoiIiwic2NvcGVzIjpbImJhc2ljIl19.Gckmd77Vw-wmsaztsmVmjYmfp4zXRSy2f0tXS-1p7IY8VJmvCCrk64y7WvCLbH0YfGZI9rG9ZUi5hRJDDGXu70l1ZafCYq2-EkMzcbx-PGTTq2bHGNZujF4ur1xtGoXd2kwGuldiR_6SJdqYLHcupbscFI7hHaQnkN1xWJ-L8476ZOKzUgiBvwH9uElGZXwD6SwfXoGW_R38_isrnfTXKfW9PPixyLaN3404tcjOU1r02HIurrplXlIKRKG9CVXxKsESfJJ8trwtZw6O4erxrnisxfL0VwAR7l69P6KcFb57vvM4j4hKFqxUDr4YvSq1qOTt3urYbAKehhvoiLhZxw",
// },
// }
// )
// .then((response) => response.json())
// .then((data) => setAddress(data.address));
// } catch (err) {
// console.log(err);
// }
// };
return (
<MapView
initialRegion={{
latitude: 35.7219,
longitude: 51.3347,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
style={{
width: "100%",
height: "100%",
}}
onPress={(e) => getLocation(e.nativeEvent.coordinate)}
>
<Marker coordinate={markerCoordinates} image={markerIcon} />
</MapView>
);
}
// return (
// <MapView
// initialRegion={{
// latitude: 35.7219,
// longitude: 51.3347,
// latitudeDelta: 0.0922,
// longitudeDelta: 0.0421,
// }}
// style={{
// width: "100%",
// height: "100%",
// }}
// onPress={(e) => getLocation(e.nativeEvent.coordinate)}
// >
// <Marker coordinate={markerCoordinates} image={markerIcon} />
// </MapView>
// );
// }

@ -23,7 +23,6 @@ import Navbar from "../../components/Navbar";
import CustomPressable from "../../components/Pressable";
import CustomTextInput from "../../components/CustomTextInput";
import Select from "../../components/Select";
import MapSelector from "../../components/MapSelector";
//style
import tw from "tailwind-rn";
@ -553,24 +552,7 @@ const Address = ({
</View>
{!profilePage ? (
<>
<View
style={{
width: "100%",
height: height / 4,
marginTop: 20,
borderWidth: 1,
borderRadius: 2,
overflow: "hidden",
borderColor:
theme === "light"
? Colors.theme1.gray2077 + "66"
: Colors.theme1.grayE3,
}}
>
<MapSelector
setAddress={(address) => setMapAddress(address)}
/>
</View>
{/* */}
<TextInput
style={[
tw("w-full mt-4 py-4 px-2 rounded-sm h-40"),

@ -6,11 +6,12 @@ import {
StatusBar,
Platform,
Dimensions,
Text
Text,
} from "react-native";
import React, { useEffect } from "react";
import { connect } from "react-redux";
import { userFactor, userAddress } from "../../redux/actions";
import { useNavigation } from "@react-navigation/native";
import { asyncAwesomeAlert } from "../../utils/AsyncWrappers";
import separate from "../../utils/separate";
@ -93,7 +94,9 @@ const DeliveryForm = ({
payFactor,
factorInfo,
theme,
user,
}) => {
const navigation = useNavigation();
useEffect(() => {
getFactorInfo({ userId });
getList();
@ -158,7 +161,9 @@ const DeliveryForm = ({
/>
<PriceStatus
name="هزینه ارسال"
value={separate(Math.round(list?.length ? factorInfo?.transportPrice : 0))}
value={separate(
Math.round(list?.length ? factorInfo?.transportPrice : 0)
)}
type="error"
theme={theme}
/>
@ -230,12 +235,24 @@ const DeliveryForm = ({
border={{ color: "#196EC0", width: 0 }}
width={"100%"}
onPress={() =>
factorInfo?.transportId && factorInfo?.userAddressId
? payFactor({ userId, clientUrl: "dnvn://" })
: asyncAwesomeAlert("خطا", "آدرس یا نحوه ارسال را وارد کنید", {
showCancelButton: false,
confirmText: "باشه",
})
user?.postalCode && user?.phone
? factorInfo?.transportId && factorInfo?.userAddressId
? payFactor({ userId, clientUrl: "dnvn://" })
: asyncAwesomeAlert("خطا", "آدرس یا نحوه ارسال را وارد کنید", {
showCancelButton: false,
confirmText: "باشه",
})
: asyncAwesomeAlert(
"خطا",
"اطلاعات حساب کاربری شما (مانند: شماره تلفن یا کد پستی) ناقص است.",
{
showCancelButton: true,
confirmText: "رفتن به پروفایل",
cancelText: "انصراف",
onConfirm: () =>
navigation.navigate("CreateAddress", { type: "profile" }),
}
)
}
/>
</View>
@ -253,6 +270,7 @@ const styles = StyleSheet.create({
});
const mapStateToProps = (state) => ({
user: state.user.status,
factorInfo: state.userFactor.info,
userId: state.user.status?.id,
list: state.userAddress.list,

@ -110,7 +110,7 @@ function ShoppingCart({
return (
list?.filter(
(product) => product?.condition < 2 && product?.productType === 2
)?.length !== 0
)?.length
);
}, [list]);

@ -194,7 +194,7 @@ function Product({
title={
videoAvailableForSell
? `خرید با قیمت ${separate(
book?.product[2]?.price || " "
videoProduct?.price || " "
)} تومان`
: "ناموجود"
}
@ -221,7 +221,7 @@ function Product({
: videoAvailableForSell
? addToCart(
pushToCart({
productId: book?.product[2]?.id,
productId: videoProduct?.id,
userId: userId,
count: 1,
})

@ -1350,18 +1350,6 @@
dependencies:
dequal "^1.0.0"
"@mapbox/geo-viewport@^0.4.0":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@mapbox/geo-viewport/-/geo-viewport-0.4.1.tgz#a184c0b161975858a2e855a1e333e66af342964b"
integrity sha512-5g6eM3EOSl7+0p0VY+vHWEYjUlNzof936VKHTi/NuJVABjbYe8D2NAVJ0qt5C9Np4glUlhKFepgAgQ0OEybrjQ==
dependencies:
"@mapbox/sphericalmercator" "~1.1.0"
"@mapbox/sphericalmercator@~1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@mapbox/sphericalmercator/-/sphericalmercator-1.1.0.tgz#f3b1af042620716a1289fc41e1e97f610823aefe"
integrity sha512-pEsfZyG4OMThlfFQbCte4gegvHUjxXCjz0KZ4Xk8NdOYTQBLflj6U8PL05RPAiuRAMAQNUUKJuL6qYZ5Y4kAWA==
"@nodelib/fs.scandir@2.1.5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
@ -1619,63 +1607,6 @@
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==
"@turf/along@^6.0.1":
version "6.5.0"
resolved "https://registry.yarnpkg.com/@turf/along/-/along-6.5.0.tgz#ab12eec58a14de60fe243a62d31a474f415c8fef"
integrity sha512-LLyWQ0AARqJCmMcIEAXF4GEu8usmd4Kbz3qk1Oy5HoRNpZX47+i5exQtmIWKdqJ1MMhW26fCTXgpsEs5zgJ5gw==
dependencies:
"@turf/bearing" "^6.5.0"
"@turf/destination" "^6.5.0"
"@turf/distance" "^6.5.0"
"@turf/helpers" "^6.5.0"
"@turf/invariant" "^6.5.0"
"@turf/bearing@^6.5.0":
version "6.5.0"
resolved "https://registry.yarnpkg.com/@turf/bearing/-/bearing-6.5.0.tgz#462a053c6c644434bdb636b39f8f43fb0cd857b0"
integrity sha512-dxINYhIEMzgDOztyMZc20I7ssYVNEpSv04VbMo5YPQsqa80KO3TFvbuCahMsCAW5z8Tncc8dwBlEFrmRjJG33A==
dependencies:
"@turf/helpers" "^6.5.0"
"@turf/invariant" "^6.5.0"
"@turf/destination@^6.5.0":
version "6.5.0"
resolved "https://registry.yarnpkg.com/@turf/destination/-/destination-6.5.0.tgz#30a84702f9677d076130e0440d3223ae503fdae1"
integrity sha512-4cnWQlNC8d1tItOz9B4pmJdWpXqS0vEvv65bI/Pj/genJnsL7evI0/Xw42RvEGROS481MPiU80xzvwxEvhQiMQ==
dependencies:
"@turf/helpers" "^6.5.0"
"@turf/invariant" "^6.5.0"
"@turf/distance@^6.0.1", "@turf/distance@^6.5.0":
version "6.5.0"
resolved "https://registry.yarnpkg.com/@turf/distance/-/distance-6.5.0.tgz#21f04d5f86e864d54e2abde16f35c15b4f36149a"
integrity sha512-xzykSLfoURec5qvQJcfifw/1mJa+5UwByZZ5TZ8iaqjGYN0vomhV9aiSLeYdUGtYRESZ+DYC/OzY+4RclZYgMg==
dependencies:
"@turf/helpers" "^6.5.0"
"@turf/invariant" "^6.5.0"
"@turf/helpers@4.6.0":
version "4.6.0"
resolved "https://registry.yarnpkg.com/@turf/helpers/-/helpers-4.6.0.tgz#12398733b8ae28420df6166fa44c7ee8ffd6414c"
integrity sha1-EjmHM7iuKEIN9hZvpEx+6P/WQUw=
"@turf/helpers@^6.5.0":
version "6.5.0"
resolved "https://registry.yarnpkg.com/@turf/helpers/-/helpers-6.5.0.tgz#f79af094bd6b8ce7ed2bd3e089a8493ee6cae82e"
integrity sha512-VbI1dV5bLFzohYYdgqwikdMVpe7pJ9X3E+dlr425wa2/sMJqYDhTO++ec38/pcPvPE6oD9WEEeU3Xu3gza+VPw==
"@turf/invariant@^6.5.0":
version "6.5.0"
resolved "https://registry.yarnpkg.com/@turf/invariant/-/invariant-6.5.0.tgz#970afc988023e39c7ccab2341bd06979ddc7463f"
integrity sha512-Wv8PRNCtPD31UVbdJE/KVAWKe7l6US+lJItRR/HOEW3eh+U/JwRCSUl/KZ7bmjM/C+zLNoreM2TU6OoLACs4eg==
dependencies:
"@turf/helpers" "^6.5.0"
"@types/geojson@^7946.0.7":
version "7946.0.8"
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.8.tgz#30744afdb385e2945e22f3b033f897f76b1f12ca"
integrity sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA==
"@types/graceful-fs@^4.1.2":
version "4.1.5"
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15"
@ -1973,13 +1904,6 @@ atob@^2.1.2:
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
axios@^0.19.2:
version "0.19.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
dependencies:
follow-redirects "1.5.10"
axios@^0.24.0:
version "0.24.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6"
@ -2686,13 +2610,6 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
dependencies:
ms "2.0.0"
debug@=3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"
debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2:
version "4.3.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664"
@ -3390,13 +3307,6 @@ flow-parser@^0.121.0:
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.121.0.tgz#9f9898eaec91a9f7c323e9e992d81ab5c58e618f"
integrity sha512-1gIBiWJNR0tKUNv8gZuk7l9rVX06OuLzY9AoGio7y/JT4V1IZErEMEq2TJS+PFcw/y0RshZ1J/27VfK1UQzYVg==
follow-redirects@1.5.10:
version "1.5.10"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
dependencies:
debug "=3.1.0"
follow-redirects@^1.14.4:
version "1.14.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.6.tgz#8cfb281bbc035b3c067d6cd975b0f6ade6e855cd"
@ -4401,25 +4311,6 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"
mapir-mapbox@2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/mapir-mapbox/-/mapir-mapbox-2.0.6.tgz#38ec066b085651ea650236c2d571b419ba229538"
integrity sha512-aGUysx2YzYwrJVzXwO8IWtBqaWITg8sKwKwjVv+21g6Bmg0HNiVB9LGQvNuMkqtmhhD7GIT2Ys9T4TqHxD+g8g==
dependencies:
"@mapbox/geo-viewport" "^0.4.0"
"@turf/along" "^6.0.1"
"@turf/distance" "^6.0.1"
"@turf/helpers" "4.6.0"
underscore "^1.8.3"
mapir-react-native-sdk@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/mapir-react-native-sdk/-/mapir-react-native-sdk-2.2.4.tgz#fc5ddcc583e8aa2eab5f4ef574a34ef65f20c5ce"
integrity sha512-ACNP9h2/M98SL+XMVMfFOj+ocbxNlLFgzZoz6cQ4ZOQo+RCZxThyV+IcbbMeFXwJK3jiKLWBzIsaICJwibeLkg==
dependencies:
axios "^0.19.2"
mapir-mapbox "2.0.6"
match-all@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/match-all/-/match-all-1.2.6.tgz#66d276ad6b49655551e63d3a6ee53e8be0566f8d"
@ -5574,13 +5465,6 @@ react-native-iphone-x-helper@^1.3.0:
resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz#20c603e9a0e765fd6f97396638bdeb0e5a60b010"
integrity sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==
react-native-maps@0.29.4:
version "0.29.4"
resolved "https://registry.yarnpkg.com/react-native-maps/-/react-native-maps-0.29.4.tgz#eb4a446104ed2aca5361422d06712f26d4c0d562"
integrity sha512-Td2KE8+KODcHOxfB1GBNnzFo4/89rlLiC7yTvqQZh0tGVrEzIcgSleUZRrjtq/WvSWSR4rql4AS+0VsBgDkYrw==
dependencies:
"@types/geojson" "^7946.0.7"
react-native-openanything@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/react-native-openanything/-/react-native-openanything-0.0.6.tgz#7b694a28ce6de0363d46474ab3c72f5c0d14e658"
@ -6663,11 +6547,6 @@ ultron@1.0.x:
resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.0.2.tgz#ace116ab557cd197386a4e88f4685378c8b2e4fa"
integrity sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=
underscore@^1.8.3:
version "1.13.2"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.2.tgz#276cea1e8b9722a8dbed0100a407dda572125881"
integrity sha512-ekY1NhRzq0B08g4bGuX4wd2jZx5GnKz6mKSqFL4nqBlfyMGiG10gDFhDTMEfYmDL6Jy0FUIZp7wiRB+0BP7J2g==
unicode-canonical-property-names-ecmascript@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc"

Loading…
Cancel
Save