我使用 react-native-video 为我的应用渲染视频播放器。
我尝试更改视频的来源。这是我的代码运行良好。
<Video
source={{uri: _getVideo().video_url}}
style={Styles.backgroundVideo}
autoplay={true}
controls={false}
disableFocus={true}
resizeMode="cover"
/>;
Run Code Online (Sandbox Code Playgroud)
但我改变了'controls={true}'。它不渲染新视频,只渲染音频。并且仍然显示旧视频。
_getVideo().video_url
Run Code Online (Sandbox Code Playgroud)
这个函数只是返回源视频。我确定元素也会更改源,但不会重新渲染新视频。
有没有办法解决它?
我是 Next JS 的新手。
我使用Next JS和Redux。
我有一个简短的代码如下:
const AdminContainer = (props) => {
return (
<AdminMasterView>
<DashboardView studentList={props.studentListServer}/>
</AdminMasterView>
)
}
export const getStaticProps = (async () => {
let response = await db.getInstance().query('SELECT * FROM student_register;');
return {
props: {
studentListServer: response
}, // will be passed to the page component as props
}
})
const mapStateToProps = state => ({
studentList: state.studentInfoReducers.studentList
});
const mapDispatchToProps = {
getStudentRegisterAction
};
export default connect(mapStateToProps, mapDispatchToProps)(AdminContainer); …Run Code Online (Sandbox Code Playgroud)