Quellcode durchsuchen

Compila sin errores. La navegación va de register a home, y redux está implementado. El registro aparece en la DB.

ErnestoOrtiz2 vor 3 Jahren
Ursprung
Commit
ea9bb69c47
2 geänderte Dateien mit 16 neuen und 5 gelöschten Zeilen
  1. 5
    4
      App.js
  2. 11
    1
      screens/main/Home_page.js

+ 5
- 4
App.js Datei anzeigen

@@ -14,9 +14,9 @@ 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'
17
+/*import { connect } from 'react-redux'
18 18
 import { bindActionCreators } from 'redux' 
19
-import { fetchUser } from './redux/actions/index'
19
+import { fetchUser } from './redux/actions/index'*/
20 20
 /*const seConfig = {
21 21
   apiKey: "AIzaSyDW-ABAQ3r_WR7C7WC_3VprL77NcAoitJI",
22 22
   authDomain: "freehand-d8ecd.firebaseapp.com",
@@ -96,9 +96,10 @@ export class App extends Component {
96 96
   }
97 97
 }
98 98
 
99
-const mapStateToProps = (store) => ({
99
+export default App
100
+/*const mapStateToProps = (store) => ({
100 101
   currentUser: store.userState.currentUser
101 102
 })
102 103
 const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch);
103 104
 
104
-export default connect(mapStateToProps, mapDispatchProps)(App);
105
+export default connect(mapStateToProps, mapDispatchProps)(App);*/

+ 11
- 1
screens/main/Home_page.js Datei anzeigen

@@ -9,7 +9,12 @@ import firebase from 'firebase';
9 9
 import { styles } from "../../config/styles";
10 10
 import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground} from "react-native";
11 11
 
12
-export default function Home_page({navigation}) {
12
+
13
+import { connect } from 'react-redux'
14
+import { bindActionCreators } from 'redux' 
15
+import { fetchUser } from '../../redux/actions/index'
16
+
17
+export function Home_page({navigation}) {
13 18
   const [threads, setThreads] = useState([]);  
14 19
   const [loading, setLoading] = useState(true);
15 20
 
@@ -82,7 +87,12 @@ export default function Home_page({navigation}) {
82 87
     );
83 88
   }
84 89
 
90
+const mapStateToProps = (store) => ({
91
+  currentUser: store.userState.currentUser
92
+})
93
+const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch);
85 94
 
95
+export default connect(mapStateToProps, mapDispatchProps)(Home_page);
86 96
 
87 97
 
88 98