From 3e344e3d3d9a4d2ee58042bfb25129c54e9f4e3e Mon Sep 17 00:00:00 2001 From: Andrew Weber Date: Wed, 21 Jun 2023 17:41:28 -0400 Subject: [PATCH] fix: save for diff --- .prettierrc.json | 6 + app.config.js | 5 +- package-lock.json | 20 +-- src/components/modal/index.tsx | 227 +++++++++++++++++++-------------- 4 files changed, 148 insertions(+), 110 deletions(-) create mode 100644 .prettierrc.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..2b4067cf --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "trailingComma": "es5", + "useTabs": true, + "tabWidth": 4, + "semi": false +} diff --git a/app.config.js b/app.config.js index 449b6594..10666ed3 100644 --- a/app.config.js +++ b/app.config.js @@ -1,6 +1,5 @@ - const configPath = `${__dirname}/config/app.config.ts`; -require('ts-node/register'); +require("ts-node/register"); -module.exports = require(configPath); \ No newline at end of file +module.exports = require(configPath); diff --git a/package-lock.json b/package-lock.json index 7c62861e..408eeba4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,14 +12,14 @@ "@bugsnag/expo": "^48.1.0", "@cashu/cashu-ts": "^0.8.0-rc.4", "@expo/metro-config": "^0.7.1", - "@react-native-async-storage/async-storage": "1.17.11", - "@react-native-community/netinfo": "9.3.7", - "@react-native-picker/picker": "2.4.8", + "@react-native-async-storage/async-storage": "^1.17.11", + "@react-native-community/netinfo": "^9.3.7", + "@react-native-picker/picker": "^2.4.8", "@react-navigation/core": "^6.4.8", "@react-navigation/drawer": "^6.6.2", "@react-navigation/native": "^6.1.6", "@react-navigation/native-stack": "^6.9.12", - "@shopify/flash-list": "1.4.0", + "@shopify/flash-list": "^1.4.0", "axios": "^1.4.0", "expo": "^48.0.19", "expo-application": "^5.1.1", @@ -37,13 +37,13 @@ "expo-sqlite": "^11.1.1", "expo-status-bar": "^1.4.4", "react": "^18.2.0", - "react-native": "0.71.8", - "react-native-gesture-handler": "~2.9.0", + "react-native": "^0.71.8", + "react-native-gesture-handler": "^2.9.0", "react-native-qrcode-svg": "^6.2.0", - "react-native-reanimated": "~2.14.4", - "react-native-safe-area-context": "4.5.0", + "react-native-reanimated": "^2.14.4", + "react-native-safe-area-context": "^4.5.0", "react-native-screens": "^3.20.0", - "react-native-svg": "13.4.0", + "react-native-svg": "^13.4.0", "react-native-url-polyfill": "^1.3.0", "text-encoding-polyfill": "^0.6.7" }, @@ -56,7 +56,7 @@ "@types/babel__core": "^7.20.1", "@types/jest": "^29.5.2", "@types/node": "^20.3.0", - "@types/react": "~18.0.27", + "@types/react": "^18.0.27", "@types/sqlite3": "^3.1.8", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", diff --git a/src/components/modal/index.tsx b/src/components/modal/index.tsx index a17a2456..884a8732 100644 --- a/src/components/modal/index.tsx +++ b/src/components/modal/index.tsx @@ -19,125 +19,158 @@ export default function MyModal({ visible, success, isContactList, - children + children, }: IMyModalProps) { - const { color, highlight } = useContext(ThemeContext) const getCorrectStyle = () => { - if (type === 'bottom') { return styles(color, highlight).bottomView } - if (type === 'question' || type === 'success' || type === 'error' || type === 'invoiceAmount') { + if (type === 'bottom') { + return styles(color, highlight).bottomView + } + if ( + type === 'question' || + type === 'success' || + type === 'error' || + type === 'invoiceAmount' + ) { return styles(color, highlight).centeredView } } const getViewStyle = () => { - if (type === 'bottom') { return { ...styles(color, highlight).common, ...styles(color, highlight).modalView } } - if (type === 'question') { return { ...styles(color, highlight).common, ...styles(color, highlight).centeredModalView } } - if (type === 'success') { return { ...styles(color, highlight).common, ...styles(color, highlight).successModalView } } - if (type === 'error') { return { ...styles(color, highlight).common, ...styles(color, highlight).promptModalView } } + if (type === 'bottom') { + return { + ...styles(color, highlight).common, + ...styles(color, highlight).modalView, + } + } + if (type === 'question') { + return { + ...styles(color, highlight).common, + ...styles(color, highlight).centeredModalView, + } + } + if (type === 'success') { + return { + ...styles(color, highlight).common, + ...styles(color, highlight).successModalView, + } + } + if (type === 'error') { + return { + ...styles(color, highlight).common, + ...styles(color, highlight).promptModalView, + } + } if (type === 'invoiceAmount') { let styling = { ...styles(color, highlight).common, ...styles(color, highlight).invoiceAmountModalView, } if (isContactList) { - styling = { ...styling, ...styles(color, highlight).contactList } + styling = { + ...styling, + ...styles(color, highlight).contactList, + } } return styling } } - return ( - visible ? - - + + - - - {children} - - - - - : null - ) + {children} + + + + + ) : null } -const styles = (pref: TPref, h: string) => StyleSheet.create({ - modalParent: { - position: 'absolute', - top: 0, - right: 0, - bottom: 0, - left: 0, - backgroundColor: 'rgba(0, 0, 0, .5)', - }, - common: { - backgroundColor: pref.BACKGROUND, - alignItems: 'center', - shadowColor: '#000', - shadowOffset: { - width: 0, - height: 2, +const styles = (pref: TPref, h: string) => + StyleSheet.create({ + modalParent: { + position: 'absolute', + top: 0, + right: 0, + bottom: 0, + left: 0, + backgroundColor: 'rgba(0, 0, 0, .5)', }, - shadowOpacity: 0.25, - shadowRadius: 4, - elevation: 5, - }, - // Bottom Modal - bottomView: { - flex: 1, - justifyContent: 'flex-end', - alignItems: 'center', - }, - modalView: { - width: '100%', - borderTopLeftRadius: 20, - borderTopRightRadius: 20, - padding: 20, - }, - // Centered Modal - centeredView: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - }, - centeredModalView: { - width: '90%', - borderRadius: 20, - borderWidth: 3, - borderColor: hi[h], - paddingTop: 50, - paddingBottom: 50, - paddingRight: 20, - paddingLeft: 20, - }, - // Success Modal - successModalView: { - width: '90%', - borderRadius: 20, - }, - promptModalView: { - width: '90%', - borderRadius: 20, - borderWidth: 3, - borderColor: hi[h], - padding: 20, - }, - invoiceAmountModalView: { - width: '100%', - height: '100%', - padding: 20, - justifyContent: 'space-between', - }, - contactList: { - paddingHorizontal: 0, - } -}) + common: { + backgroundColor: pref.BACKGROUND, + alignItems: 'center', + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 2, + }, + shadowOpacity: 0.25, + shadowRadius: 4, + elevation: 5, + }, + // Bottom Modal + bottomView: { + flex: 1, + justifyContent: 'flex-end', + alignItems: 'center', + }, + modalView: { + width: '100%', + borderTopLeftRadius: 20, + borderTopRightRadius: 20, + padding: 20, + }, + // Centered Modal + centeredView: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + }, + centeredModalView: { + width: '90%', + borderRadius: 20, + borderWidth: 3, + borderColor: hi[h], + paddingTop: 50, + paddingBottom: 50, + paddingRight: 20, + paddingLeft: 20, + }, + // Success Modal + successModalView: { + width: '90%', + borderRadius: 20, + }, + promptModalView: { + width: '90%', + borderRadius: 20, + borderWidth: 3, + borderColor: hi[h], + padding: 20, + }, + invoiceAmountModalView: { + width: '100%', + height: '100%', + padding: 20, + justifyContent: 'space-between', + }, + contactList: { + paddingHorizontal: 0, + }, + })