├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── issue_template.md
├── .watchmanconfig
├── pull_request_template.md
├── constants
├── index.js
└── constants.js
├── .gitignore
├── assets
├── Thumbs.db
├── b_icon.png
├── icon.png
├── splash.png
├── b_launch_screen.png
└── fonts
│ ├── Lato-Black.ttf
│ ├── Lato-Bold.ttf
│ ├── Lato-Light.ttf
│ ├── Lato-Italic.ttf
│ ├── Lato-Regular.ttf
│ ├── Lato-BoldItalic.ttf
│ ├── Lato-Hairline.ttf
│ ├── Lato-BlackItalic.ttf
│ ├── Lato-LightItalic.ttf
│ ├── Lato-HairlineItalic.ttf
│ └── OFL.txt
├── reducers
├── index.js
└── monthesReducer.js
├── babel.config.js
├── actions
├── types.js
└── monthActions.js
├── .vscode
└── launch.json
├── utils
└── index.js
├── store
└── index.js
├── package.json
├── app.json
├── components
├── BackBtn.js
├── Header.js
├── FormInput.js
├── Budjet.js
├── Switch.js
├── MonthItemRound.js
├── MonthListItem.js
├── AddNewMonthBtn.js
└── ListItemRound.js
├── README.md
├── LICENSE.md
├── App.js
└── screens
├── MonthList.js
├── Month.js
└── Form.js
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/issue_template.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/pull_request_template.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/constants/index.js:
--------------------------------------------------------------------------------
1 | export * from "./constants";
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/**/*
2 | .expo/*
3 | npm-debug.*
4 |
--------------------------------------------------------------------------------
/assets/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/Thumbs.db
--------------------------------------------------------------------------------
/assets/b_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/b_icon.png
--------------------------------------------------------------------------------
/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/icon.png
--------------------------------------------------------------------------------
/assets/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/splash.png
--------------------------------------------------------------------------------
/reducers/index.js:
--------------------------------------------------------------------------------
1 | import monthes from "./monthesReducer";
2 |
3 | export default {
4 | monthes
5 | };
6 |
--------------------------------------------------------------------------------
/assets/b_launch_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/b_launch_screen.png
--------------------------------------------------------------------------------
/assets/fonts/Lato-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-Black.ttf
--------------------------------------------------------------------------------
/assets/fonts/Lato-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-Bold.ttf
--------------------------------------------------------------------------------
/assets/fonts/Lato-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-Light.ttf
--------------------------------------------------------------------------------
/assets/fonts/Lato-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-Italic.ttf
--------------------------------------------------------------------------------
/assets/fonts/Lato-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-Regular.ttf
--------------------------------------------------------------------------------
/assets/fonts/Lato-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-BoldItalic.ttf
--------------------------------------------------------------------------------
/assets/fonts/Lato-Hairline.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-Hairline.ttf
--------------------------------------------------------------------------------
/assets/fonts/Lato-BlackItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-BlackItalic.ttf
--------------------------------------------------------------------------------
/assets/fonts/Lato-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-LightItalic.ttf
--------------------------------------------------------------------------------
/assets/fonts/Lato-HairlineItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fromtexas/react-native-budget-app/HEAD/assets/fonts/Lato-HairlineItalic.ttf
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = function(api) {
2 | api.cache(true);
3 | return {
4 | presets: ["babel-preset-expo"]
5 | };
6 | };
7 |
--------------------------------------------------------------------------------
/actions/types.js:
--------------------------------------------------------------------------------
1 | export const ADD_MONTH = "ADD_MONTH";
2 | export const ADD_NEW_LINE_IN_BUDGET = "ADD_NEW_LINE_IN_BUDGET";
3 | export const REMOVE_MONTH_BUDGET_ITEM = "REMOVE_MONTH_BUDGET_ITEM";
4 | export const REMOVE_MONTH = "REMOVE_MONTH";
5 |
--------------------------------------------------------------------------------
/constants/constants.js:
--------------------------------------------------------------------------------
1 | import { Dimensions } from "react-native";
2 |
3 | export const SCREEN_WIDTH = Dimensions.get("window").width;
4 | export const SCREEN_HEIGHT = Dimensions.get("window").height;
5 | export const MONTHS = [
6 | "January",
7 | "February",
8 | "March",
9 | "April",
10 | "May",
11 | "June",
12 | "July",
13 | "August",
14 | "September",
15 | "October",
16 | "November",
17 | "December"
18 | ];
19 | export const yyyy = new Date().getFullYear();
20 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "node",
9 | "request": "launch",
10 | "name": "Launch Program",
11 | "program": "${workspaceFolder}\\node_modules\\expo\\AppEntry.js"
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/utils/index.js:
--------------------------------------------------------------------------------
1 | export const counts = arr => {
2 | let incomes = 0;
3 | let costs = 0;
4 | let profit = 0;
5 | let percent = 0;
6 |
7 | arr.forEach(item => {
8 | if (item.or) {
9 | incomes += parseInt(item.$);
10 | } else {
11 | costs += parseInt(item.$);
12 | }
13 | });
14 |
15 | profit = incomes - costs;
16 | percent = Math.round((costs / incomes) * 100);
17 |
18 | return {
19 | incomes,
20 | costs,
21 | profit,
22 | percent: percent >= 0 ? percent : 0
23 | };
24 | };
25 |
--------------------------------------------------------------------------------
/store/index.js:
--------------------------------------------------------------------------------
1 | import { createStore, compose, applyMiddleware } from "redux";
2 | import thunk from "redux-thunk";
3 | import { persistStore, persistCombineReducers } from "redux-persist";
4 | import storage from "redux-persist/es/storage";
5 | import reducers from "../reducers";
6 |
7 | const config = {
8 | key: "root",
9 | storage
10 | };
11 |
12 | const perReducers = persistCombineReducers(config, reducers);
13 | const store = createStore(perReducers, {}, compose(applyMiddleware(thunk)));
14 | export let persistor = persistStore(store);
15 |
16 | export default store;
17 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "node_modules/expo/AppEntry.js",
3 | "private": true,
4 | "dependencies": {
5 | "expo": "^31.0.2",
6 | "prop-types": "^15.6.2",
7 | "react": "16.5.0",
8 | "react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
9 | "react-native-datepicker": "^1.7.2",
10 | "react-native-elements": "^0.18.5",
11 | "react-navigation": "^1.5.11",
12 | "react-redux": "^5.0.7",
13 | "redux": "^3.7.2",
14 | "redux-persist": "^5.9.1",
15 | "redux-thunk": "^2.2.0",
16 | "uuid": "^3.2.1"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/actions/monthActions.js:
--------------------------------------------------------------------------------
1 | import {
2 | ADD_MONTH,
3 | ADD_NEW_LINE_IN_BUDGET,
4 | REMOVE_MONTH_BUDGET_ITEM,
5 | REMOVE_MONTH
6 | } from "./types";
7 |
8 | export const addMonth = (date, id) => ({
9 | type: ADD_MONTH,
10 | date,
11 | id
12 | });
13 |
14 | export const addNewLineinMonthBudget = (id, payload) => ({
15 | type: ADD_NEW_LINE_IN_BUDGET,
16 | id,
17 | payload
18 | });
19 |
20 | export const removeMonthBudgetItem = (id, itemId) => ({
21 | type: REMOVE_MONTH_BUDGET_ITEM,
22 | id,
23 | itemId
24 | });
25 |
26 | export const removeMonth = id => ({
27 | type: REMOVE_MONTH,
28 | id
29 | });
30 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "budgety",
4 | "description": "This project is fun and usefull (no).",
5 | "slug": "budgety",
6 | "privacy": "public",
7 | "sdkVersion": "31.0.0",
8 | "platforms": ["ios", "android"],
9 | "version": "1.0.0",
10 | "orientation": "portrait",
11 | "icon": "./assets/b_icon.png",
12 | "splash": {
13 | "image": "./assets/b_launch_screen.png",
14 | "resizeMode": "contain",
15 | "backgroundColor": "#ff6666"
16 | },
17 | "updates": {
18 | "fallbackToCacheTimeout": 0
19 | },
20 | "assetBundlePatterns": ["**/*"],
21 | "ios": {
22 | "supportsTablet": true
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/components/BackBtn.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { StyleSheet } from "react-native";
3 | import { Icon } from "react-native-elements";
4 | import PropTypes from "prop-types";
5 |
6 | export default function BackBtn(props) {
7 | return (
8 |
16 | );
17 | }
18 |
19 | BackBtn.propTypes = {
20 | style: PropTypes.object,
21 | back: PropTypes.func
22 | };
23 |
24 | const styles = StyleSheet.create({
25 | back: {
26 | borderRadius: 50,
27 | height: 80,
28 | width: 80,
29 | backgroundColor: "#ff6666"
30 | }
31 | });
32 |
--------------------------------------------------------------------------------
/components/Header.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import { View, Text, StyleSheet } from "react-native";
3 | import PropTypes from "prop-types";
4 |
5 | export default class Header extends PureComponent {
6 | render() {
7 | return (
8 |
9 | {this.props.title}
10 |
11 | );
12 | }
13 | }
14 |
15 | Header.propTypes = {
16 | title: PropTypes.string
17 | };
18 |
19 | const styles = StyleSheet.create({
20 | container: {
21 | height: 75,
22 | elevation: 3,
23 | justifyContent: "center",
24 | backgroundColor: "#fdfdfd",
25 | marginBottom: 25
26 | },
27 | text: {
28 | paddingLeft: 50,
29 | color: "#777",
30 | fontSize: 22,
31 | fontWeight: "bold"
32 | }
33 | });
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # React Native budget app
2 |
3 | > Budget app with React Native, Redux, Expo -> [Preview](https://expo.io/@fromtexas/budgety)
4 |
5 | 
6 |
7 | ## Requirements
8 |
9 | You need [Expo](https://expo.io/) pre-installed and you’re good to go.
10 |
11 | ## Setup
12 |
13 | 1. Clone Repository
14 | 2. `cd react-native-budget-app`
15 | 3. `npm i`
16 | 4. `expo start`
17 |
18 | ## Includes
19 |
20 | - react
21 | - react-native
22 | - redux
23 | - react-redux
24 | - react-native-elements
25 | - react-navigation
26 | - uuid
27 | - redux-persist
28 |
29 | ## Features
30 |
31 | - add month
32 | - remove month
33 | - add incomes/costs to month
34 | - remove incomes/costs
35 | - count percentage costs
36 |
37 | ## Improve
38 |
39 | Feedback is more than appreciated [GitHub](https://github.com/fromtexas).
40 | You are 100% allowed to use this app for both personal and commercial use, but not claim it as your own. A credit to the original author is of course highly appreciated!
41 |
--------------------------------------------------------------------------------
/components/FormInput.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { View, TextInput, StyleSheet } from "react-native";
3 | import PropTypes from "prop-types";
4 |
5 | export default function FormInput({ onChangeText, value, placeholder }) {
6 | return (
7 |
8 |
15 |
16 | );
17 | }
18 |
19 | FormInput.propTypes = {
20 | onChangeText: PropTypes.func,
21 | value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
22 | placeholder: PropTypes.string
23 | };
24 |
25 | const styles = StyleSheet.create({
26 | input: {
27 | height: 50,
28 | fontSize: 18
29 | },
30 | inputWrap: {
31 | height: 80,
32 | backgroundColor: "#f1f1f1",
33 | borderRadius: 50,
34 | paddingLeft: 20,
35 | paddingRight: 20,
36 | justifyContent: "center",
37 | marginBottom: 20
38 | }
39 | });
40 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Oleg Veskelen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/reducers/monthesReducer.js:
--------------------------------------------------------------------------------
1 | import {
2 | ADD_MONTH,
3 | ADD_NEW_LINE_IN_BUDGET,
4 | REMOVE_MONTH_BUDGET_ITEM,
5 | REMOVE_MONTH
6 | } from "../actions/types";
7 |
8 | export default (state = [], action) => {
9 | switch (action.type) {
10 | case ADD_MONTH:
11 | return [...state, { id: action.id, date: action.date, budget: [] }];
12 | case ADD_NEW_LINE_IN_BUDGET:
13 | const updated = state.map(item => {
14 | if (action.id !== item.id) {
15 | return item;
16 | } else {
17 | const budget = item.budget || [];
18 | return {
19 | ...item,
20 | budget: [...budget, action.payload]
21 | };
22 | }
23 | });
24 | return updated;
25 | case REMOVE_MONTH_BUDGET_ITEM:
26 | return state.map(item => {
27 | if (item.id !== action.id) {
28 | return item;
29 | } else {
30 | return {
31 | ...item,
32 | budget: item.budget.filter(item => item.id !== action.itemId)
33 | };
34 | }
35 | });
36 | case REMOVE_MONTH:
37 | return state.filter(item => item.id !== action.id);
38 | default:
39 | return state;
40 | }
41 | };
42 |
--------------------------------------------------------------------------------
/App.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { StyleSheet, StatusBar } from "react-native";
3 | import { Provider } from "react-redux";
4 | import { TabNavigator, SafeAreaView } from "react-navigation";
5 | import store from "./store";
6 | import MonthList from "./screens/MonthList";
7 | import Month from "./screens/Month";
8 | import Form from "./screens/Form";
9 |
10 | export default class App extends React.PureComponent {
11 | render() {
12 | const MainNavigator = TabNavigator(
13 | {
14 | monthlist: { screen: MonthList },
15 | form: { screen: Form },
16 | month: { screen: Month }
17 | },
18 | {
19 | navigationOptions: {
20 | tabBarVisible: false
21 | },
22 | swipeEnabled: false,
23 | tabBarPosition: "bottom",
24 | lazy: true
25 | }
26 | );
27 | return (
28 |
29 |
30 |
31 |
32 |
33 | );
34 | }
35 | }
36 |
37 | const styles = StyleSheet.create({
38 | container: {
39 | flex: 1,
40 | paddingTop: StatusBar.currentHeight ? StatusBar.currentHeight : 0
41 | }
42 | });
43 |
--------------------------------------------------------------------------------
/components/Budjet.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { View, Text, StyleSheet } from "react-native";
3 | import PropTypes from "prop-types";
4 | import MonthItemRound from "../components/MonthItemRound";
5 |
6 | export default function Budjet({ month, removeItem }) {
7 | let incomes = [];
8 | let costs = [];
9 |
10 | month.budget.forEach(item => {
11 | if (item.or) {
12 | incomes.push(
13 |
19 | );
20 | } else {
21 | costs.push(
22 |
28 | );
29 | }
30 | });
31 |
32 | return (
33 |
34 | {incomes.length ? Incomes: : null}
35 | {incomes}
36 | {costs.length ? Costs: : null}
37 | {costs}
38 |
39 | );
40 | }
41 |
42 | Budjet.propTypes = {
43 | month: PropTypes.object,
44 | removeItem: PropTypes.func
45 | };
46 |
47 | const styles = StyleSheet.create({
48 | container: {
49 | marginBottom: 15
50 | },
51 | txt: {
52 | fontSize: 20,
53 | color: "#777",
54 | marginLeft: 50,
55 | fontWeight: "bold",
56 | marginBottom: 10
57 | }
58 | });
59 |
--------------------------------------------------------------------------------
/components/Switch.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import { View, Animated, StyleSheet } from "react-native";
3 | import { Icon } from "react-native-elements";
4 | import PropTypes from "prop-types";
5 |
6 | export default class Switch extends PureComponent {
7 | state = {
8 | switch: new Animated.ValueXY(0, 0)
9 | };
10 | onSwitch = () => {
11 | Animated.spring(this.state.switch, {
12 | toValue: {
13 | x: this.props.or ? 80 : 0,
14 | y: 0
15 | }
16 | }).start();
17 |
18 | this.props.change();
19 | };
20 | render() {
21 | return (
22 |
23 |
24 |
32 |
33 |
34 | );
35 | }
36 | }
37 |
38 | Switch.propTypes = {
39 | or: PropTypes.bool,
40 | change: PropTypes.func
41 | };
42 |
43 | const styles = StyleSheet.create({
44 | iconSwitch: {
45 | borderRadius: 50,
46 | height: 80,
47 | width: 80,
48 | backgroundColor: "#ff6666"
49 | },
50 | swithContainer: {
51 | borderRadius: 50,
52 | height: 80,
53 | width: 160,
54 | marginBottom: 20,
55 | backgroundColor: "#f1f1f1",
56 | overflow: "visible",
57 | marginRight: 10
58 | }
59 | });
60 |
--------------------------------------------------------------------------------
/components/MonthItemRound.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import { Icon } from "react-native-elements";
3 | import { View, Text, StyleSheet } from "react-native";
4 | import PropTypes from "prop-types";
5 | import { SCREEN_WIDTH } from "../constants";
6 |
7 | export default class MonthItemRound extends Component {
8 | render() {
9 | const icon = this.props.or ? "plus" : "minus";
10 | return (
11 |
12 |
19 |
20 | {this.props.text}
21 | {"$ " + this.props.$}
22 |
23 |
31 |
32 | );
33 | }
34 | }
35 |
36 | MonthItemRound.propTypes = {
37 | removeItem: PropTypes.func,
38 | monthId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
39 | id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
40 | text: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
41 | $: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
42 | or: PropTypes.bool
43 | };
44 |
45 | const styles = StyleSheet.create({
46 | iconLeft: {
47 | borderRadius: 50,
48 | width: 80
49 | },
50 | iconRight: {
51 | borderRadius: 50,
52 | height: 80,
53 | width: 80,
54 | backgroundColor: "#ff6666"
55 | },
56 | container: {
57 | width: SCREEN_WIDTH - 10,
58 | borderRadius: 50,
59 | backgroundColor: "#f1f1f1",
60 | flexDirection: "row",
61 | justifyContent: "space-between",
62 | height: 80,
63 | alignItems: "center",
64 | marginBottom: 10,
65 | marginLeft: 5
66 | },
67 | text: {
68 | fontSize: 20,
69 | color: "#555"
70 | },
71 | numbers: {
72 | fontSize: 16,
73 | color: "#555"
74 | }
75 | });
76 |
--------------------------------------------------------------------------------
/screens/MonthList.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import { connect } from "react-redux";
3 | import { ScrollView, View, Text } from "react-native";
4 | import PropTypes from "prop-types";
5 | import { addMonth, removeMonth } from "../actions/monthActions";
6 | import { counts } from "../utils";
7 | import ListItemRound from "../components/ListItemRound";
8 | import AddNewMonthBtn from "../components/AddNewMonthBtn";
9 | import Header from "../components/Header";
10 |
11 | class MonthList extends PureComponent {
12 | static navigationOptions = {
13 | tabBarLabel: "Home"
14 | };
15 |
16 | showList = item => {
17 | return () => this.props.navigation.navigate("month", { item });
18 | };
19 |
20 | addMore = item => {
21 | return () => this.props.navigation.navigate("form", { item });
22 | };
23 |
24 | removeMonth = id => {
25 | return () => {
26 | this.props.removeMonth(id);
27 | };
28 | };
29 |
30 | renderList = () => {
31 | if (!this.props.monthes.length) {
32 | return (
33 |
42 | Add month and your costs
43 |
44 | );
45 | }
46 | return this.props.monthes.map(item => {
47 | let countsItem = counts(item.budget);
48 | return (
49 |
57 | );
58 | });
59 | };
60 |
61 | render() {
62 | return (
63 |
64 |
65 |
66 | {this.renderList()}
67 |
68 |
69 |
70 | );
71 | }
72 | }
73 |
74 | MonthList.propTypes = {
75 | monthes: PropTypes.array,
76 | removeMonth: PropTypes.func,
77 | addMonth: PropTypes.func
78 | };
79 |
80 | const mapStateToProps = ({ monthes }) => ({
81 | monthes
82 | });
83 |
84 | export default connect(
85 | mapStateToProps,
86 | { addMonth, removeMonth }
87 | )(MonthList);
88 |
--------------------------------------------------------------------------------
/screens/Month.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import { View, ScrollView, Text, StyleSheet } from "react-native";
3 | import { connect } from "react-redux";
4 | import { Icon } from "react-native-elements";
5 | import PropTypes from "prop-types";
6 | import { removeMonthBudgetItem } from "../actions/monthActions";
7 | import Header from "../components/Header";
8 | import BackBtn from "../components/BackBtn";
9 | import Budjet from "../components/Budjet";
10 |
11 | class Month extends PureComponent {
12 | removeItem = (id, itemId) => {
13 | return () => {
14 | this.props.removeMonthBudgetItem(id, itemId);
15 | };
16 | };
17 |
18 | addMore = () => {
19 | const item = this.props.navigation.state.params.item;
20 | this.props.navigation.navigate("form", { item });
21 | };
22 |
23 | back = () => {
24 | this.props.navigation.navigate("monthlist");
25 | };
26 |
27 | renderBudget() {
28 | if (!this.props.navigation.state.params) {
29 | return There is no month u are loooking for!GTFO;
30 | }
31 | const month = this.props.monthes.find(
32 | item => item.id === this.props.navigation.state.params.item.id
33 | );
34 | if (!month) {
35 | return There is no month u are loooking for!GTFO;
36 | }
37 | return ;
38 | }
39 |
40 | render() {
41 | return (
42 |
43 |
44 | {this.renderBudget()}
45 |
46 |
47 |
55 |
56 |
57 | );
58 | }
59 | }
60 |
61 | const styles = StyleSheet.create({
62 | addMore: {
63 | borderRadius: 50,
64 | height: 80,
65 | width: 80,
66 | backgroundColor: "#ff6666",
67 | marginRight: 5,
68 | marginLeft: 10
69 | },
70 | buttonContainer: {
71 | flex: 1,
72 | flexDirection: "row",
73 | justifyContent: "flex-end",
74 | marginBottom: 25
75 | }
76 | });
77 |
78 | Month.propTypes = {
79 | monthes: PropTypes.array,
80 | removeMonthBudgetItem: PropTypes.func,
81 | navigation: PropTypes.object
82 | };
83 |
84 | const mapStateToProps = ({ monthes }) => ({
85 | monthes
86 | });
87 |
88 | export default connect(
89 | mapStateToProps,
90 | { removeMonthBudgetItem }
91 | )(Month);
92 |
--------------------------------------------------------------------------------
/components/MonthListItem.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import { Card, ListItem, Icon } from "react-native-elements";
3 | import { View, StyleSheet } from "react-native";
4 | import PropTypes from "prop-types";
5 |
6 | export default class MonthListItem extends PureComponent {
7 | render() {
8 | return (
9 |
10 |
15 |
22 |
29 |
36 |
37 |
44 |
51 |
58 |
59 |
60 |
61 | );
62 | }
63 | }
64 |
65 | MonthListItem.propTypes = {
66 | addMore: PropTypes.func,
67 | showList: PropTypes.func,
68 | remove: PropTypes.func
69 | };
70 |
71 | const styles = StyleSheet.create({
72 | iconsContainer: {
73 | marginTop: 15,
74 | flexDirection: "row",
75 | justifyContent: "center"
76 | },
77 | listItem: {
78 | fontSize: 18,
79 | color: "#777"
80 | },
81 | itemContainer: {
82 | borderBottomColor: "#fff"
83 | }
84 | });
85 |
--------------------------------------------------------------------------------
/screens/Form.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import { connect } from "react-redux";
3 | import { View, StyleSheet } from "react-native";
4 | import { Icon } from "react-native-elements";
5 | import PropTypes from "prop-types";
6 | import uuid from "uuid/v1";
7 | import { addNewLineinMonthBudget } from "../actions/monthActions";
8 | import BackBtn from "../components/BackBtn";
9 | import Switch from "../components/Switch";
10 | import FormInput from "../components/FormInput";
11 |
12 | class Form extends PureComponent {
13 | state = {
14 | text: "",
15 | $: "",
16 | or: true,
17 | warning: ""
18 | };
19 |
20 | onButtonPress = () => {
21 | if (!this.state.text || !this.state.$) {
22 | return this.setState({ warning: "Both fields are requered!" });
23 | }
24 | const payload = {
25 | id: uuid(),
26 | text: this.state.text,
27 | $: this.state.$,
28 | or: this.state.or
29 | };
30 | const id = this.props.navigation.state.params.item.id;
31 | this.props.addNewLineinMonthBudget(id, payload);
32 | this.setState({
33 | text: "",
34 | $: ""
35 | });
36 | };
37 |
38 | change = () => {
39 | this.setState({ or: !this.state.or });
40 | };
41 |
42 | isNumber = $ => {
43 | if (isNaN($)) {
44 | return this.setState({ warning: "This input accepts only numbers!" });
45 | }
46 | this.setState({
47 | $
48 | });
49 | };
50 |
51 | back = () => {
52 | const { item } = this.props.navigation.state.params;
53 | this.props.navigation.navigate("month", { item });
54 | };
55 |
56 | render() {
57 | return (
58 |
59 | this.setState({ text })}
62 | value={this.state.text}
63 | />
64 |
69 |
70 |
71 |
72 |
80 |
81 |
82 |
83 | );
84 | }
85 | }
86 |
87 | Form.propTypes = {
88 | navigation: PropTypes.object,
89 | addNewLineinMonthBudget: PropTypes.func
90 | };
91 |
92 | const styles = StyleSheet.create({
93 | container: {
94 | padding: 5,
95 | paddingTop: 20
96 | },
97 | iconSwitch: {
98 | borderRadius: 50,
99 | height: 80,
100 | width: 80,
101 | backgroundColor: "#ff6666"
102 | },
103 | buttonsRow: {
104 | flexDirection: "row"
105 | }
106 | });
107 |
108 | export default connect(
109 | null,
110 | { addNewLineinMonthBudget }
111 | )(Form);
112 |
--------------------------------------------------------------------------------
/components/AddNewMonthBtn.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import { Icon } from "react-native-elements";
3 | import uuid from "uuid/v1";
4 | import PropTypes from "prop-types";
5 | import { Animated, Text, TouchableOpacity, StyleSheet } from "react-native";
6 | import { SCREEN_HEIGHT, SCREEN_WIDTH, MONTHS, yyyy } from "../constants";
7 |
8 | export default class AddNewMonthBtn extends PureComponent {
9 | state = {
10 | width: new Animated.Value(70),
11 | height: new Animated.Value(75),
12 | opacity: new Animated.Value(0),
13 | visible: false
14 | };
15 |
16 | renderMonths = () => {
17 | return MONTHS.map(item => (
18 |
19 | {item.toUpperCase()}
20 |
21 | ));
22 | };
23 |
24 | add = item => {
25 | return () => {
26 | const id = uuid();
27 | const date = `${item}, ${yyyy}`;
28 | this.props.addNew(date, id);
29 | this.addMonth();
30 | };
31 | };
32 |
33 | addMonth = () => {
34 | const { visible } = this.state;
35 |
36 | Animated.sequence([
37 | Animated.spring(this.state.width, {
38 | toValue: visible ? 70 : SCREEN_WIDTH,
39 | duration: 300
40 | }),
41 | Animated.timing(this.state.height, {
42 | toValue: visible ? 75 : SCREEN_HEIGHT,
43 | duration: 200
44 | }),
45 | Animated.spring(this.state.opacity, {
46 | toValue: visible ? 0 : 1,
47 | duration: 100
48 | })
49 | ]).start();
50 |
51 | this.setState({ visible: !visible });
52 | };
53 |
54 | render() {
55 | return (
56 |
62 |
71 | {this.renderMonths()}
72 |
73 |
81 |
82 | );
83 | }
84 | }
85 |
86 | AddNewMonthBtn.propTypes = {
87 | addNew: PropTypes.func
88 | };
89 |
90 | const styles = StyleSheet.create({
91 | iconAddBtn: {
92 | zIndex: 102,
93 | position: "absolute",
94 | height: 75,
95 | width: 70,
96 | top: 0,
97 | right: 0,
98 | backgroundColor: "#ff6666"
99 | },
100 | menuMonths: {
101 | zIndex: 101,
102 | flex: 1,
103 | justifyContent: "center"
104 | },
105 | menuScale: {
106 | zIndex: 99,
107 | backgroundColor: "#ff6666",
108 | position: "absolute",
109 | top: 0,
110 | right: 0,
111 | height: 75,
112 | width: 70
113 | },
114 | text: {
115 | color: "#fff",
116 | fontSize: 18,
117 | fontWeight: "bold",
118 | marginBottom: 10,
119 | marginLeft: 30
120 | }
121 | });
122 |
--------------------------------------------------------------------------------
/components/ListItemRound.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import { Icon } from "react-native-elements";
3 | import { View, Text, Animated, StyleSheet } from "react-native";
4 | import PropTypes from "prop-types";
5 | import { SCREEN_WIDTH } from "../constants";
6 |
7 | class ListItemRound extends PureComponent {
8 | state = {
9 | fontLoaded: false,
10 | moved: false,
11 | scale: new Animated.Value(0)
12 | };
13 |
14 | componentWillMount() {
15 | this.position = new Animated.ValueXY(0, 0);
16 | }
17 |
18 | moveLeft = () => {
19 | const { moved } = this.state;
20 |
21 | Animated.spring(this.position, {
22 | toValue: {
23 | x: moved ? 0 : -180,
24 | y: 0
25 | }
26 | }).start();
27 |
28 | Animated.spring(this.state.scale, {
29 | toValue: moved ? 0 : 1,
30 | duration: 800
31 | }).start();
32 |
33 | this.setState({ moved: !moved });
34 | };
35 |
36 | render() {
37 | return (
38 |
39 |
40 |
48 |
49 |
50 |
51 | {this.props.date}
52 |
53 |
54 | {"Incomes: $" + this.props.incomes}
55 |
56 | {`Costs: $${
57 | this.props.costs
58 | }/${this.props.percent}%`}
59 |
60 |
61 |
69 |
70 |
71 |
79 |
80 |
81 |
89 |
90 |
91 | );
92 | }
93 | }
94 |
95 | ListItemRound.propTypes = {
96 | remove: PropTypes.func,
97 | showList: PropTypes.func,
98 | addMore: PropTypes.func,
99 | incomes: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
100 | const: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
101 | percent: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
102 | };
103 |
104 | const styles = StyleSheet.create({
105 | wrap: {
106 | flexDirection: "row",
107 | height: 80,
108 | marginTop: 10,
109 | marginBottom: 10,
110 | paddingLeft: 5
111 | },
112 | container: {
113 | width: SCREEN_WIDTH - 10,
114 | borderRadius: 50,
115 | backgroundColor: "#f1f1f1",
116 | flexDirection: "row",
117 | justifyContent: "space-between",
118 | position: "relative",
119 | height: 80
120 | },
121 | textContainer: {
122 | justifyContent: "center"
123 | },
124 | iconLeft: {
125 | borderRadius: 50,
126 | width: 80
127 | },
128 | iconRight: {
129 | borderRadius: 50,
130 | height: 80,
131 | width: 80,
132 | backgroundColor: "#ff6666"
133 | },
134 | iconBehind: {
135 | marginLeft: 10,
136 | borderRadius: 50,
137 | height: 80,
138 | width: 80,
139 | backgroundColor: "#ff6666"
140 | }
141 | });
142 |
143 | export default ListItemRound;
144 |
--------------------------------------------------------------------------------
/assets/fonts/OFL.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato"
2 |
3 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
4 | This license is copied below, and is also available with a FAQ at:
5 | http://scripts.sil.org/OFL
6 |
7 |
8 | -----------------------------------------------------------
9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10 | -----------------------------------------------------------
11 |
12 | PREAMBLE
13 | The goals of the Open Font License (OFL) are to stimulate worldwide
14 | development of collaborative font projects, to support the font creation
15 | efforts of academic and linguistic communities, and to provide a free and
16 | open framework in which fonts may be shared and improved in partnership
17 | with others.
18 |
19 | The OFL allows the licensed fonts to be used, studied, modified and
20 | redistributed freely as long as they are not sold by themselves. The
21 | fonts, including any derivative works, can be bundled, embedded,
22 | redistributed and/or sold with any software provided that any reserved
23 | names are not used by derivative works. The fonts and derivatives,
24 | however, cannot be released under any other type of license. The
25 | requirement for fonts to remain under this license does not apply
26 | to any document created using the fonts or their derivatives.
27 |
28 | DEFINITIONS
29 | "Font Software" refers to the set of files released by the Copyright
30 | Holder(s) under this license and clearly marked as such. This may
31 | include source files, build scripts and documentation.
32 |
33 | "Reserved Font Name" refers to any names specified as such after the
34 | copyright statement(s).
35 |
36 | "Original Version" refers to the collection of Font Software components as
37 | distributed by the Copyright Holder(s).
38 |
39 | "Modified Version" refers to any derivative made by adding to, deleting,
40 | or substituting -- in part or in whole -- any of the components of the
41 | Original Version, by changing formats or by porting the Font Software to a
42 | new environment.
43 |
44 | "Author" refers to any designer, engineer, programmer, technical
45 | writer or other person who contributed to the Font Software.
46 |
47 | PERMISSION & CONDITIONS
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
50 | redistribute, and sell modified and unmodified copies of the Font
51 | Software, subject to the following conditions:
52 |
53 | 1) Neither the Font Software nor any of its individual components,
54 | in Original or Modified Versions, may be sold by itself.
55 |
56 | 2) Original or Modified Versions of the Font Software may be bundled,
57 | redistributed and/or sold with any software, provided that each copy
58 | contains the above copyright notice and this license. These can be
59 | included either as stand-alone text files, human-readable headers or
60 | in the appropriate machine-readable metadata fields within text or
61 | binary files as long as those fields can be easily viewed by the user.
62 |
63 | 3) No Modified Version of the Font Software may use the Reserved Font
64 | Name(s) unless explicit written permission is granted by the corresponding
65 | Copyright Holder. This restriction only applies to the primary font name as
66 | presented to the users.
67 |
68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69 | Software shall not be used to promote, endorse or advertise any
70 | Modified Version, except to acknowledge the contribution(s) of the
71 | Copyright Holder(s) and the Author(s) or with their explicit written
72 | permission.
73 |
74 | 5) The Font Software, modified or unmodified, in part or in whole,
75 | must be distributed entirely under this license, and must not be
76 | distributed under any other license. The requirement for fonts to
77 | remain under this license does not apply to any document created
78 | using the Font Software.
79 |
80 | TERMINATION
81 | This license becomes null and void if any of the above conditions are
82 | not met.
83 |
84 | DISCLAIMER
85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93 | OTHER DEALINGS IN THE FONT SOFTWARE.
94 |
--------------------------------------------------------------------------------