React native React Redux Thunk:操作不返回调度

React native React Redux Thunk:操作不返回调度,react-native,react-redux,redux-thunk,dispatch,React Native,React Redux,Redux Thunk,Dispatch,我正在使用React Native和Redux thunk中间件。 我的问题是分派函数不返回对象,甚至不返回控制台 这是我的操作文件: function movieSelc(movie) { return { type: types.MOVIE_SELECT, selectedMovie: movie }; } export function selectMovie(m) { console.log("this c

我正在使用React Native和Redux thunk中间件。 我的问题是分派函数不返回对象,甚至不返回控制台

这是我的操作文件:

function movieSelc(movie) {
    return {
            type: types.MOVIE_SELECT,
            selectedMovie: movie
        };
}

export function selectMovie(m) {
    console.log("this console works!")
  return (dispatch) => {
    console.log("this console never works")
    dispatch(movieSelc(m));
  };
}
这是组件(我在这里不包括const styles,以使其略短一些):

import React,{Component}来自'React';
从“react native”导入{文本、视图、TouchableOpacity、图像,};
从'react redux'导入{connect};
从“道具类型”导入道具类型;
从“redux”导入{bindActionCreators};
将*作为操作从“/../actions”导入;
类ListItem扩展组件{
render(){
const{movie}=this.props;
返回(
{
movie&&movie.map((项目,索引)=>
{actions.selectMovie(项目);}
>
{item.title}
{项目概述}
发布日期:{item.Release_date}
评分:{item.vote_average}
)
}
);
}
}
ListItem.propTypes={
操作:需要PropTypes.object.isRequired,
电影:PropTypes.object.isRequired,
};
函数MapStateTops(状态){
const{movies}=状态;
返回{
电影,,
};
}
功能图DispatchToprops(调度){
返回{
操作:bindActionCreators(操作、调度)
};
}
导出默认连接(
MapStateTops,
mapDispatchToProps
)(清单项目);

如果我需要提供更多信息,请告诉我。谢谢大家!

您正在调用selectMovie action而不是分派它。通过bindActionToProps方法,react-redux为您提供了一种通过道具分派操作的方法,因此正确的代码应该是:

<TouchableOpacity 
style={{ backgroundColor: 'gray' }}
onPress={() => { this.props.actions.selectMovie(item)); }}>
{this.props.actions.selectMovie(项目));}>
<TouchableOpacity 
style={{ backgroundColor: 'gray' }}
onPress={() => { this.props.actions.selectMovie(item)); }}>