Selaa lähdekoodia

Primer intento de añadir redux. No funciona, tiene un bug. Ahora estoy creando y conectando el store desde App.js

ErnestoOrtiz2 3 vuotta sitten
vanhempi
commit
a613ce5011

+ 12
- 4
App.js Näytä tiedosto

@@ -3,17 +3,20 @@ import firebase from 'firebase'
3 3
 import { NavigationContainer } from '@react-navigation/native';
4 4
 import { createStackNavigator } from '@react-navigation/stack';
5 5
 
6
-import RegisterScreen from './screens/RegisterScreen';
7
-import LoginScreen from './screens/LoginScreen';
6
+import RegisterScreen from './screens/auth/RegisterScreen';
7
+import LoginScreen from './screens/auth/LoginScreen';
8 8
 import { firebaseConfig } from './config/firebaseConfig';
9 9
 import { Text, View } from 'react-native';
10 10
 import { styles } from './config/styles';
11 11
 
12
-import HomeScreen from './screens/Home_page';
12
+import HomeScreen from './screens/main/Home_page';
13 13
 import { Provider} from 'react-redux'
14 14
 import { createStore, applyMiddleware } from 'redux';
15 15
 import rootReducer from './redux/reducers'
16 16
 import thunk from 'redux-thunk'
17
+import { connect } from 'react-redux'
18
+import { bindActionCreators } from 'redux' 
19
+import { fetchUser } from './redux/actions/index'
17 20
 /*const seConfig = {
18 21
   apiKey: "AIzaSyDW-ABAQ3r_WR7C7WC_3VprL77NcAoitJI",
19 22
   authDomain: "freehand-d8ecd.firebaseapp.com",
@@ -85,7 +88,7 @@ export class App extends Component {
85 88
       <Provider store={store}>
86 89
         <NavigationContainer>
87 90
           <Stack.Navigator initialRouteName="Home">
88
-            <Stack.Screen name="HomeScreen" component={AddScreen} />
91
+            <Stack.Screen name="Home" component={HomeScreen} />
89 92
           </Stack.Navigator>
90 93
         </NavigationContainer>
91 94
       </Provider>
@@ -93,4 +96,9 @@ export class App extends Component {
93 96
   }
94 97
 }
95 98
 
99
+const mapStateToProps = (store) => ({
100
+  currentUser: store.userState.currentUser
101
+})
102
+const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch);
96 103
 
104
+export default connect(mapStateToProps, mapDispatchProps)(App);

+ 463
- 7
package-lock.json Näytä tiedosto

@@ -14,7 +14,11 @@
14 14
         "react": "16.13.1",
15 15
         "react-dom": "16.13.1",
16 16
         "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
17
-        "react-native-web": "~0.13.12"
17
+        "react-native-paper": "^4.9.2",
18
+        "react-native-web": "~0.13.12",
19
+        "react-redux": "^7.2.5",
20
+        "redux": "^4.1.1",
21
+        "redux-thunk": "^2.3.0"
18 22
       },
19 23
       "devDependencies": {
20 24
         "@babel/core": "^7.9.0"
@@ -3292,6 +3296,15 @@
3292 3296
       "integrity": "sha512-VbjwR1fhsn2h2KXAY4oy1fm7dCxaKy0D+deTb8Ilc3Eo3rc5+5eA4rfYmZaHgNJKxVyI0f6WIXzO2zLkVmQPHA==",
3293 3297
       "peer": true
3294 3298
     },
3299
+    "node_modules/@types/hoist-non-react-statics": {
3300
+      "version": "3.3.1",
3301
+      "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
3302
+      "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==",
3303
+      "dependencies": {
3304
+        "@types/react": "*",
3305
+        "hoist-non-react-statics": "^3.3.0"
3306
+      }
3307
+    },
3295 3308
     "node_modules/@types/istanbul-lib-coverage": {
3296 3309
       "version": "2.0.3",
3297 3310
       "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz",
@@ -3323,6 +3336,37 @@
3323 3336
       "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.6.tgz",
3324 3337
       "integrity": "sha512-YHUZhBOMTM3mjFkXVcK+WwAcYmyhe1wL4lfqNtzI0b3qAy7yuSetnM7QJazgE5PFmgVTNGiLOgRFfJMqW7XpSQ=="
3325 3338
     },
3339
+    "node_modules/@types/prop-types": {
3340
+      "version": "15.7.4",
3341
+      "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz",
3342
+      "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ=="
3343
+    },
3344
+    "node_modules/@types/react": {
3345
+      "version": "17.0.27",
3346
+      "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.27.tgz",
3347
+      "integrity": "sha512-zgiJwtsggVGtr53MndV7jfiUESTqrbxOcBvwfe6KS/9bzaVPCTDieTWnFNecVNx6EAaapg5xsLLWFfHHR437AA==",
3348
+      "dependencies": {
3349
+        "@types/prop-types": "*",
3350
+        "@types/scheduler": "*",
3351
+        "csstype": "^3.0.2"
3352
+      }
3353
+    },
3354
+    "node_modules/@types/react-redux": {
3355
+      "version": "7.1.19",
3356
+      "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.19.tgz",
3357
+      "integrity": "sha512-L37dSCT0aoJnCgpR8Iuginlbxoh7qhWOXiaDqEsxVMrER1CmVhFD+63NxgJeT4pkmEM28oX0NH4S4f+sXHTZjA==",
3358
+      "dependencies": {
3359
+        "@types/hoist-non-react-statics": "^3.3.0",
3360
+        "@types/react": "*",
3361
+        "hoist-non-react-statics": "^3.3.0",
3362
+        "redux": "^4.0.0"
3363
+      }
3364
+    },
3365
+    "node_modules/@types/scheduler": {
3366
+      "version": "0.16.2",
3367
+      "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
3368
+      "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
3369
+    },
3326 3370
     "node_modules/@types/stack-utils": {
3327 3371
       "version": "1.0.1",
3328 3372
       "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
@@ -4649,6 +4693,11 @@
4649 4693
         "isobject": "^3.0.1"
4650 4694
       }
4651 4695
     },
4696
+    "node_modules/csstype": {
4697
+      "version": "3.0.9",
4698
+      "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.9.tgz",
4699
+      "integrity": "sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw=="
4700
+    },
4652 4701
     "node_modules/dayjs": {
4653 4702
       "version": "1.10.7",
4654 4703
       "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz",
@@ -6152,7 +6201,6 @@
6152 6201
       "version": "3.3.2",
6153 6202
       "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
6154 6203
       "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
6155
-      "peer": true,
6156 6204
       "dependencies": {
6157 6205
         "react-is": "^16.7.0"
6158 6206
       }
@@ -6160,8 +6208,7 @@
6160 6208
     "node_modules/hoist-non-react-statics/node_modules/react-is": {
6161 6209
       "version": "16.13.1",
6162 6210
       "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
6163
-      "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
6164
-      "peer": true
6211
+      "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
6165 6212
     },
6166 6213
     "node_modules/http-errors": {
6167 6214
       "version": "1.7.3",
@@ -9248,6 +9295,41 @@
9248 9295
         "ua-parser-js": "^0.7.18"
9249 9296
       }
9250 9297
     },
9298
+    "node_modules/react-native-paper": {
9299
+      "version": "4.9.2",
9300
+      "resolved": "https://registry.npmjs.org/react-native-paper/-/react-native-paper-4.9.2.tgz",
9301
+      "integrity": "sha512-J7FRsd0YblQawtuj9I46F//apZHadsCKk6jWpc6njFTYdgUeCdkR8KgEto7cp2WxbcGNELx7KGwPQ4zAgX746A==",
9302
+      "dependencies": {
9303
+        "@callstack/react-theme-provider": "^3.0.6",
9304
+        "color": "^3.1.2",
9305
+        "react-native-iphone-x-helper": "^1.3.1"
9306
+      },
9307
+      "peerDependencies": {
9308
+        "react": "*",
9309
+        "react-native": "*",
9310
+        "react-native-vector-icons": "*"
9311
+      }
9312
+    },
9313
+    "node_modules/react-native-paper/node_modules/@callstack/react-theme-provider": {
9314
+      "version": "3.0.6",
9315
+      "resolved": "https://registry.npmjs.org/@callstack/react-theme-provider/-/react-theme-provider-3.0.6.tgz",
9316
+      "integrity": "sha512-wwKMXfmklfogpalNZT0W+jh76BIquiYUiQHOaPmt/PCyCEP/E6rP+e7Uie6mBZrfkea9WJYJ+mus6r+45JAEhg==",
9317
+      "dependencies": {
9318
+        "deepmerge": "^3.2.0",
9319
+        "hoist-non-react-statics": "^3.3.0"
9320
+      },
9321
+      "peerDependencies": {
9322
+        "react": "^16.3.0"
9323
+      }
9324
+    },
9325
+    "node_modules/react-native-paper/node_modules/react-native-iphone-x-helper": {
9326
+      "version": "1.3.1",
9327
+      "resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz",
9328
+      "integrity": "sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==",
9329
+      "peerDependencies": {
9330
+        "react-native": ">=0.42.0"
9331
+      }
9332
+    },
9251 9333
     "node_modules/react-native-safe-area-context": {
9252 9334
       "version": "3.3.2",
9253 9335
       "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-3.3.2.tgz",
@@ -9271,6 +9353,135 @@
9271 9353
         "react-native": "*"
9272 9354
       }
9273 9355
     },
9356
+    "node_modules/react-native-vector-icons": {
9357
+      "version": "8.1.0",
9358
+      "resolved": "https://registry.npmjs.org/react-native-vector-icons/-/react-native-vector-icons-8.1.0.tgz",
9359
+      "integrity": "sha512-sHIdBB6Y0dHaot2fMXgy5J/hhCn5YuyN7SKDNFgPzL8KA1oF2/v7mgYMavnK7LIIs2dJoGnDANKf61dsU+TZlg==",
9360
+      "peer": true,
9361
+      "dependencies": {
9362
+        "lodash.frompairs": "^4.0.1",
9363
+        "lodash.isequal": "^4.5.0",
9364
+        "lodash.isstring": "^4.0.1",
9365
+        "lodash.omit": "^4.5.0",
9366
+        "lodash.pick": "^4.4.0",
9367
+        "lodash.template": "^4.5.0",
9368
+        "prop-types": "^15.7.2",
9369
+        "yargs": "^16.1.1"
9370
+      },
9371
+      "bin": {
9372
+        "fa5-upgrade": "bin/fa5-upgrade.sh",
9373
+        "generate-icon": "bin/generate-icon.js"
9374
+      }
9375
+    },
9376
+    "node_modules/react-native-vector-icons/node_modules/ansi-styles": {
9377
+      "version": "4.3.0",
9378
+      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
9379
+      "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
9380
+      "peer": true,
9381
+      "dependencies": {
9382
+        "color-convert": "^2.0.1"
9383
+      },
9384
+      "engines": {
9385
+        "node": ">=8"
9386
+      },
9387
+      "funding": {
9388
+        "url": "https://github.com/chalk/ansi-styles?sponsor=1"
9389
+      }
9390
+    },
9391
+    "node_modules/react-native-vector-icons/node_modules/cliui": {
9392
+      "version": "7.0.4",
9393
+      "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
9394
+      "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
9395
+      "peer": true,
9396
+      "dependencies": {
9397
+        "string-width": "^4.2.0",
9398
+        "strip-ansi": "^6.0.0",
9399
+        "wrap-ansi": "^7.0.0"
9400
+      }
9401
+    },
9402
+    "node_modules/react-native-vector-icons/node_modules/color-convert": {
9403
+      "version": "2.0.1",
9404
+      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
9405
+      "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
9406
+      "peer": true,
9407
+      "dependencies": {
9408
+        "color-name": "~1.1.4"
9409
+      },
9410
+      "engines": {
9411
+        "node": ">=7.0.0"
9412
+      }
9413
+    },
9414
+    "node_modules/react-native-vector-icons/node_modules/color-name": {
9415
+      "version": "1.1.4",
9416
+      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
9417
+      "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
9418
+      "peer": true
9419
+    },
9420
+    "node_modules/react-native-vector-icons/node_modules/strip-ansi": {
9421
+      "version": "6.0.1",
9422
+      "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
9423
+      "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
9424
+      "peer": true,
9425
+      "dependencies": {
9426
+        "ansi-regex": "^5.0.1"
9427
+      },
9428
+      "engines": {
9429
+        "node": ">=8"
9430
+      }
9431
+    },
9432
+    "node_modules/react-native-vector-icons/node_modules/wrap-ansi": {
9433
+      "version": "7.0.0",
9434
+      "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
9435
+      "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
9436
+      "peer": true,
9437
+      "dependencies": {
9438
+        "ansi-styles": "^4.0.0",
9439
+        "string-width": "^4.1.0",
9440
+        "strip-ansi": "^6.0.0"
9441
+      },
9442
+      "engines": {
9443
+        "node": ">=10"
9444
+      },
9445
+      "funding": {
9446
+        "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
9447
+      }
9448
+    },
9449
+    "node_modules/react-native-vector-icons/node_modules/y18n": {
9450
+      "version": "5.0.8",
9451
+      "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
9452
+      "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
9453
+      "peer": true,
9454
+      "engines": {
9455
+        "node": ">=10"
9456
+      }
9457
+    },
9458
+    "node_modules/react-native-vector-icons/node_modules/yargs": {
9459
+      "version": "16.2.0",
9460
+      "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
9461
+      "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
9462
+      "peer": true,
9463
+      "dependencies": {
9464
+        "cliui": "^7.0.2",
9465
+        "escalade": "^3.1.1",
9466
+        "get-caller-file": "^2.0.5",
9467
+        "require-directory": "^2.1.1",
9468
+        "string-width": "^4.2.0",
9469
+        "y18n": "^5.0.5",
9470
+        "yargs-parser": "^20.2.2"
9471
+      },
9472
+      "engines": {
9473
+        "node": ">=10"
9474
+      }
9475
+    },
9476
+    "node_modules/react-native-vector-icons/node_modules/yargs-parser": {
9477
+      "version": "20.2.9",
9478
+      "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
9479
+      "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
9480
+      "peer": true,
9481
+      "engines": {
9482
+        "node": ">=10"
9483
+      }
9484
+    },
9274 9485
     "node_modules/react-native-web": {
9275 9486
       "version": "0.13.18",
9276 9487
       "resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.13.18.tgz",
@@ -9660,6 +9871,35 @@
9660 9871
         "node": ">= 4.0.0"
9661 9872
       }
9662 9873
     },
9874
+    "node_modules/react-redux": {
9875
+      "version": "7.2.5",
9876
+      "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.5.tgz",
9877
+      "integrity": "sha512-Dt29bNyBsbQaysp6s/dN0gUodcq+dVKKER8Qv82UrpeygwYeX1raTtil7O/fftw/rFqzaf6gJhDZRkkZnn6bjg==",
9878
+      "dependencies": {
9879
+        "@babel/runtime": "^7.12.1",
9880
+        "@types/react-redux": "^7.1.16",
9881
+        "hoist-non-react-statics": "^3.3.2",
9882
+        "loose-envify": "^1.4.0",
9883
+        "prop-types": "^15.7.2",
9884
+        "react-is": "^16.13.1"
9885
+      },
9886
+      "peerDependencies": {
9887
+        "react": "^16.8.3 || ^17"
9888
+      },
9889
+      "peerDependenciesMeta": {
9890
+        "react-dom": {
9891
+          "optional": true
9892
+        },
9893
+        "react-native": {
9894
+          "optional": true
9895
+        }
9896
+      }
9897
+    },
9898
+    "node_modules/react-redux/node_modules/react-is": {
9899
+      "version": "16.13.1",
9900
+      "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
9901
+      "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
9902
+    },
9663 9903
     "node_modules/react-refresh": {
9664 9904
       "version": "0.4.3",
9665 9905
       "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.4.3.tgz",
@@ -9687,6 +9927,19 @@
9687 9927
         "util-deprecate": "~1.0.1"
9688 9928
       }
9689 9929
     },
9930
+    "node_modules/redux": {
9931
+      "version": "4.1.1",
9932
+      "resolved": "https://registry.npmjs.org/redux/-/redux-4.1.1.tgz",
9933
+      "integrity": "sha512-hZQZdDEM25UY2P493kPYuKqviVwZ58lEmGQNeQ+gXa+U0gYPUBf7NKYazbe3m+bs/DzM/ahN12DbF+NG8i0CWw==",
9934
+      "dependencies": {
9935
+        "@babel/runtime": "^7.9.2"
9936
+      }
9937
+    },
9938
+    "node_modules/redux-thunk": {
9939
+      "version": "2.3.0",
9940
+      "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz",
9941
+      "integrity": "sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw=="
9942
+    },
9690 9943
     "node_modules/regenerate": {
9691 9944
       "version": "1.4.2",
9692 9945
       "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",
@@ -14090,6 +14343,15 @@
14090 14343
       "integrity": "sha512-VbjwR1fhsn2h2KXAY4oy1fm7dCxaKy0D+deTb8Ilc3Eo3rc5+5eA4rfYmZaHgNJKxVyI0f6WIXzO2zLkVmQPHA==",
14091 14344
       "peer": true
14092 14345
     },
14346
+    "@types/hoist-non-react-statics": {
14347
+      "version": "3.3.1",
14348
+      "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
14349
+      "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==",
14350
+      "requires": {
14351
+        "@types/react": "*",
14352
+        "hoist-non-react-statics": "^3.3.0"
14353
+      }
14354
+    },
14093 14355
     "@types/istanbul-lib-coverage": {
14094 14356
       "version": "2.0.3",
14095 14357
       "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz",
@@ -14121,6 +14383,37 @@
14121 14383
       "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.6.tgz",
14122 14384
       "integrity": "sha512-YHUZhBOMTM3mjFkXVcK+WwAcYmyhe1wL4lfqNtzI0b3qAy7yuSetnM7QJazgE5PFmgVTNGiLOgRFfJMqW7XpSQ=="
14123 14385
     },
14386
+    "@types/prop-types": {
14387
+      "version": "15.7.4",
14388
+      "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz",
14389
+      "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ=="
14390
+    },
14391
+    "@types/react": {
14392
+      "version": "17.0.27",
14393
+      "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.27.tgz",
14394
+      "integrity": "sha512-zgiJwtsggVGtr53MndV7jfiUESTqrbxOcBvwfe6KS/9bzaVPCTDieTWnFNecVNx6EAaapg5xsLLWFfHHR437AA==",
14395
+      "requires": {
14396
+        "@types/prop-types": "*",
14397
+        "@types/scheduler": "*",
14398
+        "csstype": "^3.0.2"
14399
+      }
14400
+    },
14401
+    "@types/react-redux": {
14402
+      "version": "7.1.19",
14403
+      "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.19.tgz",
14404
+      "integrity": "sha512-L37dSCT0aoJnCgpR8Iuginlbxoh7qhWOXiaDqEsxVMrER1CmVhFD+63NxgJeT4pkmEM28oX0NH4S4f+sXHTZjA==",
14405
+      "requires": {
14406
+        "@types/hoist-non-react-statics": "^3.3.0",
14407
+        "@types/react": "*",
14408
+        "hoist-non-react-statics": "^3.3.0",
14409
+        "redux": "^4.0.0"
14410
+      }
14411
+    },
14412
+    "@types/scheduler": {
14413
+      "version": "0.16.2",
14414
+      "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
14415
+      "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
14416
+    },
14124 14417
     "@types/stack-utils": {
14125 14418
       "version": "1.0.1",
14126 14419
       "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz",
@@ -15196,6 +15489,11 @@
15196 15489
         "isobject": "^3.0.1"
15197 15490
       }
15198 15491
     },
15492
+    "csstype": {
15493
+      "version": "3.0.9",
15494
+      "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.9.tgz",
15495
+      "integrity": "sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw=="
15496
+    },
15199 15497
     "dayjs": {
15200 15498
       "version": "1.10.7",
15201 15499
       "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz",
@@ -16419,7 +16717,6 @@
16419 16717
       "version": "3.3.2",
16420 16718
       "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
16421 16719
       "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
16422
-      "peer": true,
16423 16720
       "requires": {
16424 16721
         "react-is": "^16.7.0"
16425 16722
       },
@@ -16427,8 +16724,7 @@
16427 16724
         "react-is": {
16428 16725
           "version": "16.13.1",
16429 16726
           "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
16430
-          "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
16431
-          "peer": true
16727
+          "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
16432 16728
         }
16433 16729
       }
16434 16730
     },
@@ -19196,6 +19492,33 @@
19196 19492
         }
19197 19493
       }
19198 19494
     },
19495
+    "react-native-paper": {
19496
+      "version": "4.9.2",
19497
+      "resolved": "https://registry.npmjs.org/react-native-paper/-/react-native-paper-4.9.2.tgz",
19498
+      "integrity": "sha512-J7FRsd0YblQawtuj9I46F//apZHadsCKk6jWpc6njFTYdgUeCdkR8KgEto7cp2WxbcGNELx7KGwPQ4zAgX746A==",
19499
+      "requires": {
19500
+        "@callstack/react-theme-provider": "^3.0.6",
19501
+        "color": "^3.1.2",
19502
+        "react-native-iphone-x-helper": "^1.3.1"
19503
+      },
19504
+      "dependencies": {
19505
+        "@callstack/react-theme-provider": {
19506
+          "version": "3.0.6",
19507
+          "resolved": "https://registry.npmjs.org/@callstack/react-theme-provider/-/react-theme-provider-3.0.6.tgz",
19508
+          "integrity": "sha512-wwKMXfmklfogpalNZT0W+jh76BIquiYUiQHOaPmt/PCyCEP/E6rP+e7Uie6mBZrfkea9WJYJ+mus6r+45JAEhg==",
19509
+          "requires": {
19510
+            "deepmerge": "^3.2.0",
19511
+            "hoist-non-react-statics": "^3.3.0"
19512
+          }
19513
+        },
19514
+        "react-native-iphone-x-helper": {
19515
+          "version": "1.3.1",
19516
+          "resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz",
19517
+          "integrity": "sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==",
19518
+          "requires": {}
19519
+        }
19520
+      }
19521
+    },
19199 19522
     "react-native-safe-area-context": {
19200 19523
       "version": "3.3.2",
19201 19524
       "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-3.3.2.tgz",
@@ -19212,6 +19535,106 @@
19212 19535
         "warn-once": "^0.1.0"
19213 19536
       }
19214 19537
     },
19538
+    "react-native-vector-icons": {
19539
+      "version": "8.1.0",
19540
+      "resolved": "https://registry.npmjs.org/react-native-vector-icons/-/react-native-vector-icons-8.1.0.tgz",
19541
+      "integrity": "sha512-sHIdBB6Y0dHaot2fMXgy5J/hhCn5YuyN7SKDNFgPzL8KA1oF2/v7mgYMavnK7LIIs2dJoGnDANKf61dsU+TZlg==",
19542
+      "peer": true,
19543
+      "requires": {
19544
+        "lodash.frompairs": "^4.0.1",
19545
+        "lodash.isequal": "^4.5.0",
19546
+        "lodash.isstring": "^4.0.1",
19547
+        "lodash.omit": "^4.5.0",
19548
+        "lodash.pick": "^4.4.0",
19549
+        "lodash.template": "^4.5.0",
19550
+        "prop-types": "^15.7.2",
19551
+        "yargs": "^16.1.1"
19552
+      },
19553
+      "dependencies": {
19554
+        "ansi-styles": {
19555
+          "version": "4.3.0",
19556
+          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
19557
+          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
19558
+          "peer": true,
19559
+          "requires": {
19560
+            "color-convert": "^2.0.1"
19561
+          }
19562
+        },
19563
+        "cliui": {
19564
+          "version": "7.0.4",
19565
+          "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
19566
+          "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
19567
+          "peer": true,
19568
+          "requires": {
19569
+            "string-width": "^4.2.0",
19570
+            "strip-ansi": "^6.0.0",
19571
+            "wrap-ansi": "^7.0.0"
19572
+          }
19573
+        },
19574
+        "color-convert": {
19575
+          "version": "2.0.1",
19576
+          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
19577
+          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
19578
+          "peer": true,
19579
+          "requires": {
19580
+            "color-name": "~1.1.4"
19581
+          }
19582
+        },
19583
+        "color-name": {
19584
+          "version": "1.1.4",
19585
+          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
19586
+          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
19587
+          "peer": true
19588
+        },
19589
+        "strip-ansi": {
19590
+          "version": "6.0.1",
19591
+          "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
19592
+          "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
19593
+          "peer": true,
19594
+          "requires": {
19595
+            "ansi-regex": "^5.0.1"
19596
+          }
19597
+        },
19598
+        "wrap-ansi": {
19599
+          "version": "7.0.0",
19600
+          "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
19601
+          "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
19602
+          "peer": true,
19603
+          "requires": {
19604
+            "ansi-styles": "^4.0.0",
19605
+            "string-width": "^4.1.0",
19606
+            "strip-ansi": "^6.0.0"
19607
+          }
19608
+        },
19609
+        "y18n": {
19610
+          "version": "5.0.8",
19611
+          "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
19612
+          "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
19613
+          "peer": true
19614
+        },
19615
+        "yargs": {
19616
+          "version": "16.2.0",
19617
+          "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
19618
+          "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
19619
+          "peer": true,
19620
+          "requires": {
19621
+            "cliui": "^7.0.2",
19622
+            "escalade": "^3.1.1",
19623
+            "get-caller-file": "^2.0.5",
19624
+            "require-directory": "^2.1.1",
19625
+            "string-width": "^4.2.0",
19626
+            "y18n": "^5.0.5",
19627
+            "yargs-parser": "^20.2.2"
19628
+          }
19629
+        },
19630
+        "yargs-parser": {
19631
+          "version": "20.2.9",
19632
+          "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
19633
+          "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
19634
+          "peer": true
19635
+        }
19636
+      }
19637
+    },
19215 19638
     "react-native-web": {
19216 19639
       "version": "0.13.18",
19217 19640
       "resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.13.18.tgz",
@@ -19250,6 +19673,26 @@
19250 19673
         }
19251 19674
       }
19252 19675
     },
19676
+    "react-redux": {
19677
+      "version": "7.2.5",
19678
+      "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.5.tgz",
19679
+      "integrity": "sha512-Dt29bNyBsbQaysp6s/dN0gUodcq+dVKKER8Qv82UrpeygwYeX1raTtil7O/fftw/rFqzaf6gJhDZRkkZnn6bjg==",
19680
+      "requires": {
19681
+        "@babel/runtime": "^7.12.1",
19682
+        "@types/react-redux": "^7.1.16",
19683
+        "hoist-non-react-statics": "^3.3.2",
19684
+        "loose-envify": "^1.4.0",
19685
+        "prop-types": "^15.7.2",
19686
+        "react-is": "^16.13.1"
19687
+      },
19688
+      "dependencies": {
19689
+        "react-is": {
19690
+          "version": "16.13.1",
19691
+          "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
19692
+          "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
19693
+        }
19694
+      }
19695
+    },
19253 19696
     "react-refresh": {
19254 19697
       "version": "0.4.3",
19255 19698
       "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.4.3.tgz",
@@ -19274,6 +19717,19 @@
19274 19717
         "util-deprecate": "~1.0.1"
19275 19718
       }
19276 19719
     },
19720
+    "redux": {
19721
+      "version": "4.1.1",
19722
+      "resolved": "https://registry.npmjs.org/redux/-/redux-4.1.1.tgz",
19723
+      "integrity": "sha512-hZQZdDEM25UY2P493kPYuKqviVwZ58lEmGQNeQ+gXa+U0gYPUBf7NKYazbe3m+bs/DzM/ahN12DbF+NG8i0CWw==",
19724
+      "requires": {
19725
+        "@babel/runtime": "^7.9.2"
19726
+      }
19727
+    },
19728
+    "redux-thunk": {
19729
+      "version": "2.3.0",
19730
+      "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz",
19731
+      "integrity": "sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw=="
19732
+    },
19277 19733
     "regenerate": {
19278 19734
       "version": "1.4.2",
19279 19735
       "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz",

+ 5
- 1
package.json Näytä tiedosto

@@ -17,7 +17,11 @@
17 17
     "react": "16.13.1",
18 18
     "react-dom": "16.13.1",
19 19
     "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
20
-    "react-native-web": "~0.13.12"
20
+    "react-native-paper": "^4.9.2",
21
+    "react-native-web": "~0.13.12",
22
+    "react-redux": "^7.2.5",
23
+    "redux": "^4.1.1",
24
+    "redux-thunk": "^2.3.0"
21 25
   },
22 26
   "devDependencies": {
23 27
     "@babel/core": "^7.9.0"

+ 20
- 0
redux/actions/index.js Näytä tiedosto

@@ -0,0 +1,20 @@
1
+import { USER_STATE_CHANGE } from '../constants/index'
2
+import firebase from 'firebase'
3
+
4
+//Export to the app to trigger DB action
5
+export function fetchUser(){
6
+    return((dispatch) => {
7
+        firebase.firestore()
8
+        .collection("Users")
9
+        .doc(firebase.auth().currentUser.uid)
10
+        .get()
11
+        .then((snapshot) => {
12
+            if(snapshot.exists){
13
+                dispatch({type : USER_STATE_CHANGE, currentUser : snapshot.data()})
14
+            }
15
+            else{
16
+                console.log('Does not exist')
17
+            }
18
+        })
19
+    })
20
+}

+ 1
- 0
redux/constants/index.js Näytä tiedosto

@@ -0,0 +1 @@
1
+export const USER_STATE_CHANGE = 'USER_STATE_CHANGE'

+ 8
- 0
redux/reducers/index.js Näytä tiedosto

@@ -0,0 +1,8 @@
1
+import { combineReducers } from "redux"
2
+import { user } from './user'
3
+
4
+const Reducers = combineReducers({
5
+    userState: user
6
+})
7
+
8
+export default Reducers

+ 16
- 0
redux/reducers/user.js Näytä tiedosto

@@ -0,0 +1,16 @@
1
+const initialState = {
2
+    currentUser: null
3
+}
4
+
5
+//Action -an object describing what happened.
6
+//Reducers -calculate the new state based on the old state and the action
7
+//The state is equal to the initial state if no state is passed along to this f (an action is passed along the initial state)
8
+//Remember, our actions will be calling the DB, fetching data, and sending it to our reducer (this f)
9
+//which will then update the state. (Esto va a devolver al user con sus estado, nuevo o igual)
10
+//Esto esta setea'o para recivir info de otros files
11
+export const user = (state = initialState, action) => {
12
+    return {
13
+        ... state,
14
+        currentUser: action.currentUser
15
+    }
16
+}

+ 0
- 0
redux/store/index.js Näytä tiedosto


+ 4
- 4
screens/auth/LoginScreen.js Näytä tiedosto

@@ -2,8 +2,8 @@ import React, { Component } from "react";
2 2
 import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground, Image } from "react-native";
3 3
 import firebase from "firebase";
4 4
 
5
-import { styles } from "../config/styles";
6
-import CustomButton from "../components/CustomButton";
5
+import { styles } from "../../config/styles";
6
+import CustomButton from "../../components/CustomButton";
7 7
 
8 8
 
9 9
 export default class LoginScreen extends Component {
@@ -25,8 +25,8 @@ export default class LoginScreen extends Component {
25 25
         
26 26
         return (
27 27
             <TouchableWithoutFeedback style={styles.stdcontainer} onPress={Keyboard.dismiss} accessible={false}>
28
-                <ImageBackground style={styles.stdcontainer} source={require('../assets/yellow-white.jpg')}>
29
-                    <Image style={styles.logo} resizeMode="contain" source={require("../assets/open-hand.png")}/>
28
+                <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
29
+                    <Image style={styles.logo} resizeMode="contain" source={require("../../assets/open-hand.png")}/>
30 30
                     <TextInput style={styles.regtxtfield} placeholder="Email" onChangeText={(email) => this.setState({ email })}/>
31 31
                     <TextInput style={styles.regtxtfield} placeholder="Password" onChangeText={(password) => this.setState({ password })} secureTextEntry={ true }/>
32 32
                     <CustomButton marginTop={70} title="Login" onPress={() => this.onLogin()}/>

+ 3
- 3
screens/auth/RegisterScreen.js Näytä tiedosto

@@ -3,8 +3,8 @@ import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground, Text, V
3 3
 import firebase from "firebase";
4 4
 import { Picker } from "@react-native-picker/picker";
5 5
 
6
-import { styles } from "../config/styles";
7
-import CustomButton from "../components/CustomButton";
6
+import { styles } from "../../config/styles";
7
+import CustomButton from "../../components/CustomButton";
8 8
 
9 9
 export default class RegisterScreen extends Component {
10 10
     constructor(props) {
@@ -39,7 +39,7 @@ export default class RegisterScreen extends Component {
39 39
     render() {
40 40
         return (
41 41
             <TouchableWithoutFeedback style={styles.regcontainer} onPress={Keyboard.dismiss} accessible={false}>
42
-                <ImageBackground style={styles.regcontainer} source={require('../assets/yellow-white.jpg')}>
42
+                <ImageBackground style={styles.regcontainer} source={require('../../assets/yellow-white.jpg')}>
43 43
                     <TextInput style={styles.regtxtfield} placeholder="Userame" onChangeText={(username) => this.setState({ username })}/>
44 44
                     <TextInput style={styles.regtxtfield} placeholder="Email" onChangeText={(email) => this.setState({ email })}/>
45 45
                     <TextInput style={styles.regtxtfield} placeholder="Password" onChangeText={(password) => this.setState({ password })} secureTextEntry={ true }/>

+ 2
- 2
screens/main/Home_page.js Näytä tiedosto

@@ -6,7 +6,7 @@ import {TouchableOpacity} from 'react-native-gesture-handler'
6 6
 import {List, Divider} from 'react-native-paper'
7 7
 import Loading from './Loading'
8 8
 import firebase from 'firebase';
9
-import { styles } from "../config/styles";
9
+import { styles } from "../../config/styles";
10 10
 import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground} from "react-native";
11 11
 
12 12
 export default function Home_page({navigation}) {
@@ -45,7 +45,7 @@ export default function Home_page({navigation}) {
45 45
   
46 46
   return (
47 47
     <View>
48
-    <ImageBackground style={styles.stdcontainer} source={require('../assets/yellow-white.jpg')}>
48
+    <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
49 49
         <FlatList
50 50
           data={threads}
51 51
           keyExtractor = {item => item._id}