{"id":25308966,"url":"https://github.com/HiCodex/cash-file","last_synced_at":"2025-10-28T14:30:18.712Z","repository":{"id":166676934,"uuid":"371987762","full_name":"erabosscode/cash-file","owner":"erabosscode","description":"A cash management mobile app built with React Native (Expo) and Firebase","archived":false,"fork":false,"pushed_at":"2022-08-12T16:18:28.000Z","size":773,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-07T02:22:53.417Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erabosscode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-29T14:02:31.000Z","updated_at":"2024-04-13T13:22:51.000Z","dependencies_parsed_at":"2023-06-01T15:15:54.153Z","dependency_job_id":null,"html_url":"https://github.com/erabosscode/cash-file","commit_stats":null,"previous_names":["tradecoder/cash-file","logixmaster/cash-file","mydigita/cash-file","erabossid/cash-file","erabosstt/cash-file","erabosscode/cash-file"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erabosscode%2Fcash-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erabosscode%2Fcash-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erabosscode%2Fcash-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erabosscode%2Fcash-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erabosscode","download_url":"https://codeload.github.com/erabosscode/cash-file/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238658777,"owners_count":19509124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-13T12:44:07.839Z","updated_at":"2025-10-28T14:30:18.309Z","avatar_url":"https://github.com/erabosscode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native (Expo) and Firebase App\nA simple cash management android app built with expo and firebase\n\n\n## Firebase configuration\n1. Add firebase `npm install firebase` or `yarn add firebase`\n2. Create a `src` folder in the root directory \n3. Create a `firebase` folder inside the `src` folder\n4. Create a `config.js` file in the `firebase` folder\n5. Add the following codes to the `config.js` file\n\n```javascript\nimport * as firebase from 'firebase';\nimport '@firebase/auth';\nimport '@firebase/firestore';\n\nconst firebaseConfig = {\n    apiKey: \"\",\n    authDomain: \"\",\n    databaseURL: \"\",\n    projectId: \"\",\n    storageBucket: \"\",\n    messagingSenderId: \"\",\n    appId: \"\",\n    measurementId: \"\"\n  };\n\n\nfirebase.initializeApp(firebaseConfig);\n\nexport { firebase };\n\n```\n* Rremember, we need to replace the `firebaseConfig={}` data. To get the valid data please follow the below steps now\n\n## Register an app with firebase and configure\n1. Signin on the  Firebase Console [https://console.firebase.google.com](https://console.firebase.google.com)\n2. Create a new project (you also can use your exising project) - click on `+ Add Project`\n3. After creating it, the Project Overview screen, click on `\u003c/\u003e` `web`  to register an app\n4. Give a name to your app, click on `Register app` and complete it\n5. Setup `Authentication` from the firebase menubar and for this time select `email and password` option\n6. Now you will get the `firebaseConfig` data in the app console, there are two options, `CDN` and `Config`, select config and copy the full code like \n\n```javascript\nconst firebaseConfig = {\n  apiKey: \"AIzaSyDcCMBuqjQN_your_project_api_key_here\",\n  authDomain: \"your_app_name.firebaseapp.com\",\n  databaseURL: \"https://your_app_database_url_here.firebaseio.com\",\n  projectId: \"your_project_id_here\",\n  storageBucket: \"your_app_storage_bucket_here.appspot.com\",\n  messagingSenderId: \"your_app_message_sender_id_here\",\n  appId: \"your_app_id_here\",\n  measurementId: \"your_app_measurement_id_here\"\n};\n\n```\n7. Then paste/replace the code to the `config.js` for the `const firebaseConfig={}`\n\n## Create Screen components\nCreate required Screens\n\n\n## Signup screen\n\n```javascript\nimport React, { useState } from 'react';\nimport { TouchableOpacity } from 'react-native';\nimport { firebase } from '../firebase/config';\nimport { NativeBaseProvider, VStack, Heading, Box, Text, Input, Button } from 'native-base';\n\nexport default function SignupScreen({ navigation }) {\n  const [firstName, setFirstName] = useState(\"\");\n  const [lastName, setLastName] = useState(\"\");\n  const [email, setEmail] = useState(\"\");\n  const [mobile, setMobile] = useState(\"\");\n  const [password, setPassword] = useState(\"\");\n  const [errorList, setErrorList] = useState([]);\n  const validFirstName = /../.test(firstName);  // minimum 2 chars\n  const validLastName = /../.test(lastName); // minimum 2 chars\n  const validEmail = /.....@gmail.com/.test(email); // only gmail accepted\n  const validMobile = /01[3-9]......../.test(mobile); // valid only for mobile operators in Bangladesh\n  const validPassword = () =\u003e {\n    // minimum 8 digit password with uppercase, lowercase and numbers pattern\n    if ((/......../).test(password)\n      \u0026\u0026 (/[A-Z]/).test(password)\n      \u0026\u0026 (/[a-z]/).test(password)\n      \u0026\u0026 (/[0-9]/).test(password)) {\n      return true;\n    } else {\n      return false;\n    }\n  }\n\n  // Check if all data is valid\n  const isDataValid = () =\u003e {\n    if (validFirstName \u0026\u0026 validLastName \u0026\u0026 validEmail \u0026\u0026 validMobile \u0026\u0026 validPassword()) {\n      return true;\n    } else {\n      return false\n    }\n  }\n\n  // On change input event handlers \n  function onChangeFirstName(e) {\n    setFirstName(e.replace(/[^A-Za-z]/g, ''));\n  }\n  function onChangeLastName(e) {\n    setLastName(e.replace(/[^A-Za-z]/g, ''));\n  }\n  function onChangeEmail(e) {\n    setEmail(e)\n  }\n  function onChangeMobile(e) {\n    setMobile(e.replace(/[^0-9]/g, ''));\n  }\n  function onChangePassword(e) {\n    setPassword(e);\n  }\n\n  // check invalid input data and make a list of them\n  function inputDataCheckPoint() {\n\n    let invalidData = [];\n    if (!validFirstName) {\n      invalidData.push(\"Invalid first name\")\n    }\n    if (!validLastName) {\n      invalidData.push(\"Invalid last name\")\n    }\n    if (!validEmail) {\n      invalidData.push(\"Invalid gmail address\")\n    }\n\n    if (!validMobile) {\n      invalidData.push(\"Invalid mobile number\")\n    }\n    if (!validPassword()) {\n      invalidData.push(\"Use password longer than 8, combining capital and small letters and numbers\")\n    }\n    setErrorList(invalidData);\n  }\n\n  // Show list of invaid input data if any\n  function showInvalidDataList() {\n    return (errorList.map((e, i) =\u003e {\n      return (\u003cText key={i} style={{ color: \"red\" }}\u003e{i + 1}. {e}.{\"\\n\"}\u003c/Text\u003e)\n    }))\n  }\n\n  // Send data to firebase if all information is given\n  // if not, send error alert and a list of invalid input\n\n  function onPressSignup() {\n\n    //check and send input error if any\n    inputDataCheckPoint();\n\n    // send data to firebase if everything is ok\n    if (isDataValid()) {\n      firebase.auth()\n        .createUserWithEmailAndPassword(email, password)\n        .then(response =\u003e {\n          const uid = response.user.uid;\n          const data = { _id: uid, firstName, lastName, email, mobile, accountList: [] };\n         // console.log(data);\n\n          const usersRef = firebase.firestore().collection('users');\n          usersRef.doc(uid)\n            .set(data)\n            .then((e) =\u003e {\n              alert(\"success\");\n              navigation.navigate(\"Home\")\n            })\n            .catch(() =\u003e alert(\"System Error! Please try again later.\"))\n        })\n        .catch(() =\u003e alert(\"Could not connect to server! Please try again later\"))\n    } else {\n      alert(\"Please provide correct information!\")\n    }\n  }\n\n  return (\n    \u003cNativeBaseProvider\u003e\n\n      \u003cVStack p={5} space={3}\u003e\n        \u003cText mb={15}\u003e{errorList.length ? showInvalidDataList() : \u003cHeading size='md'\u003eSignup to continue\u003c/Heading\u003e}\u003c/Text\u003e\n\n        \u003cInput placeholder='First name' value={firstName} onChangeText={onChangeFirstName} size='lg' /\u003e\n        \u003cInput placeholder='Last name' value={lastName} onChangeText={onChangeLastName} size='lg' /\u003e\n        \u003cInput placeholder='Gmail address' onChangeText={onChangeEmail} maxLength={35} size='lg' /\u003e\n        \u003cInput placeholder='Mobile number' value={mobile} keyboardType=\"number-pad\" maxLength={11} onChangeText={onChangeMobile} size='lg' /\u003e\n        \u003cInput placeholder='Password' onChangeText={onChangePassword} secureTextEntry={true} size='lg' /\u003e\n        \u003cButton onPress={onPressSignup} _text={{ fontSize: 20 }} size='lg' colorScheme={'yellow'}\u003eSignup\u003c/Button\u003e\n\n        \u003cBox mt={5}\u003e\n          \u003cTouchableOpacity onPress={() =\u003e navigation.navigate(\"Login\")}\u003e\n            \u003cText\u003e\n              Have an account? \u003cText bold fontSize={16} color={'orange.700'}\u003eLogin here\u003c/Text\u003e\n            \u003c/Text\u003e\n          \u003c/TouchableOpacity\u003e\n        \u003c/Box\u003e\n\n      \u003c/VStack\u003e\n\n    \u003c/NativeBaseProvider\u003e\n  )\n}\n```\n\n## Login screen\n\n```javascript\n\nimport React, { useState } from 'react';\nimport { NativeBaseProvider, VStack, Icon, Heading, Box, Text, Input, Button } from 'native-base';\nimport { TouchableOpacity } from 'react-native';\nimport { firebase } from '../firebase/config';\nimport { MaterialIcons } from \"@expo/vector-icons\"\n\n// ignore yellow error for setting a timer...\nimport { LogBox } from 'react-native';\nLogBox.ignoreLogs(['Setting a timer']);\n\n\n// app login\nexport default function LoginScreen({ navigation }) {\n    const [email, setEmail] = useState(\"\");\n    const [password, setPassword] = useState(\"\");\n\n    function onChangeEmail(e) {\n        setEmail(e)\n    }\n\n    function onChangePassword(e) {\n        setPassword(e)\n    }\n\n    function onPressLogin() {\n        firebase.auth()\n            .signInWithEmailAndPassword(email, password)\n            .then(response =\u003e {\n                const uid = response.user.uid;\n                const usersRef = firebase.firestore().collection(\"users\");\n                usersRef.doc(uid)\n                    .get()\n                    .then(firebaseData =\u003e {\n                        if (!firebaseData.exists) {\n                            alert(\"No record found! Try with another email\");\n                            return;\n                        }\n                        const user = firebaseData.data();\n                        //navigate to Home page and send user data\n                        navigation.navigate(\"Home\", { user });\n                    })\n                    .catch(err =\u003e alert(err))\n            })\n            .catch(err =\u003e alert(err))\n\n    }\n\n    return (\n        \u003cNativeBaseProvider\u003e\n            \u003cVStack p={5} flex={1} space={4}\u003e\n                \u003cHeading size={'md'} mb={15}\u003eLogin to continue\u003c/Heading\u003e\n\n                \u003cInput placeholder='Gmail address' onChangeText={onChangeEmail} value={email} maxLength={35} size={'lg'}\n                    InputLeftElement={\n                        \u003cIcon\n                            as={\u003cMaterialIcons name=\"email\" /\u003e}\n                            size={7}\n                            ml=\"2\"\n                            color=\"yellow.500\"\n                        /\u003e\n                    } /\u003e\n                \u003cInput placeholder='Password / max 24' onChangeText={onChangePassword} value={password} secureTextEntry={true} maxLength={24} size={'lg'}\n                    InputLeftElement={\n                        \u003cIcon\n                            as={\u003cMaterialIcons name=\"lock\" /\u003e}\n                            size={7}\n                            ml=\"2\"\n                            color=\"yellow.500\"\n                        /\u003e\n                    } /\u003e\n                \u003cButton onPress={onPressLogin} size={'lg'} colorScheme={'yellow'} mt={8} _text={{fontSize:20}}\u003eLogin\u003c/Button\u003e\n\n                \u003cBox mt={5}\u003e                    \n                        \u003cTouchableOpacity onPress={() =\u003e navigation.navigate(\"Signup\")}\u003e\n\n                            \u003cText\u003e\n                                Not registered? \u003cText bold color={'orange.700'} fontSize={16}\u003eSignup\u003c/Text\u003e\n                            \u003c/Text\u003e\n\n                        \u003c/TouchableOpacity\u003e                    \n                \u003c/Box\u003e\n            \u003c/VStack\u003e\n        \u003c/NativeBaseProvider\u003e\n    )\n}\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHiCodex%2Fcash-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHiCodex%2Fcash-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHiCodex%2Fcash-file/lists"}