小编Trí*_*Lâm的帖子

更改源时,React-native-video 不会更改视频

我使用 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)

这个函数只是返回源视频。我确定元素也会更改源,但不会重新渲染新视频。

有没有办法解决它?

controls react-native react-native-video

3
推荐指数
1
解决办法
1465
查看次数

如何在 Next JS 中共享 redux state 客户端和 props 服务器端

我是 Next JS 的新手

我使用Next JSRedux

我有一个简短的代码如下:

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)

reactjs react-redux next.js

0
推荐指数
1
解决办法
5622
查看次数