upgrade to SDK 47

This commit is contained in:
Ninjas Code - 4 2023-03-08 16:09:10 +05:00
parent b651b11967
commit 194a514431
11 changed files with 11069 additions and 31458 deletions

1
Customer App/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/node_modules

View File

@ -47,7 +47,7 @@
"versionCode": 22, "versionCode": 22,
"package": "com.enatega.vendor", "package": "com.enatega.vendor",
"googleServicesFile": "./google-services-prod.json", "googleServicesFile": "./google-services-prod.json",
"useNextNotificationsApi": true,
"config": { "config": {
"googleMaps": { "googleMaps": {
"apiKey": "" "apiKey": ""

View File

@ -3,54 +3,48 @@
* path: '/environment.js' (root of your project) * path: '/environment.js' (root of your project)
******************************/ ******************************/
import Constants from 'expo-constants' import Constants from "expo-constants";
const ENV = { const ENV = {
development: { development: {
GRAPHQL_URL: 'http://192.168.100.90:8000/graphql', GRAPHQL_URL: "http://10.97.28.88.90:8000/graphql",
WS_GRAPHQL_URL: 'ws://192.168.100.90:8000/graphql', WS_GRAPHQL_URL: "ws://10.97.28.88.90:8000/graphql",
SERVER_URL: 'http://192.168.100.90:8000/', // put / at the end of server url SERVER_URL: "http://10.97.28.88.90:8000/", // put / at the end of server url
IOS_CLIENT_ID_GOOGLE: IOS_CLIENT_ID_GOOGLE: "",
'', ANDROID_CLIENT_ID_GOOGLE: "",
ANDROID_CLIENT_ID_GOOGLE: FACEBOOK_APP_ID: "404956210315749",
'', AMPLITUDE_API_KEY: "",
FACEBOOK_APP_ID: '404956210315749', STRIPE_PUBLIC_KEY: "",
AMPLITUDE_API_KEY: '', STRIPE_IMAGE_URL: "http://10.97.28.88.90:8000/assets/images/logo.png",
STRIPE_PUBLIC_KEY: '', STRIPE_STORE_NAME: "Enatega",
STRIPE_IMAGE_URL: 'http://192.168.100.90:8000/assets/images/logo.png',
STRIPE_STORE_NAME: 'Enatega'
}, },
staging: { staging: {
GRAPHQL_URL: 'https://staging-enatega-single-api.herokuapp.com/graphql', GRAPHQL_URL: "https://staging-enatega-single-api.herokuapp.com/graphql",
WS_GRAPHQL_URL: 'wss://staging-enatega-single-api.herokuapp.com/graphql', WS_GRAPHQL_URL: "wss://staging-enatega-single-api.herokuapp.com/graphql",
SERVER_URL: 'https://staging-enatega-single-api.herokuapp.com/', // put / at the end of server url SERVER_URL: "https://staging-enatega-single-api.herokuapp.com/", // put / at the end of server url
IOS_CLIENT_ID_GOOGLE: IOS_CLIENT_ID_GOOGLE: "",
'', ANDROID_CLIENT_ID_GOOGLE: "",
ANDROID_CLIENT_ID_GOOGLE: FACEBOOK_APP_ID: "404956210315749",
'', AMPLITUDE_API_KEY: "",
FACEBOOK_APP_ID: '404956210315749', STRIPE_PUBLIC_KEY: "",
AMPLITUDE_API_KEY: '',
STRIPE_PUBLIC_KEY: '',
STRIPE_IMAGE_URL: STRIPE_IMAGE_URL:
'https://staging-enatega-single-api.herokuapp.com/assets/images/logo.png', "https://staging-enatega-single-api.herokuapp.com/assets/images/logo.png",
STRIPE_STORE_NAME: 'Enatega' STRIPE_STORE_NAME: "Enatega",
}, },
production: { production: {
GRAPHQL_URL: 'https://prod-enatega-single-api.herokuapp.com/graphql', GRAPHQL_URL: "https://prod-enatega-single-api.herokuapp.com/graphql",
WS_GRAPHQL_URL: 'wss://prod-enatega-single-api.herokuapp.com/graphql', WS_GRAPHQL_URL: "wss://prod-enatega-single-api.herokuapp.com/graphql",
SERVER_URL: 'https://prod-enatega-single-api.herokuapp.com/', // put / at the end of server url SERVER_URL: "https://prod-enatega-single-api.herokuapp.com/", // put / at the end of server url
IOS_CLIENT_ID_GOOGLE: IOS_CLIENT_ID_GOOGLE: "",
'', ANDROID_CLIENT_ID_GOOGLE: "",
ANDROID_CLIENT_ID_GOOGLE: FACEBOOK_APP_ID: "3017447961609878",
'', AMPLITUDE_API_KEY: "",
FACEBOOK_APP_ID: '3017447961609878', STRIPE_PUBLIC_KEY: "",
AMPLITUDE_API_KEY: '',
STRIPE_PUBLIC_KEY: '',
STRIPE_IMAGE_URL: STRIPE_IMAGE_URL:
'https://prod-enatega-single-api.herokuapp.com/assets/images/logo.png', "https://prod-enatega-single-api.herokuapp.com/assets/images/logo.png",
STRIPE_STORE_NAME: 'Enatega' STRIPE_STORE_NAME: "Enatega",
} },
} };
const getEnvVars = (env = Constants.manifest.releaseChannel) => { const getEnvVars = (env = Constants.manifest.releaseChannel) => {
// What is __DEV__ ? // What is __DEV__ ?
@ -58,14 +52,14 @@ const getEnvVars = (env = Constants.manifest.releaseChannel) => {
// __DEV__ is true when run locally, but false when published. // __DEV__ is true when run locally, but false when published.
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
if (__DEV__) { if (__DEV__) {
return ENV.development return ENV.development;
} else if (env === 'production') { } else if (env === "production") {
return ENV.production return ENV.production;
} else if (env === 'staging') { } else if (env === "staging") {
return ENV.staging return ENV.staging;
} else { } else {
return ENV.production return ENV.production;
} }
} };
export default getEnvVars export default getEnvVars;

File diff suppressed because it is too large Load Diff

View File

@ -25,14 +25,15 @@
}, },
"dependencies": { "dependencies": {
"@apollo/react-hooks": "^3.1.3", "@apollo/react-hooks": "^3.1.3",
"@expo/vector-icons": "^12.0.0", "@expo/vector-icons": "^13.0.0",
"@ptomasroos/react-native-multi-slider": "^2.2.2", "@ptomasroos/react-native-multi-slider": "^2.2.2",
"@react-native-async-storage/async-storage": "~1.15.0", "@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-community/masked-view": "0.1.10", "@react-native-community/masked-view": "0.1.11",
"@react-navigation/drawer": "^5.12.5", "@react-navigation/drawer": "^6.6.0",
"@react-navigation/native": "^5.9.4", "@react-navigation/native": "^6.1.4",
"@react-navigation/stack": "^5.14.5", "@react-navigation/native-stack": "^6.9.10",
"apollo-boost": "^0.3.1", "@react-navigation/stack": "^6.3.14",
"apollo-boost": "^0.4.9",
"apollo-cache-inmemory": "^1.5.1", "apollo-cache-inmemory": "^1.5.1",
"apollo-cache-persist": "^0.1.1", "apollo-cache-persist": "^0.1.1",
"apollo-client": "^2.5.1", "apollo-client": "^2.5.1",
@ -41,72 +42,79 @@
"apollo-link-state": "^0.4.2", "apollo-link-state": "^0.4.2",
"apollo-link-ws": "^1.0.20", "apollo-link-ws": "^1.0.20",
"apollo-upload-client": "^10.0.0", "apollo-upload-client": "^10.0.0",
"expo": "^44.0.0", "apollo-utilities": "^1.3.4",
"expo-analytics-amplitude": "~11.1.0", "deprecated-react-native-prop-types": "^4.0.0",
"expo": "^47.0.0",
"expo-analytics-amplitude": "~11.3.0",
"expo-app-auth": "~11.1.0", "expo-app-auth": "~11.1.0",
"expo-app-loading": "~1.3.0", "expo-app-loading": "~2.1.1",
"expo-apple-authentication": "~4.1.0", "expo-apple-authentication": "~5.0.1",
"expo-application": "~4.0.1", "expo-application": "~5.0.1",
"expo-asset": "~8.4.6", "expo-asset": "~8.7.0",
"expo-constants": "~13.0.1", "expo-camera": "~13.1.0",
"expo-device": "~4.1.0", "expo-constants": "~14.0.2",
"expo-facebook": "~12.1.0", "expo-contacts": "~11.0.1",
"expo-font": "~10.0.4", "expo-device": "~5.0.0",
"expo-google-app-auth": "~8.3.0", "expo-facebook": "~12.2.0",
"expo-image-picker": "~12.0.1", "expo-font": "~11.0.1",
"expo-linking": "~3.0.0", "expo-google-app-auth": "^8.3.0",
"expo-localization": "~12.0.0", "expo-image-picker": "~14.0.2",
"expo-location": "~14.0.1", "expo-linking": "~3.3.1",
"expo-notifications": "~0.14.0", "expo-localization": "~14.0.0",
"expo-splash-screen": "~0.14.1", "expo-location": "~15.0.1",
"expo-tracking-transparency": "~2.1.0", "expo-notifications": "~0.17.0",
"expo-updates": "~0.11.6", "expo-sensors": "~12.0.1",
"graphql": "^14.5.8", "expo-splash-screen": "~0.17.5",
"expo-tracking-transparency": "~3.0.1",
"expo-updates": "~0.15.6",
"graphql": "^16.6.0",
"graphql-tag": "^2.10.1", "graphql-tag": "^2.10.1",
"i18n-js": "^3.2.2", "i18n-js": "^3.2.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"patch-package": "^6.2.2", "patch-package": "^6.5.1",
"react": "17.0.1", "react": "18.1.0",
"react-apollo": "^2.5.8", "react-apollo": "^3.1.5",
"react-native": "0.64.3", "react-native": "0.70.5",
"react-native-flash-message": "^0.1.23", "react-native-button": "^3.0.1",
"react-native-flash-message": "^0.4.0",
"react-native-flatlist-slider": "^1.0.5", "react-native-flatlist-slider": "^1.0.5",
"react-native-gesture-handler": "~2.1.0", "react-native-gesture-handler": "~2.8.0",
"react-native-gifted-chat": "^0.16.3", "react-native-gifted-chat": "^1.1.1",
"react-native-maps": "0.29.4", "react-native-i18n": "1.0.0",
"react-native-maps": "1.3.2",
"react-native-material-textfield": "^0.16.1", "react-native-material-textfield": "^0.16.1",
"react-native-modal": "^11.10.0", "react-native-modal": "^13.0.1",
"react-native-modalize": "^2.0.8", "react-native-modalize": "^2.0.8",
"react-native-reanimated": "~2.3.1", "react-native-reanimated": "~2.12.0",
"react-native-safe-area-context": "3.3.2", "react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.10.1", "react-native-screens": "~3.18.0",
"react-native-star-rating": "^1.1.0", "react-native-star-rating": "^1.1.0",
"react-native-svg": "12.1.1", "react-native-svg": "13.4.0",
"react-native-timeline-flatlist": "^0.7.2", "react-native-timeline-flatlist": "^0.8.0",
"react-native-webview": "11.15.0", "react-native-webview": "11.23.1",
"subscriptions-transport-ws": "^0.9.16", "subscriptions-transport-ws": "^0.11.0",
"uuid": "^3.3.2", "uuid": "^3.3.2",
"validate.js": "^0.12.0" "validate.js": "^0.13.1"
}, },
"devDependencies": { "devDependencies": {
"babel-jest": "^24.8.0", "babel-jest": "^29.4.3",
"babel-preset-expo": "9.0.2", "babel-preset-expo": "~9.2.1",
"babel-preset-react-native": "^4.0.1", "babel-preset-react-native": "^4.0.1",
"eslint": "^7.28.0", "eslint": "^8.34.0",
"eslint-config-standard": "^14.1.1", "eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.20.2", "eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1", "eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.20.0", "eslint-plugin-react": "^7.20.0",
"eslint-plugin-standard": "^4.0.1", "eslint-plugin-standard": "^5.0.0",
"husky": "^4.3.8", "husky": "^8.0.3",
"jest": "^26.6.3", "jest": "^29.4.3",
"jest-react-native": "^18.0.0", "jest-react-native": "^18.0.0",
"lint-staged": "^10.5.4", "lint-staged": "^13.1.2",
"metro-react-native-babel-preset": "^0.54.1", "metro-react-native-babel-preset": "^0.75.0",
"prettier": "^2.3.1", "prettier": "^2.3.1",
"prettier-config-standard": "^1.0.1", "prettier-config-standard": "^5.0.0",
"react-test-renderer": "^16.8.6" "react-test-renderer": "^18.2.0"
}, },
"jest": { "jest": {
"preset": "react-native", "preset": "react-native",

View File

@ -0,0 +1,38 @@
diff --git a/node_modules/react-native-button/Button.js b/node_modules/react-native-button/Button.js
index b248176..3c6aefa 100644
--- a/node_modules/react-native-button/Button.js
+++ b/node_modules/react-native-button/Button.js
@@ -1,4 +1,5 @@
import PropTypes from 'prop-types';
+import {TextPropTypes,ViewPropTypes} from 'deprecated-react-native-prop-types'
import React, { Component } from 'react';
import {
Platform,
@@ -7,7 +8,7 @@ import {
TouchableOpacity,
TouchableNativeFeedback,
View,
- ViewPropTypes
+ //ViewPropTypes
} from 'react-native';
import coalesceNonElementChildren from './coalesceNonElementChildren';
@@ -18,12 +19,15 @@ export default class Button extends Component {
static propTypes = {
...TouchableOpacity.propTypes,
accessibilityLabel: PropTypes.string,
- allowFontScaling: Text.propTypes.allowFontScaling,
+ // allowFontScaling: Text.propTypes.allowFontScaling,
+ allowFontScaling: TextPropTypes.allowFontScaling,
containerStyle: ViewPropTypes.style,
disabledContainerStyle: ViewPropTypes.style,
disabled: PropTypes.bool,
- style: Text.propTypes.style,
- styleDisabled: Text.propTypes.style,
+ style: TextPropTypes.style,
+ styleDisabled: TextPropTypes.style,
+ // style: Text.propTypes.style,
+ // styleDisabled: Text.propTypes.style,
childGroupStyle: ViewPropTypes.style,
androidBackground: PropTypes.object,
};

View File

@ -1,21 +1,197 @@
diff --git a/node_modules/react-native-material-textfield/src/components/affix/index.js b/node_modules/react-native-material-textfield/src/components/affix/index.js diff --git a/node_modules/react-native-material-textfield/src/components/affix/index.js b/node_modules/react-native-material-textfield/src/components/affix/index.js
index 0f85022..c12b3a6 100644 index 0f85022..e467adb 100644
--- a/node_modules/react-native-material-textfield/src/components/affix/index.js --- a/node_modules/react-native-material-textfield/src/components/affix/index.js
+++ b/node_modules/react-native-material-textfield/src/components/affix/index.js +++ b/node_modules/react-native-material-textfield/src/components/affix/index.js
@@ -11,7 +11,7 @@ export default class Affix extends PureComponent { @@ -9,26 +9,26 @@ export default class Affix extends PureComponent {
numberOfLines: 1,
};
static propTypes = { - static propTypes = {
numberOfLines: PropTypes.number, - numberOfLines: PropTypes.number,
- style: Animated.Text.propTypes.style, - style: Animated.Text.propTypes.style,
+ style: PropTypes.object, + // static propTypes = {
+ // numberOfLines: PropTypes.number,
+ // style: PropTypes.object,
color: PropTypes.string.isRequired, - color: PropTypes.string.isRequired,
fontSize: PropTypes.number.isRequired, - fontSize: PropTypes.number.isRequired,
+ // color: PropTypes.string.isRequired,
+ // fontSize: PropTypes.number.isRequired,
- type: PropTypes
- .oneOf(['prefix', 'suffix'])
- .isRequired,
+ // type: PropTypes
+ // .oneOf(['prefix', 'suffix'])
+ // .isRequired,
- labelAnimation: PropTypes
- .instanceOf(Animated.Value)
- .isRequired,
+ // labelAnimation: PropTypes
+ // .instanceOf(Animated.Value)
+ // .isRequired,
- children: PropTypes.oneOfType([
- PropTypes.arrayOf(PropTypes.node),
- PropTypes.node,
- ]),
- };
+ // children: PropTypes.oneOfType([
+ // PropTypes.arrayOf(PropTypes.node),
+ // PropTypes.node,
+ // ]),
+ // };
render() {
let { labelAnimation, style, children, type, fontSize, color } = this.props;
diff --git a/node_modules/react-native-material-textfield/src/components/counter/index.js b/node_modules/react-native-material-textfield/src/components/counter/index.js
index 35d3264..089b871 100644
--- a/node_modules/react-native-material-textfield/src/components/counter/index.js
+++ b/node_modules/react-native-material-textfield/src/components/counter/index.js
@@ -5,15 +5,15 @@ import { Text } from 'react-native';
import styles from './styles';
export default class Counter extends PureComponent {
- static propTypes = {
- count: PropTypes.number.isRequired,
- limit: PropTypes.number,
+ // static propTypes = {
+ // count: PropTypes.number.isRequired,
+ // limit: PropTypes.number,
- baseColor: PropTypes.string.isRequired,
- errorColor: PropTypes.string.isRequired,
+ // baseColor: PropTypes.string.isRequired,
+ // errorColor: PropTypes.string.isRequired,
- style: Text.propTypes.style,
- };
+ // style: PropTypes.object,
+ // };
render() {
let { count, limit, baseColor, errorColor, style } = this.props;
diff --git a/node_modules/react-native-material-textfield/src/components/field/index.js b/node_modules/react-native-material-textfield/src/components/field/index.js diff --git a/node_modules/react-native-material-textfield/src/components/field/index.js b/node_modules/react-native-material-textfield/src/components/field/index.js
index 494bbaa..9bbf2e2 100644 index 494bbaa..2a71c82 100644
--- a/node_modules/react-native-material-textfield/src/components/field/index.js --- a/node_modules/react-native-material-textfield/src/components/field/index.js
+++ b/node_modules/react-native-material-textfield/src/components/field/index.js +++ b/node_modules/react-native-material-textfield/src/components/field/index.js
@@ -221,6 +221,7 @@ export default class TextField extends PureComponent { @@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
+import {ViewPropTypes} from 'deprecated-react-native-prop-types';
import {
View,
Text,
@@ -7,7 +8,7 @@ import {
Animated,
StyleSheet,
Platform,
- ViewPropTypes,
+ //ViewPropTypes,
} from 'react-native';
import Line from '../line';
@@ -65,60 +66,60 @@ export default class TextField extends PureComponent {
disabled: false,
};
- static propTypes = {
- ...TextInput.propTypes,
+ // static propTypes = {
+ // ...TextInput.propTypes,
- animationDuration: PropTypes.number,
+ // animationDuration: PropTypes.number,
- fontSize: PropTypes.number,
- labelFontSize: PropTypes.number,
+ // fontSize: PropTypes.number,
+ // labelFontSize: PropTypes.number,
- contentInset: PropTypes.shape({
- top: PropTypes.number,
- label: PropTypes.number,
- input: PropTypes.number,
- left: PropTypes.number,
- right: PropTypes.number,
- }),
+ // contentInset: PropTypes.shape({
+ // top: PropTypes.number,
+ // label: PropTypes.number,
+ // input: PropTypes.number,
+ // left: PropTypes.number,
+ // right: PropTypes.number,
+ // }),
- labelOffset: Label.propTypes.offset,
+ // labelOffset: Label.propTypes.offset,
- labelTextStyle: Text.propTypes.style,
- titleTextStyle: Text.propTypes.style,
- affixTextStyle: Text.propTypes.style,
+ // labelTextStyle: PropTypes.object.style,
+ // // titleTextStyle: PropTypes.object.style,
+ // // affixTextStyle: PropTypes.object.style,
- tintColor: PropTypes.string,
- textColor: PropTypes.string,
- baseColor: PropTypes.string,
+ // tintColor: PropTypes.string,
+ // textColor: PropTypes.string,
+ // baseColor: PropTypes.string,
- label: PropTypes.string,
- title: PropTypes.string,
+ // label: PropTypes.string,
+ // title: PropTypes.string,
- characterRestriction: PropTypes.number,
+ // characterRestriction: PropTypes.number,
- error: PropTypes.string,
- errorColor: PropTypes.string,
+ // error: PropTypes.string,
+ // errorColor: PropTypes.string,
- lineWidth: PropTypes.number,
- activeLineWidth: PropTypes.number,
- disabledLineWidth: PropTypes.number,
+ // lineWidth: PropTypes.number,
+ // activeLineWidth: PropTypes.number,
+ // disabledLineWidth: PropTypes.number,
- lineType: Line.propTypes.lineType,
- disabledLineType: Line.propTypes.lineType,
+ // lineType: Line.propTypes.lineType,
+ // disabledLineType: Line.propTypes.lineType,
- disabled: PropTypes.bool,
+ // disabled: PropTypes.bool,
- formatText: PropTypes.func,
+ // formatText: PropTypes.func,
- renderLeftAccessory: PropTypes.func,
- renderRightAccessory: PropTypes.func,
+ // renderLeftAccessory: PropTypes.func,
+ // renderRightAccessory: PropTypes.func,
- prefix: PropTypes.string,
- suffix: PropTypes.string,
+ // prefix: PropTypes.string,
+ // suffix: PropTypes.string,
- containerStyle: (ViewPropTypes || View.propTypes).style,
- inputContainerStyle: (ViewPropTypes || View.propTypes).style,
- };
+ // containerStyle: (ViewPropTypes || View.propTypes).style,
+ // inputContainerStyle: (ViewPropTypes || View.propTypes).style,
+ // };
static inputContainerStyle = styles.inputContainer;
@@ -221,6 +222,7 @@ export default class TextField extends PureComponent {
let options = { let options = {
toValue: this.focusState(), toValue: this.focusState(),
@ -24,28 +200,206 @@ index 494bbaa..9bbf2e2 100644
}; };
diff --git a/node_modules/react-native-material-textfield/src/components/helper/index.js b/node_modules/react-native-material-textfield/src/components/helper/index.js diff --git a/node_modules/react-native-material-textfield/src/components/helper/index.js b/node_modules/react-native-material-textfield/src/components/helper/index.js
index 6060f9f..fe9d9c4 100644 index 6060f9f..86ac2c0 100644
--- a/node_modules/react-native-material-textfield/src/components/helper/index.js --- a/node_modules/react-native-material-textfield/src/components/helper/index.js
+++ b/node_modules/react-native-material-textfield/src/components/helper/index.js +++ b/node_modules/react-native-material-textfield/src/components/helper/index.js
@@ -11,7 +11,7 @@ export default class Helper extends PureComponent { @@ -1,23 +1,24 @@
import PropTypes from 'prop-types';
+
import React, { PureComponent } from 'react';
import { Animated } from 'react-native';
disabled: PropTypes.bool, import styles from './styles';
export default class Helper extends PureComponent {
- static propTypes = {
- title: PropTypes.string,
- error: PropTypes.string,
+ // static propTypes = {
+ // title: PropTypes.string,
+ // error: PropTypes.string,
- disabled: PropTypes.bool,
+ // disabled: PropTypes.bool,
- style: Animated.Text.propTypes.style, - style: Animated.Text.propTypes.style,
+ style: PropTypes.object, + // style: PropTypes.object,
baseColor: PropTypes.string, - baseColor: PropTypes.string,
errorColor: PropTypes.string, - errorColor: PropTypes.string,
+ // baseColor: PropTypes.string,
+ // errorColor: PropTypes.string,
- focusAnimation: PropTypes.instanceOf(Animated.Value),
- };
+ // focusAnimation: PropTypes.instanceOf(Animated.Value),
+ // };
constructor(props) {
super(props);
diff --git a/node_modules/react-native-material-textfield/src/components/label/index.js b/node_modules/react-native-material-textfield/src/components/label/index.js diff --git a/node_modules/react-native-material-textfield/src/components/label/index.js b/node_modules/react-native-material-textfield/src/components/label/index.js
index 82eaf03..809fcdd 100644 index 82eaf03..1ad9a93 100644
--- a/node_modules/react-native-material-textfield/src/components/label/index.js --- a/node_modules/react-native-material-textfield/src/components/label/index.js
+++ b/node_modules/react-native-material-textfield/src/components/label/index.js +++ b/node_modules/react-native-material-textfield/src/components/label/index.js
@@ -43,7 +43,7 @@ export default class Label extends PureComponent { @@ -11,41 +11,41 @@ export default class Label extends PureComponent {
y1: PropTypes.number, restricted: false,
}),
- style: Animated.Text.propTypes.style,
+ style: PropTypes.object,
label: PropTypes.string,
}; };
- static propTypes = {
- numberOfLines: PropTypes.number,
+ // static propTypes = {
+ // numberOfLines: PropTypes.number,
- disabled: PropTypes.bool,
- restricted: PropTypes.bool,
+ // disabled: PropTypes.bool,
+ // restricted: PropTypes.bool,
- fontSize: PropTypes.number.isRequired,
- activeFontSize: PropTypes.number.isRequired,
+ // fontSize: PropTypes.number.isRequired,
+ // activeFontSize: PropTypes.number.isRequired,
- baseColor: PropTypes.string.isRequired,
- tintColor: PropTypes.string.isRequired,
- errorColor: PropTypes.string.isRequired,
+ // baseColor: PropTypes.string.isRequired,
+ // tintColor: PropTypes.string.isRequired,
+ // errorColor: PropTypes.string.isRequired,
- focusAnimation: PropTypes
- .instanceOf(Animated.Value)
- .isRequired,
+ // focusAnimation: PropTypes
+ // .instanceOf(Animated.Value)
+ // .isRequired,
- labelAnimation: PropTypes
- .instanceOf(Animated.Value)
- .isRequired,
+ // labelAnimation: PropTypes
+ // .instanceOf(Animated.Value)
+ // .isRequired,
- contentInset: PropTypes.shape({
- label: PropTypes.number,
- }),
+ // contentInset: PropTypes.shape({
+ // label: PropTypes.number,
+ // }),
- offset: PropTypes.shape({
- x0: PropTypes.number,
- y0: PropTypes.number,
- x1: PropTypes.number,
- y1: PropTypes.number,
- }),
+ // offset: PropTypes.shape({
+ // x0: PropTypes.number,
+ // y0: PropTypes.number,
+ // x1: PropTypes.number,
+ // y1: PropTypes.number,
+ // }),
- style: Animated.Text.propTypes.style,
- label: PropTypes.string,
- };
+ // style: PropTypes.object,
+ // label: PropTypes.string,
+ // };
render() {
let {
diff --git a/node_modules/react-native-material-textfield/src/components/line/index.js b/node_modules/react-native-material-textfield/src/components/line/index.js
index 44995e9..b689387 100644
--- a/node_modules/react-native-material-textfield/src/components/line/index.js
+++ b/node_modules/react-native-material-textfield/src/components/line/index.js
@@ -16,23 +16,23 @@ export default class Line extends PureComponent {
restricted: false,
};
- static propTypes = {
- lineType: lineTypes,
- disabledLineType: lineTypes,
+ // static propTypes = {
+ // lineType: lineTypes,
+ // disabledLineType: lineTypes,
- disabled: PropTypes.bool,
- restricted: PropTypes.bool,
+ // disabled: PropTypes.bool,
+ // restricted: PropTypes.bool,
- tintColor: PropTypes.string,
- baseColor: PropTypes.string,
- errorColor: PropTypes.string,
+ // tintColor: PropTypes.string,
+ // baseColor: PropTypes.string,
+ // errorColor: PropTypes.string,
- lineWidth: PropTypes.number,
- activeLineWidth: PropTypes.number,
- disabledLineWidth: PropTypes.number,
+ // lineWidth: PropTypes.number,
+ // activeLineWidth: PropTypes.number,
+ // disabledLineWidth: PropTypes.number,
- focusAnimation: PropTypes.instanceOf(Animated.Value),
- };
+ // focusAnimation: PropTypes.instanceOf(Animated.Value),
+ // };
static getDerivedStateFromProps(props, state) {
let { lineWidth, activeLineWidth, disabledLineWidth } = props;
diff --git a/node_modules/react-native-material-textfield/src/components/outline/index.js b/node_modules/react-native-material-textfield/src/components/outline/index.js
index 9347a99..9c3e8a3 100644
--- a/node_modules/react-native-material-textfield/src/components/outline/index.js
+++ b/node_modules/react-native-material-textfield/src/components/outline/index.js
@@ -11,29 +11,29 @@ export default class Line extends PureComponent {
restricted: false,
};
- static propTypes = {
- lineType: PropTypes.oneOf(['solid', 'none']),
+ // static propTypes = {
+ // lineType: PropTypes.oneOf(['solid', 'none']),
- disabled: PropTypes.bool,
- restricted: PropTypes.bool,
+ // disabled: PropTypes.bool,
+ // restricted: PropTypes.bool,
- tintColor: PropTypes.string,
- baseColor: PropTypes.string,
- errorColor: PropTypes.string,
+ // tintColor: PropTypes.string,
+ // baseColor: PropTypes.string,
+ // errorColor: PropTypes.string,
- lineWidth: PropTypes.number,
- activeLineWidth: PropTypes.number,
- disabledLineWidth: PropTypes.number,
+ // lineWidth: PropTypes.number,
+ // activeLineWidth: PropTypes.number,
+ // disabledLineWidth: PropTypes.number,
- focusAnimation: PropTypes.instanceOf(Animated.Value),
- labelAnimation: PropTypes.instanceOf(Animated.Value),
- labelWidth: PropTypes.instanceOf(Animated.Value),
+ // focusAnimation: PropTypes.instanceOf(Animated.Value),
+ // labelAnimation: PropTypes.instanceOf(Animated.Value),
+ // labelWidth: PropTypes.instanceOf(Animated.Value),
- contentInset: PropTypes.shape({
- left: PropTypes.number,
- right: PropTypes.number,
- }),
- };
+ // contentInset: PropTypes.shape({
+ // left: PropTypes.number,
+ // right: PropTypes.number,
+ // }),
+ // };
borderProps() {
let {

View File

@ -0,0 +1,26 @@
diff --git a/node_modules/react-native-star-rating/StarButton.js b/node_modules/react-native-star-rating/StarButton.js
index b6db613..8a62f5a 100644
--- a/node_modules/react-native-star-rating/StarButton.js
+++ b/node_modules/react-native-star-rating/StarButton.js
@@ -1,6 +1,7 @@
// React and react native imports
import React, { Component } from 'react';
-import { Image, StyleSheet, ViewPropTypes } from 'react-native';
+import { Image, StyleSheet } from 'react-native';
+import {ViewPropTypes} from 'deprecated-react-native-prop-types';
import PropTypes from 'prop-types';
import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
diff --git a/node_modules/react-native-star-rating/StarRating.js b/node_modules/react-native-star-rating/StarRating.js
index 7aecc95..de6397c 100644
--- a/node_modules/react-native-star-rating/StarRating.js
+++ b/node_modules/react-native-star-rating/StarRating.js
@@ -1,6 +1,7 @@
// React and react native imports
import React, { Component } from 'react';
-import { View, ViewPropTypes, StyleSheet } from 'react-native';
+import { View, StyleSheet } from 'react-native';
+import {ViewPropTypes} from 'deprecated-react-native-prop-types';
import PropTypes from 'prop-types';
import { View as AnimatableView } from 'react-native-animatable';

View File

@ -1,25 +1,25 @@
import { useTheme } from '@react-navigation/native' import { useTheme } from "@react-navigation/native";
import { useHeaderHeight } from '@react-navigation/stack' import { useHeaderHeight } from "@react-navigation/elements";
import { StyleSheet } from 'react-native' import { StyleSheet } from "react-native";
import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useSafeAreaInsets } from "react-native-safe-area-context";
import { scale } from '../../utils/scaling' import { scale } from "../../utils/scaling";
const useStyle = () => { const useStyle = () => {
const { colors } = useTheme() const { colors } = useTheme();
const inset = useSafeAreaInsets() const inset = useSafeAreaInsets();
const headerHeight = useHeaderHeight() const headerHeight = useHeaderHeight();
return StyleSheet.create({ return StyleSheet.create({
flex: { flex: {
flex: 1 flex: 1,
}, },
wrapperView: { wrapperView: {
backgroundColor: colors.background, backgroundColor: colors.background,
paddingTop: headerHeight, paddingTop: headerHeight,
paddingBottom: inset.bottom paddingBottom: inset.bottom,
}, },
topCurve: { topCurve: {
position: 'absolute', position: "absolute",
opacity: 0.2, opacity: 0.2,
left: -75, left: -75,
borderTopRightRadius: scale(90), borderTopRightRadius: scale(90),
@ -28,10 +28,10 @@ const useStyle = () => {
width: scale(250), width: scale(250),
height: scale(260), height: scale(260),
borderRadius: 100, borderRadius: 100,
backgroundColor: colors.curve backgroundColor: colors.curve,
}, },
bottomCurve: { bottomCurve: {
position: 'absolute', position: "absolute",
height: scale(185), height: scale(185),
width: scale(170), width: scale(170),
borderTopRightRadius: scale(110), borderTopRightRadius: scale(110),
@ -42,9 +42,9 @@ const useStyle = () => {
backgroundColor: colors.curve, backgroundColor: colors.curve,
opacity: 0.2, opacity: 0.2,
bottom: -80, bottom: -80,
zIndex: -1 zIndex: -1,
} },
}) });
} };
export default useStyle export default useStyle;

View File

@ -1,100 +1,141 @@
/* eslint-disable react/prop-types */ /* eslint-disable react/prop-types */
import { createDrawerNavigator } from '@react-navigation/drawer' import { createDrawerNavigator } from "@react-navigation/drawer";
import { NavigationContainer, useTheme } from '@react-navigation/native' import { NavigationContainer, useTheme } from "@react-navigation/native";
import { createStackNavigator } from '@react-navigation/stack' import { createStackNavigator } from "@react-navigation/stack";
import * as Notifications from 'expo-notifications' import * as Notifications from "expo-notifications";
import React, { useEffect } from 'react' import React, { useEffect } from "react";
import { useColorScheme } from 'react-native' import { Text, useColorScheme, View } from "react-native";
import Animated from 'react-native-reanimated' import Animated from "react-native-reanimated";
import { import {
initialWindowMetrics, initialWindowMetrics,
SafeAreaProvider SafeAreaProvider,
} from 'react-native-safe-area-context' } from "react-native-safe-area-context";
import { TextDefault, LeftButton, Sidebar } from '../components' import { TextDefault, LeftButton, Sidebar } from "../components";
import { import Menu from "../screens/Menu/Menu";
Addresses, import MenuItems from "../screens/MenuItems/MenuItems";
Cart, import Addresses from "../screens/Addresses/Addresses";
CartAddress, import NewAddress from "../screens/NewAddress/NewAddress";
Chat, import EditAddress from "../screens/EditAddress/EditAddress";
CreateAccount, import Cart from "../screens/Cart/Cart";
EditAddress, import Profile from "../screens/Profile/Profile";
ForgotPassword, import FullMap from "../screens/FullMap/FullMap";
FullMap, import CartAddress from "../screens/CartAddress/CartAddress";
Help, import SelectVoucher from "../screens/Coupon/Coupon";
HelpBrowser, import Help from "../screens/Help/Help";
ItemDetail, import HelpBrowser from "../screens/HelpBrowser/HelpBrowser";
Login, import Chat from "../screens/Chat/Chat";
Menu, import Settings from "../screens/Settings/Settings";
MenuItems, import Paypal from "../screens/Paypal/Paypal";
MyOrders, import ItemDetail from "../screens/ItemDetail/ItemDetail";
NewAddress, import MyOrders from "../screens/MyOrders/MyOrders";
OrderDetail, import OrderDetail from "../screens/OrderDetail/OrderDetail";
Paypal, import StripeCheckout from "../screens/Stripe/StripeCheckout";
Profile, import RateAndReview from "../screens/RateAndReview/RateAndReview";
RateAndReview, import CreateAccount from "../screens/CreateAccount/CreateAccount";
Register, import Login from "../screens/Login/Login";
SelectVoucher, import Register from "../screens/Register/Register";
Settings, import ForgotPassword from "../screens/ForgotPassword/ForgotPassword";
StripeCheckout
} from '../screens'
import { THEME } from '../Theme'
import { ICONS_NAME, NAVIGATION_SCREEN } from '../utils/constant'
import navigationService from './navigationService'
import screenOptions from './screenOptions'
import styles from './styles'
const NavigationStack = createStackNavigator() // import {
const MainStack = createStackNavigator() // Addresses,
const SideDrawer = createDrawerNavigator() // Cart,
// CartAddress,
// Chat,
// CreateAccount,
// EditAddress,
// ForgotPassword,
// FullMap,
// Help,
// HelpBrowser,
// ItemDetail,
// Login,
// MenuItems,
// MyOrders,
// NewAddress,
// OrderDetail,
// Paypal,
// Profile,
// RateAndReview,
// Register,
// SelectVoucher,
// Settings,
// StripeCheckout,
// Menu,
// } from "../screens";
import { THEME } from "../Theme";
import { ICONS_NAME, NAVIGATION_SCREEN } from "../utils/constant";
import navigationService from "./navigationService";
import screenOptions from "./screenOptions";
import styles from "./styles";
const NavigationStack = createStackNavigator();
const MainStack = createStackNavigator();
const SideDrawer = createDrawerNavigator();
function Drawer() { function Drawer() {
const { colors } = useTheme() const { colors } = useTheme();
let animatedStyle = {} let animatedStyle = {};
let opacity let opacity;
let OuterWindowSlide, InnerWindowSlide let OuterWindowSlide, InnerWindowSlide;
return ( return (
<SideDrawer.Navigator <SideDrawer.Navigator
drawerType="slide" drawerType="slide"
overlayColor="transparent" overlayColor="transparent"
drawerStyle={{ screenOptions={{
flex: 1, drawerStyle: {
backgroundColor: colors.drawerBackground, flex: 1,
width: '60%', backgroundColor: colors.drawerBackground,
justifyContent: 'space-between', width: "60%",
borderRightWidth: 0, justifyContent: "space-between",
shadowOpacity: 0, borderRightWidth: 0,
elevation: 0 shadowOpacity: 0,
elevation: 0,
},
sceneContainerStyle: { backgroundColor: colors.drawerBackground },
}} }}
sceneContainerStyle={{ backgroundColor: colors.drawerBackground }} // drawerStyle={{
drawerContent={props => { // flex: 1,
// backgroundColor: colors.drawerBackground,
// width: "60%",
// justifyContent: "space-between",
// borderRightWidth: 0,
// shadowOpacity: 0,
// elevation: 0,
// }}
// sceneContainerStyle={{ backgroundColor: colors.drawerBackground }}
drawerContent={(props) => {
const scale = Animated.interpolateNode(props.progress, { const scale = Animated.interpolateNode(props.progress, {
inputRange: [0, 1], inputRange: [0, 1],
outputRange: [1, 0.7] outputRange: [1, 0.7],
}) });
const Animatedopacity = Animated.interpolateNode(props.progress, { const Animatedopacity = Animated.interpolateNode(props.progress, {
inputRange: [0, 0.6, 1], inputRange: [0, 0.6, 1],
outputRange: [0, 0, 1] outputRange: [0, 0, 1],
}) });
const AnimatedOuterSlide = Animated.interpolateNode(props.progress, { const AnimatedOuterSlide = Animated.interpolateNode(props.progress, {
inputRange: [0, 1], inputRange: [0, 1],
outputRange: [0, -35] outputRange: [0, -35],
}) });
const AnimatedInnerSlide = Animated.interpolateNode(props.progress, { const AnimatedInnerSlide = Animated.interpolateNode(props.progress, {
inputRange: [0, 1], inputRange: [0, 1],
outputRange: [0, -15] outputRange: [0, -15],
}) });
const borderRadius = Animated.interpolateNode(props.progress, { const borderRadius = Animated.interpolateNode(props.progress, {
inputRange: [0, 1], inputRange: [0, 1],
outputRange: [0, 20] outputRange: [0, 20],
}) });
animatedStyle = { borderRadius, transform: [{ scale }] } animatedStyle = { borderRadius, transform: [{ scale }] };
opacity = Animatedopacity opacity = Animatedopacity;
OuterWindowSlide = AnimatedOuterSlide OuterWindowSlide = AnimatedOuterSlide;
InnerWindowSlide = AnimatedInnerSlide InnerWindowSlide = AnimatedInnerSlide;
return <Sidebar {...props} />
}}> return <Sidebar {...props} />;
<SideDrawer.Screen name="noDrawer"> }}
{props => ( >
<SideDrawer.Screen name="noDrawer" options={{ headerShown: false }}>
{(props) => (
<NoDrawer <NoDrawer
{...props} {...props}
style={animatedStyle} style={animatedStyle}
@ -105,10 +146,11 @@ function Drawer() {
)} )}
</SideDrawer.Screen> </SideDrawer.Screen>
</SideDrawer.Navigator> </SideDrawer.Navigator>
) );
} }
function NoDrawer({ style, opacity = 1, OuterWindowSlide, InnerWindowSlide }) { function NoDrawer({ style, opacity = 1, OuterWindowSlide, InnerWindowSlide }) {
const { colors } = useTheme() const { colors } = useTheme();
return ( return (
<React.Fragment> <React.Fragment>
@ -120,15 +162,17 @@ function NoDrawer({ style, opacity = 1, OuterWindowSlide, InnerWindowSlide }) {
/> />
<Animated.View style={[styles.animatedView, style]}> <Animated.View style={[styles.animatedView, style]}>
<NavigationStack.Navigator <NavigationStack.Navigator
mode="modal" //mode="modal"
presentation="modal"
screenOptions={screenOptions({ screenOptions={screenOptions({
textColor: colors.headerTextColor textColor: colors.headerTextColor,
})}> })}
>
<NavigationStack.Screen <NavigationStack.Screen
name={NAVIGATION_SCREEN.Menu} name={NAVIGATION_SCREEN.Menu}
component={Menu} component={Menu}
options={{ options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} /> headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}} }}
/> />
<NavigationStack.Screen <NavigationStack.Screen
@ -143,14 +187,14 @@ function NoDrawer({ style, opacity = 1, OuterWindowSlide, InnerWindowSlide }) {
name={NAVIGATION_SCREEN.Profile} name={NAVIGATION_SCREEN.Profile}
component={Profile} component={Profile}
options={{ options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} /> headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}} }}
/> />
<NavigationStack.Screen <NavigationStack.Screen
name={NAVIGATION_SCREEN.Addresses} name={NAVIGATION_SCREEN.Addresses}
component={Addresses} component={Addresses}
options={{ options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} /> headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}} }}
/> />
<NavigationStack.Screen <NavigationStack.Screen
@ -177,14 +221,14 @@ function NoDrawer({ style, opacity = 1, OuterWindowSlide, InnerWindowSlide }) {
name={NAVIGATION_SCREEN.Help} name={NAVIGATION_SCREEN.Help}
component={Help} component={Help}
options={{ options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} /> headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}} }}
/> />
<NavigationStack.Screen <NavigationStack.Screen
name={NAVIGATION_SCREEN.Chat} name={NAVIGATION_SCREEN.Chat}
component={Chat} component={Chat}
options={{ options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} /> headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}} }}
/> />
<NavigationStack.Screen <NavigationStack.Screen
@ -195,7 +239,7 @@ function NoDrawer({ style, opacity = 1, OuterWindowSlide, InnerWindowSlide }) {
name={NAVIGATION_SCREEN.Settings} name={NAVIGATION_SCREEN.Settings}
component={Settings} component={Settings}
options={{ options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} /> headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}} }}
/> />
<NavigationStack.Screen <NavigationStack.Screen
@ -210,7 +254,7 @@ function NoDrawer({ style, opacity = 1, OuterWindowSlide, InnerWindowSlide }) {
name={NAVIGATION_SCREEN.MyOrders} name={NAVIGATION_SCREEN.MyOrders}
component={MyOrders} component={MyOrders}
options={{ options={{
headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} /> headerLeft: () => <LeftButton icon={ICONS_NAME.Menu} />,
}} }}
/> />
<NavigationStack.Screen <NavigationStack.Screen
@ -249,51 +293,60 @@ function NoDrawer({ style, opacity = 1, OuterWindowSlide, InnerWindowSlide }) {
</Animated.View> </Animated.View>
<Animated.View style={[styles.closeView, { opacity: opacity }]}> <Animated.View style={[styles.closeView, { opacity: opacity }]}>
<TextDefault H4 medium> <TextDefault H4 medium>
{'Close X'} {"Close X"}
</TextDefault> </TextDefault>
</Animated.View> </Animated.View>
</React.Fragment> </React.Fragment>
) );
} }
function AppContainer() { function AppContainer() {
const colorScheme = useColorScheme() console.log("AppContainer Working");
const colorScheme = useColorScheme();
function _handleNotification(notification) { function _handleNotification(notification) {
try { try {
if (notification.origin === 'selected') { if (notification.origin === "selected") {
if (notification.data.order) { if (notification.data.order) {
navigationService.navigate(NAVIGATION_SCREEN.OrderDetail, { navigationService.navigate(NAVIGATION_SCREEN.OrderDetail, {
_id: notification.data._id _id: notification.data._id,
}) });
} }
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e);
} }
} }
useEffect(() => { useEffect(() => {
Notifications.setNotificationHandler({ Notifications.setNotificationHandler({
handleNotification: async() => ({ handleNotification: async () => ({
shouldShowAlert: true, shouldShowAlert: true,
shouldPlaySound: false, shouldPlaySound: false,
shouldSetBadge: false shouldSetBadge: false,
}) }),
}) });
const subscription = const subscription =
Notifications.addNotificationResponseReceivedListener(_handleNotification) Notifications.addNotificationResponseReceivedListener(
return () => subscription.remove() _handleNotification
}, []) );
return () => subscription.remove();
}, []);
return ( return (
<SafeAreaProvider initialMetrics={initialWindowMetrics}> <SafeAreaProvider initialMetrics={initialWindowMetrics}>
<NavigationContainer <NavigationContainer
theme={colorScheme === 'dark' ? THEME.Dark : THEME.Light} theme={colorScheme === "dark" ? THEME.Dark : THEME.Light}
ref={ref => { ref={(ref) => {
navigationService.setGlobalRef(ref) navigationService.setGlobalRef(ref);
Notifications.addNotificationReceivedListener(_handleNotification) Notifications.addNotificationReceivedListener(_handleNotification);
}}> }}
>
<MainStack.Navigator <MainStack.Navigator
headerMode="none" screenOptions={{
initialRouteName={NAVIGATION_SCREEN.Drawer}> headerShown: false,
}}
//headerMode="none"
initialRouteName={NAVIGATION_SCREEN.Drawer}
>
<MainStack.Screen <MainStack.Screen
name={NAVIGATION_SCREEN.Drawer} name={NAVIGATION_SCREEN.Drawer}
component={Drawer} component={Drawer}
@ -301,7 +354,7 @@ function AppContainer() {
</MainStack.Navigator> </MainStack.Navigator>
</NavigationContainer> </NavigationContainer>
</SafeAreaProvider> </SafeAreaProvider>
) );
} }
export default AppContainer export default AppContainer;

View File

@ -1,19 +1,20 @@
import { useQuery } from '@apollo/react-hooks' import { useQuery } from "@apollo/react-hooks";
import { useNavigation, useRoute } from '@react-navigation/native' import { useNavigation, useRoute } from "@react-navigation/native";
import { useHeaderHeight } from '@react-navigation/stack' //import { useHeaderHeight } from '@react-navigation/stack'
import gql from 'graphql-tag' import { useHeaderHeight } from "@react-navigation/elements";
import { get } from 'lodash' import gql from "graphql-tag";
import React, { useContext, useLayoutEffect, useRef, useState } from 'react' import { get } from "lodash";
import React, { useContext, useLayoutEffect, useRef, useState } from "react";
import { import {
FlatList, FlatList,
ImageBackground, ImageBackground,
Platform, Platform,
TouchableOpacity, TouchableOpacity,
View View,
} from 'react-native' } from "react-native";
import { Modalize } from 'react-native-modalize' import { Modalize } from "react-native-modalize";
import { foods } from '../../apollo/server' import { foods } from "../../apollo/server";
import EmptyFood from '../../assets/images/SVG/imageComponents/EmptyFood' import EmptyFood from "../../assets/images/SVG/imageComponents/EmptyFood";
import { import {
EnategaImage, EnategaImage,
FilterModal, FilterModal,
@ -22,40 +23,40 @@ import {
Spinner, Spinner,
TextDefault, TextDefault,
TextError, TextError,
WrapperView WrapperView,
} from '../../components' } from "../../components";
import ConfigurationContext from '../../context/Configuration' import ConfigurationContext from "../../context/Configuration";
import UserContext from '../../context/User' import UserContext from "../../context/User";
import { alignment } from '../../utils/alignment' import { alignment } from "../../utils/alignment";
import { ICONS_NAME, NAVIGATION_SCREEN, SORT_DATA } from '../../utils/constant' import { ICONS_NAME, NAVIGATION_SCREEN, SORT_DATA } from "../../utils/constant";
import { moderateScale, scale } from '../../utils/scaling' import { moderateScale, scale } from "../../utils/scaling";
import useStyle from './styles' import useStyle from "./styles";
// constants // constants
const FOODS = gql` const FOODS = gql`
${foods} ${foods}
` `;
function MenuItems() { function MenuItems() {
const route = useRoute() const route = useRoute();
const styles = useStyle() const styles = useStyle();
const headerHeight = useHeaderHeight() const headerHeight = useHeaderHeight();
const navigation = useNavigation() const navigation = useNavigation();
const _id = route.params._id ?? null const _id = route.params._id ?? null;
const imgMenu = route.params.img_menu ?? null const imgMenu = route.params.img_menu ?? null;
const title = route.params.title ?? null const title = route.params.title ?? null;
const description = route.params.description ?? null const description = route.params.description ?? null;
const [filters, setFilters] = useState({}) const [filters, setFilters] = useState({});
const { loading, error, data, refetch, networkStatus } = useQuery(FOODS, { const { loading, error, data, refetch, networkStatus } = useQuery(FOODS, {
variables: { category: _id, ...filters } variables: { category: _id, ...filters },
}) });
const { addCartItem } = useContext(UserContext) const { addCartItem } = useContext(UserContext);
const configuration = useContext(ConfigurationContext) const configuration = useContext(ConfigurationContext);
const modalizeRef = useRef(null) const modalizeRef = useRef(null);
const closeModal = () => { const closeModal = () => {
modalizeRef.current.close() modalizeRef.current.close();
} };
useLayoutEffect(() => { useLayoutEffect(() => {
navigation.setOptions({ navigation.setOptions({
@ -65,26 +66,26 @@ function MenuItems() {
icon={ICONS_NAME.Filter} icon={ICONS_NAME.Filter}
onPress={() => modalizeRef.current.open()} onPress={() => modalizeRef.current.open()}
/> />
) ),
}) });
}, [navigation]) }, [navigation]);
async function onAddToCart(food) { async function onAddToCart(food) {
if (food.stock < 1) { if (food.stock < 1) {
FlashMessage({ FlashMessage({
message: 'Item out of stock' message: "Item out of stock",
}) });
return return;
} }
if ( if (
food.variations.length === 1 && food.variations.length === 1 &&
food.variations[0].addons.length === 0 food.variations[0].addons.length === 0
) { ) {
await addCartItem(food._id, food.variations[0]._id) await addCartItem(food._id, food.variations[0]._id);
navigation.navigate(NAVIGATION_SCREEN.Cart) navigation.navigate(NAVIGATION_SCREEN.Cart);
} else { } else {
navigation.navigate(NAVIGATION_SCREEN.ItemDetail, { food }) navigation.navigate(NAVIGATION_SCREEN.ItemDetail, { food });
} }
} }
@ -92,19 +93,20 @@ function MenuItems() {
return ( return (
<TouchableOpacity <TouchableOpacity
onPress={() => { onPress={() => {
onAddToCart(item) onAddToCart(item);
}} }}
activeOpacity={0.7} activeOpacity={0.7}
style={styles.cardContainer}> style={styles.cardContainer}
>
<View style={styles.cardImageContainer}> <View style={styles.cardImageContainer}>
<EnategaImage <EnategaImage
imgStyle={styles.imgResponsive} imgStyle={styles.imgResponsive}
imgSource={ imgSource={
item.img_url item.img_url
? { uri: item.img_url } ? { uri: item.img_url }
: require('../../assets/images/food_placeholder.png') : require("../../assets/images/food_placeholder.png")
} }
resizeMode={'cover'} resizeMode={"cover"}
spinnerProps={{ style: styles.loadingView }} spinnerProps={{ style: styles.loadingView }}
/> />
{item.stock < 1 && ( {item.stock < 1 && (
@ -123,10 +125,11 @@ function MenuItems() {
numberOfLines={2} numberOfLines={2}
textColor={styles.lightColor.color} textColor={styles.lightColor.color}
small small
medium> medium
>
{item.description} {item.description}
</TextDefault> </TextDefault>
<View style={{ flexDirection: 'row', alignItems: 'center' }}> <View style={{ flexDirection: "row", alignItems: "center" }}>
{item.variations[0].discounted > 0 && ( {item.variations[0].discounted > 0 && (
<TextDefault <TextDefault
textColor={styles.lightColor.color} textColor={styles.lightColor.color}
@ -134,61 +137,62 @@ function MenuItems() {
small small
bold bold
H5 H5
lineOver> lineOver
{configuration.currency_symbol}{' '} >
{configuration.currency_symbol}{" "}
{( {(
item.variations[0].price + item.variations[0].discounted item.variations[0].price + item.variations[0].discounted
).toFixed(2)} ).toFixed(2)}
</TextDefault> </TextDefault>
)} )}
<TextDefault textColor={styles.tagColor.color} H4 bolder> <TextDefault textColor={styles.tagColor.color} H4 bolder>
{configuration.currency_symbol}{' '} {configuration.currency_symbol}{" "}
{item.variations[0].price.toFixed(2)} {item.variations[0].price.toFixed(2)}
</TextDefault> </TextDefault>
</View> </View>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
) );
} }
function sortData(foods) { function sortData(foods) {
const VALUE = get(SORT_DATA, get(filters, 'sort')) const VALUE = get(SORT_DATA, get(filters, "sort"));
switch (VALUE) { switch (VALUE) {
case SORT_DATA.NameAsc: case SORT_DATA.NameAsc:
return foods.sort((a, b) => return foods.sort((a, b) =>
a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1 a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1
) );
case SORT_DATA.NameDesc: case SORT_DATA.NameDesc:
return foods.sort((a, b) => return foods.sort((a, b) =>
a.title.toLowerCase() < b.title.toLowerCase() ? 1 : -1 a.title.toLowerCase() < b.title.toLowerCase() ? 1 : -1
) );
case SORT_DATA.PriceAsc: case SORT_DATA.PriceAsc:
return foods.sort((a, b) => return foods.sort((a, b) =>
a.variations[0].price > b.variations[0].price ? 1 : -1 a.variations[0].price > b.variations[0].price ? 1 : -1
) );
case SORT_DATA.PriceDesc: case SORT_DATA.PriceDesc:
return foods.sort((a, b) => return foods.sort((a, b) =>
a.variations[0].price < b.variations[0].price ? 1 : -1 a.variations[0].price < b.variations[0].price ? 1 : -1
) );
default: default:
return foods.sort((a, b) => (a.img_url < b.img_url ? 1 : -1)) return foods.sort((a, b) => (a.img_url < b.img_url ? 1 : -1));
} }
} }
const setFilterss = filterObj => { const setFilterss = (filterObj) => {
setFilters(filterObj) setFilters(filterObj);
} };
function emptyView() { function emptyView() {
if (loading) { if (loading) {
return <Spinner /> return <Spinner />;
} else if (error) { } else if (error) {
return ( return (
<TextError <TextError
text={error ? error.message : 'No Foods'} text={error ? error.message : "No Foods"}
backColor="transparent" backColor="transparent"
/> />
) );
} else { } else {
return ( return (
<View style={styles.emptyContainer}> <View style={styles.emptyContainer}>
@ -197,7 +201,7 @@ function MenuItems() {
No food item found No food item found
</TextDefault> </TextDefault>
</View> </View>
) );
} }
} }
@ -210,27 +214,30 @@ function MenuItems() {
source={ source={
imgMenu imgMenu
? { uri: imgMenu } ? { uri: imgMenu }
: require('../../assets/images/food_placeholder.png') : require("../../assets/images/food_placeholder.png")
}> }
>
<View style={styles.shadeContainer}></View> <View style={styles.shadeContainer}></View>
<View style={styles.backgroundImageTextContainer}> <View style={styles.backgroundImageTextContainer}>
<TextDefault <TextDefault
numberOfLines={1} numberOfLines={1}
textColor={styles.whiteFont.color} textColor={styles.whiteFont.color}
H4 H4
bolder> bolder
>
{title} {title}
</TextDefault> </TextDefault>
<TextDefault <TextDefault
numberOfLines={1} numberOfLines={1}
textColor={styles.whiteFont.color} textColor={styles.whiteFont.color}
bold> bold
>
{description} {description}
</TextDefault> </TextDefault>
</View> </View>
</ImageBackground> </ImageBackground>
</View> </View>
) );
} }
return ( return (
<WrapperView> <WrapperView>
@ -240,13 +247,13 @@ function MenuItems() {
contentContainerStyle={styles.contentContaienr} contentContainerStyle={styles.contentContaienr}
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={false}
ListHeaderComponent={renderListHeader()} ListHeaderComponent={renderListHeader()}
keyExtractor={item => item._id} keyExtractor={(item) => item._id}
ListEmptyComponent={emptyView} ListEmptyComponent={emptyView}
data={loading ? [] : error ? [] : sortData(data.foodByCategory)} data={loading ? [] : error ? [] : sortData(data.foodByCategory)}
refreshing={networkStatus === 4} refreshing={networkStatus === 4}
onRefresh={() => onRefresh={() =>
refetch({ refetch({
variables: { category: _id, ...filters } variables: { category: _id, ...filters },
}) })
} }
renderItem={({ item }) => renderGridCards(item)} renderItem={({ item }) => renderGridCards(item)}
@ -259,10 +266,11 @@ function MenuItems() {
modalTopOffset={headerHeight} modalTopOffset={headerHeight}
avoidKeyboardLikeIOS={Platform.select({ avoidKeyboardLikeIOS={Platform.select({
ios: true, ios: true,
android: false android: false,
})} })}
keyboardAvoidingOffset={2} keyboardAvoidingOffset={2}
keyboardAvoidingBehavior="height"> keyboardAvoidingBehavior="height"
>
<FilterModal <FilterModal
filterObj={filters} filterObj={filters}
setFilters={setFilterss} setFilters={setFilterss}
@ -270,6 +278,6 @@ function MenuItems() {
/> />
</Modalize> </Modalize>
</WrapperView> </WrapperView>
) );
} }
export default MenuItems export default MenuItems;