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,
"package": "com.enatega.vendor",
"googleServicesFile": "./google-services-prod.json",
"useNextNotificationsApi": true,
"config": {
"googleMaps": {
"apiKey": ""

View File

@ -3,54 +3,48 @@
* path: '/environment.js' (root of your project)
******************************/
import Constants from 'expo-constants'
import Constants from "expo-constants";
const ENV = {
development: {
GRAPHQL_URL: 'http://192.168.100.90:8000/graphql',
WS_GRAPHQL_URL: 'ws://192.168.100.90:8000/graphql',
SERVER_URL: 'http://192.168.100.90:8000/', // put / at the end of server url
IOS_CLIENT_ID_GOOGLE:
'',
ANDROID_CLIENT_ID_GOOGLE:
'',
FACEBOOK_APP_ID: '404956210315749',
AMPLITUDE_API_KEY: '',
STRIPE_PUBLIC_KEY: '',
STRIPE_IMAGE_URL: 'http://192.168.100.90:8000/assets/images/logo.png',
STRIPE_STORE_NAME: 'Enatega'
GRAPHQL_URL: "http://10.97.28.88.90:8000/graphql",
WS_GRAPHQL_URL: "ws://10.97.28.88.90:8000/graphql",
SERVER_URL: "http://10.97.28.88.90:8000/", // put / at the end of server url
IOS_CLIENT_ID_GOOGLE: "",
ANDROID_CLIENT_ID_GOOGLE: "",
FACEBOOK_APP_ID: "404956210315749",
AMPLITUDE_API_KEY: "",
STRIPE_PUBLIC_KEY: "",
STRIPE_IMAGE_URL: "http://10.97.28.88.90:8000/assets/images/logo.png",
STRIPE_STORE_NAME: "Enatega",
},
staging: {
GRAPHQL_URL: 'https://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
IOS_CLIENT_ID_GOOGLE:
'',
ANDROID_CLIENT_ID_GOOGLE:
'',
FACEBOOK_APP_ID: '404956210315749',
AMPLITUDE_API_KEY: '',
STRIPE_PUBLIC_KEY: '',
GRAPHQL_URL: "https://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
IOS_CLIENT_ID_GOOGLE: "",
ANDROID_CLIENT_ID_GOOGLE: "",
FACEBOOK_APP_ID: "404956210315749",
AMPLITUDE_API_KEY: "",
STRIPE_PUBLIC_KEY: "",
STRIPE_IMAGE_URL:
'https://staging-enatega-single-api.herokuapp.com/assets/images/logo.png',
STRIPE_STORE_NAME: 'Enatega'
"https://staging-enatega-single-api.herokuapp.com/assets/images/logo.png",
STRIPE_STORE_NAME: "Enatega",
},
production: {
GRAPHQL_URL: 'https://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
IOS_CLIENT_ID_GOOGLE:
'',
ANDROID_CLIENT_ID_GOOGLE:
'',
FACEBOOK_APP_ID: '3017447961609878',
AMPLITUDE_API_KEY: '',
STRIPE_PUBLIC_KEY: '',
GRAPHQL_URL: "https://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
IOS_CLIENT_ID_GOOGLE: "",
ANDROID_CLIENT_ID_GOOGLE: "",
FACEBOOK_APP_ID: "3017447961609878",
AMPLITUDE_API_KEY: "",
STRIPE_PUBLIC_KEY: "",
STRIPE_IMAGE_URL:
'https://prod-enatega-single-api.herokuapp.com/assets/images/logo.png',
STRIPE_STORE_NAME: 'Enatega'
}
}
"https://prod-enatega-single-api.herokuapp.com/assets/images/logo.png",
STRIPE_STORE_NAME: "Enatega",
},
};
const getEnvVars = (env = Constants.manifest.releaseChannel) => {
// What is __DEV__ ?
@ -58,14 +52,14 @@ const getEnvVars = (env = Constants.manifest.releaseChannel) => {
// __DEV__ is true when run locally, but false when published.
// eslint-disable-next-line no-undef
if (__DEV__) {
return ENV.development
} else if (env === 'production') {
return ENV.production
} else if (env === 'staging') {
return ENV.staging
return ENV.development;
} else if (env === "production") {
return ENV.production;
} else if (env === "staging") {
return ENV.staging;
} 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": {
"@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",
"@react-native-async-storage/async-storage": "~1.15.0",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/drawer": "^5.12.5",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.5",
"apollo-boost": "^0.3.1",
"@react-native-async-storage/async-storage": "~1.17.3",
"@react-native-community/masked-view": "0.1.11",
"@react-navigation/drawer": "^6.6.0",
"@react-navigation/native": "^6.1.4",
"@react-navigation/native-stack": "^6.9.10",
"@react-navigation/stack": "^6.3.14",
"apollo-boost": "^0.4.9",
"apollo-cache-inmemory": "^1.5.1",
"apollo-cache-persist": "^0.1.1",
"apollo-client": "^2.5.1",
@ -41,72 +42,79 @@
"apollo-link-state": "^0.4.2",
"apollo-link-ws": "^1.0.20",
"apollo-upload-client": "^10.0.0",
"expo": "^44.0.0",
"expo-analytics-amplitude": "~11.1.0",
"apollo-utilities": "^1.3.4",
"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-loading": "~1.3.0",
"expo-apple-authentication": "~4.1.0",
"expo-application": "~4.0.1",
"expo-asset": "~8.4.6",
"expo-constants": "~13.0.1",
"expo-device": "~4.1.0",
"expo-facebook": "~12.1.0",
"expo-font": "~10.0.4",
"expo-google-app-auth": "~8.3.0",
"expo-image-picker": "~12.0.1",
"expo-linking": "~3.0.0",
"expo-localization": "~12.0.0",
"expo-location": "~14.0.1",
"expo-notifications": "~0.14.0",
"expo-splash-screen": "~0.14.1",
"expo-tracking-transparency": "~2.1.0",
"expo-updates": "~0.11.6",
"graphql": "^14.5.8",
"expo-app-loading": "~2.1.1",
"expo-apple-authentication": "~5.0.1",
"expo-application": "~5.0.1",
"expo-asset": "~8.7.0",
"expo-camera": "~13.1.0",
"expo-constants": "~14.0.2",
"expo-contacts": "~11.0.1",
"expo-device": "~5.0.0",
"expo-facebook": "~12.2.0",
"expo-font": "~11.0.1",
"expo-google-app-auth": "^8.3.0",
"expo-image-picker": "~14.0.2",
"expo-linking": "~3.3.1",
"expo-localization": "~14.0.0",
"expo-location": "~15.0.1",
"expo-notifications": "~0.17.0",
"expo-sensors": "~12.0.1",
"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",
"i18n-js": "^3.2.2",
"lodash": "^4.17.21",
"patch-package": "^6.2.2",
"react": "17.0.1",
"react-apollo": "^2.5.8",
"react-native": "0.64.3",
"react-native-flash-message": "^0.1.23",
"patch-package": "^6.5.1",
"react": "18.1.0",
"react-apollo": "^3.1.5",
"react-native": "0.70.5",
"react-native-button": "^3.0.1",
"react-native-flash-message": "^0.4.0",
"react-native-flatlist-slider": "^1.0.5",
"react-native-gesture-handler": "~2.1.0",
"react-native-gifted-chat": "^0.16.3",
"react-native-maps": "0.29.4",
"react-native-gesture-handler": "~2.8.0",
"react-native-gifted-chat": "^1.1.1",
"react-native-i18n": "1.0.0",
"react-native-maps": "1.3.2",
"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-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-reanimated": "~2.12.0",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-star-rating": "^1.1.0",
"react-native-svg": "12.1.1",
"react-native-timeline-flatlist": "^0.7.2",
"react-native-webview": "11.15.0",
"subscriptions-transport-ws": "^0.9.16",
"react-native-svg": "13.4.0",
"react-native-timeline-flatlist": "^0.8.0",
"react-native-webview": "11.23.1",
"subscriptions-transport-ws": "^0.11.0",
"uuid": "^3.3.2",
"validate.js": "^0.12.0"
"validate.js": "^0.13.1"
},
"devDependencies": {
"babel-jest": "^24.8.0",
"babel-preset-expo": "9.0.2",
"babel-jest": "^29.4.3",
"babel-preset-expo": "~9.2.1",
"babel-preset-react-native": "^4.0.1",
"eslint": "^7.28.0",
"eslint-config-standard": "^14.1.1",
"eslint": "^8.34.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.20.2",
"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-standard": "^4.0.1",
"husky": "^4.3.8",
"jest": "^26.6.3",
"eslint-plugin-standard": "^5.0.0",
"husky": "^8.0.3",
"jest": "^29.4.3",
"jest-react-native": "^18.0.0",
"lint-staged": "^10.5.4",
"metro-react-native-babel-preset": "^0.54.1",
"lint-staged": "^13.1.2",
"metro-react-native-babel-preset": "^0.75.0",
"prettier": "^2.3.1",
"prettier-config-standard": "^1.0.1",
"react-test-renderer": "^16.8.6"
"prettier-config-standard": "^5.0.0",
"react-test-renderer": "^18.2.0"
},
"jest": {
"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
index 0f85022..c12b3a6 100644
index 0f85022..e467adb 100644
--- a/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 = {
numberOfLines: PropTypes.number,
- static propTypes = {
- numberOfLines: PropTypes.number,
- style: Animated.Text.propTypes.style,
+ style: PropTypes.object,
+ // static propTypes = {
+ // numberOfLines: PropTypes.number,
+ // style: PropTypes.object,
color: PropTypes.string.isRequired,
fontSize: PropTypes.number.isRequired,
- color: PropTypes.string.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
index 494bbaa..9bbf2e2 100644
index 494bbaa..2a71c82 100644
--- a/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 = {
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
index 6060f9f..fe9d9c4 100644
index 6060f9f..86ac2c0 100644
--- a/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: PropTypes.object,
+ // style: PropTypes.object,
baseColor: PropTypes.string,
errorColor: PropTypes.string,
- baseColor: 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
index 82eaf03..809fcdd 100644
index 82eaf03..1ad9a93 100644
--- a/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 {
y1: PropTypes.number,
}),
@@ -11,41 +11,41 @@ export default class Label extends PureComponent {
restricted: false,
};
- 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,
+ style: PropTypes.object,
label: PropTypes.string,
- 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 { useHeaderHeight } from '@react-navigation/stack'
import { StyleSheet } from 'react-native'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import { scale } from '../../utils/scaling'
import { useTheme } from "@react-navigation/native";
import { useHeaderHeight } from "@react-navigation/elements";
import { StyleSheet } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { scale } from "../../utils/scaling";
const useStyle = () => {
const { colors } = useTheme()
const inset = useSafeAreaInsets()
const headerHeight = useHeaderHeight()
const { colors } = useTheme();
const inset = useSafeAreaInsets();
const headerHeight = useHeaderHeight();
return StyleSheet.create({
flex: {
flex: 1
flex: 1,
},
wrapperView: {
backgroundColor: colors.background,
paddingTop: headerHeight,
paddingBottom: inset.bottom
paddingBottom: inset.bottom,
},
topCurve: {
position: 'absolute',
position: "absolute",
opacity: 0.2,
left: -75,
borderTopRightRadius: scale(90),
@ -28,10 +28,10 @@ const useStyle = () => {
width: scale(250),
height: scale(260),
borderRadius: 100,
backgroundColor: colors.curve
backgroundColor: colors.curve,
},
bottomCurve: {
position: 'absolute',
position: "absolute",
height: scale(185),
width: scale(170),
borderTopRightRadius: scale(110),
@ -42,9 +42,9 @@ const useStyle = () => {
backgroundColor: colors.curve,
opacity: 0.2,
bottom: -80,
zIndex: -1
}
})
}
zIndex: -1,
},
});
};
export default useStyle
export default useStyle;

View File

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

View File

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