简体   繁体   中英

Props not being passed into component when using react-native-router-flux with react-redux?

I've run into an issue where after issuing an action via Redux, the store updates just fine (verified with redux-logger) but the connected component's props do not seem to update.

Components (tapping the login button is supposed to bring up the loading screen): https://github.com/OC-Hackers/Volunteer-App-Native/blob/master/src/react/login.js https://github.com/OC-Hackers/Volunteer-App-Native/blob/master/src/react/loading.js

Reducer: Navigate to src/redux/reducers/session.js and you'll find it.

Action generator: Navigate to src/redux/actions/session.js and you'll find it, I can't post more than 2 links without more rep.

The loading dialog will only display if this.props.success.show is true, but despite redux-logger showing that it's set to true, the dialog never shows. I've looked through my mapStateToProps method and it looks almost exactly like the example one in the Redux tutorial, and I've verified that the component is actually connected. Where am I screwing up?

Your Loading component's mapState function looks wrong. You're returning state.success and state.fetching , but you're defining those fields inside of your sessionReducer . It looks like you need to return state.session.success and state.session.fetching instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM