update 8 files

master
Reza_ashrafi 2 years ago
parent 2611d03510
commit b93c1a351d
  1. 2
      package.json
  2. BIN
      src/assets/icons/marker.png
  3. 2
      src/components/Avatar.js
  4. 59
      src/components/MapSelector.js
  5. 6
      src/redux/reducers/file.js
  6. 70
      src/screens/Address/index.js
  7. 7
      src/screens/Home/index.js
  8. 13
      src/screens/Profile/components/User.js
  9. 17
      yarn.lock

@ -9,7 +9,6 @@
"eject": "expo eject" "eject": "expo eject"
}, },
"dependencies": { "dependencies": {
"@expo-google-fonts/noto-sans": "^0.2.0",
"@react-native-async-storage/async-storage": "~1.15.0", "@react-native-async-storage/async-storage": "~1.15.0",
"@react-native-community/netinfo": "7.1.3", "@react-native-community/netinfo": "7.1.3",
"@react-native-community/slider": "4.1.12", "@react-native-community/slider": "4.1.12",
@ -44,6 +43,7 @@
"react-native-awesome-alerts": "^1.5.2", "react-native-awesome-alerts": "^1.5.2",
"react-native-copilot": "^2.5.1", "react-native-copilot": "^2.5.1",
"react-native-htmlview": "^0.16.0", "react-native-htmlview": "^0.16.0",
"react-native-maps": "0.29.4",
"react-native-openanything": "^0.0.6", "react-native-openanything": "^0.0.6",
"react-native-qrcode-scanner": "^1.5.4", "react-native-qrcode-scanner": "^1.5.4",
"react-native-ratings": "^8.1.0", "react-native-ratings": "^8.1.0",

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -80,7 +80,7 @@ function Avatar({ source, size, theme, action }) {
style={tw("mr-2 absolute top-4 right-2")} style={tw("mr-2 absolute top-4 right-2")}
size={24} size={24}
color={ color={
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white theme === "light" ? Colors.theme1.white : Colors.theme1.white
} }
onPress={() => setOpenModal(false)} onPress={() => setOpenModal(false)}
/> />

@ -1,22 +1,49 @@
import React from "react"; import React from "react";
// import Mapir from "mapir-react-native-sdk"; import MapView, { Marker } from "react-native-maps";
// const X_API_KEY = //assets
// "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIn0.eyJhdWQiOiIxNjk2MSIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIiwiaWF0IjoxNjQ0MzE3MDA5LCJuYmYiOjE2NDQzMTcwMDksImV4cCI6MTY0NjgyMjYwOSwic3ViIjoiIiwic2NvcGVzIjpbImJhc2ljIl19.Gckmd77Vw-wmsaztsmVmjYmfp4zXRSy2f0tXS-1p7IY8VJmvCCrk64y7WvCLbH0YfGZI9rG9ZUi5hRJDDGXu70l1ZafCYq2-EkMzcbx-PGTTq2bHGNZujF4ur1xtGoXd2kwGuldiR_6SJdqYLHcupbscFI7hHaQnkN1xWJ-L8476ZOKzUgiBvwH9uElGZXwD6SwfXoGW_R38_isrnfTXKfW9PPixyLaN3404tcjOU1r02HIurrplXlIKRKG9CVXxKsESfJJ8trwtZw6O4erxrnisxfL0VwAR7l69P6KcFb57vvM4j4hKFqxUDr4YvSq1qOTt3urYbAKehhvoiLhZxw"; 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() {
onRegionDidChange = (e) => {};
return ( return (
<></> <MapView
// <Mapir initialRegion={{
// apiKey={X_API_KEY} latitude: 35.7219,
// onRegionDidChange={(e) => onRegionDidChange(e)} longitude: 51.3347,
// style={{ latitudeDelta: 0.0922,
// width : '100%', longitudeDelta: 0.0421,
// height : 250 }}
// }} style={{
// > width: "100%",
// <Mapir.Camera zoomLevel={13} centerCoordinate={[51.422548, 35.732573]} /> height: "100%",
// </Mapir> }}
onPress={(e) => getLocation(e.nativeEvent.coordinate)}
>
<Marker coordinate={markerCoordinates} image={markerIcon} />
</MapView>
); );
} }

@ -1,24 +1,22 @@
const initialState = { const initialState = {
loading: false, loading: false,
error: null, error: null,
uploads: {},
lastUpload: null,
}; };
export default function file(state = initialState, action) { export default function file(state = initialState, action) {
let { type, data, params } = action; let { type, data, params } = action;
switch (type) { switch (type) {
case "file/upload": case "file/upload":
console.log(data, params);
return { return {
...state, ...state,
loading: false, loading: false,
error: null, error: null,
uploads: { ...state.uploads, [params?.target || "last"]: data.id },
lastUpload: data.id,
}; };
case "file/loading": case "file/loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "file/error": case "file/error":
console.log(error);
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:
return state; return state;

@ -23,6 +23,7 @@ import Navbar from "../../components/Navbar";
import CustomPressable from "../../components/Pressable"; import CustomPressable from "../../components/Pressable";
import CustomTextInput from "../../components/CustomTextInput"; import CustomTextInput from "../../components/CustomTextInput";
import Select from "../../components/Select"; import Select from "../../components/Select";
import MapSelector from "../../components/MapSelector";
//style //style
import tw from "tailwind-rn"; import tw from "tailwind-rn";
@ -551,38 +552,45 @@ const Address = ({
/> />
</View> </View>
{!profilePage ? ( {!profilePage ? (
<TextInput <>
style={[ <View style={{ width: "100%", height: 250, marginTop: 20}}>
tw("w-full mt-4 py-4 px-2 rounded-md h-40"), <MapSelector
{ setAddress={(address) => setMapAddress(address)}
backgroundColor: />
theme === "light" ? Colors.theme1.grayF9 : null, </View>
color: <TextInput
theme === "light" style={[
? Colors.theme1.gray20 tw("w-full mt-4 py-4 px-2 rounded-md h-40"),
: Colors.theme1.white, {
fontSize: fontSize.tiny, backgroundColor:
textAlign: "right", theme === "light" ? Colors.theme1.grayF9 : null,
fontFamily: "light", color:
borderWidth: 1, theme === "light"
? Colors.theme1.gray20
: Colors.theme1.white,
fontSize: fontSize.tiny,
textAlign: "right",
fontFamily: "light",
borderWidth: 1,
borderColor: borderColor:
theme === "light" theme === "light"
? Colors.theme1.grayE3 ? Colors.theme1.grayE3
: Colors.theme1.white + "55", : Colors.theme1.white + "55",
}, },
]} ]}
value={mapAddress} value={mapAddress}
multiline={true} multiline={true}
textAlignVertical="top" textAlignVertical="top"
placeholder="آدرس مورد نظر ..." placeholder="آدرس مورد نظر ..."
onChangeText={(text) => setMapAddress(text)} onChangeText={(text) => setMapAddress(text)}
placeholderTextColor={ placeholderTextColor={
theme === "light" theme === "light"
? Colors.theme1.gray2077 ? Colors.theme1.gray2077
: Colors.theme1.white + "aa" : Colors.theme1.white + "aa"
} }
/> />
</>
) : null} ) : null}
<View style={tw("mb-4")}> <View style={tw("mb-4")}>
<CustomTextInput <CustomTextInput

@ -1,9 +1,8 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { blog, book, user, userProduct, publicApi } from "../../redux/actions"; import { blog, book, userProduct, publicApi } from "../../redux/actions";
import AsyncStorage from "@react-native-async-storage/async-storage"; import AsyncStorage from "@react-native-async-storage/async-storage";
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import { copilot, walkthroughable, CopilotStep } from "react-native-copilot";
import { import {
View, View,
@ -24,6 +23,7 @@ import Videos from "./components/Videos";
import Blogs from "./components/Blogs"; import Blogs from "./components/Blogs";
import Drawer from "../../components/Drawer"; import Drawer from "../../components/Drawer";
import Header from "./components/Header"; import Header from "./components/Header";
import MapSelector from "../../components/MapSelector";
//style //style
import tw from "tailwind-rn"; import tw from "tailwind-rn";
@ -55,7 +55,7 @@ const Home = ({
const getFirstLogin = React.useCallback(async () => { const getFirstLogin = React.useCallback(async () => {
const firstLoginFlag = await AsyncStorage.getItem("firstLogin"); const firstLoginFlag = await AsyncStorage.getItem("firstLogin");
if (!firstLoginFlag) { if (!firstLoginFlag) {
AsyncStorage.setItem('firstLogin', JSON.stringify(true)); AsyncStorage.setItem("firstLogin", JSON.stringify(true));
setTimeout(() => { setTimeout(() => {
props.start(); props.start();
}, 800); }, 800);
@ -145,5 +145,4 @@ const mapDispatchToProps = {
setFirstLogin: publicApi.setFirstLogin, setFirstLogin: publicApi.setFirstLogin,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(Home); export default connect(mapStateToProps, mapDispatchToProps)(Home);

@ -2,6 +2,7 @@ import { View, Text, Platform, Pressable, Dimensions } from "react-native";
import * as ImagePicker from "expo-image-picker"; import * as ImagePicker from "expo-image-picker";
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { file } from "../../../redux/actions";
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
//components //components
@ -16,7 +17,7 @@ import Colors from "../../../constants/Colors";
const ios = Platform.OS === "ios"; const ios = Platform.OS === "ios";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
const User = ({ user, mobile, theme }) => { const User = ({ user, mobile, theme, upload }) => {
const [dropdown, setDropdown] = React.useState(true); const [dropdown, setDropdown] = React.useState(true);
const [image, setImage] = React.useState(null); const [image, setImage] = React.useState(null);
const navigation = useNavigation(); const navigation = useNavigation();
@ -30,6 +31,10 @@ const User = ({ user, mobile, theme }) => {
quality: 1, quality: 1,
}); });
console.log(result);
upload(result);
if (!result.cancelled) { if (!result.cancelled) {
setImage(result.uri); setImage(result.uri);
} }
@ -158,4 +163,8 @@ const mapStateToProps = (state) => ({
theme: state.publicApi.theme, theme: state.publicApi.theme,
}); });
export default connect(mapStateToProps)(User); const mapDispatchToProps = {
upload: file.upload,
};
export default connect(mapStateToProps, mapDispatchToProps)(User);

@ -1051,11 +1051,6 @@
exec-sh "^0.3.2" exec-sh "^0.3.2"
minimist "^1.2.0" minimist "^1.2.0"
"@expo-google-fonts/noto-sans@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@expo-google-fonts/noto-sans/-/noto-sans-0.2.0.tgz#e5bb0d73235e963d318d38b859c3470aa197ab58"
integrity sha512-Qk9goIvIQxAF0FRHSpw63smmp0uGBKmcRdhIqI4SvJNYEomQzH/Xzy5MA5MJanh/UhYx9KnyaidSH6FiJLLXeg==
"@expo/config-plugins@3.1.0": "@expo/config-plugins@3.1.0":
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/@expo/config-plugins/-/config-plugins-3.1.0.tgz#0752ff33c5eab21cf42034a44e79df97f0f867f8" resolved "https://registry.yarnpkg.com/@expo/config-plugins/-/config-plugins-3.1.0.tgz#0752ff33c5eab21cf42034a44e79df97f0f867f8"
@ -1676,6 +1671,11 @@
dependencies: dependencies:
"@turf/helpers" "^6.5.0" "@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": "@types/graceful-fs@^4.1.2":
version "4.1.5" version "4.1.5"
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15"
@ -5574,6 +5574,13 @@ 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" resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz#20c603e9a0e765fd6f97396638bdeb0e5a60b010"
integrity sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg== 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: react-native-openanything@^0.0.6:
version "0.0.6" version "0.0.6"
resolved "https://registry.yarnpkg.com/react-native-openanything/-/react-native-openanything-0.0.6.tgz#7b694a28ce6de0363d46474ab3c72f5c0d14e658" resolved "https://registry.yarnpkg.com/react-native-openanything/-/react-native-openanything-0.0.6.tgz#7b694a28ce6de0363d46474ab3c72f5c0d14e658"

Loading…
Cancel
Save