BackAndroid.addEventListener('hardwareBackPress', this.back); 浏览大图的时候监听不了这个
这个插件不会干扰监听物理键的,它只会截断作用范围内UI的手势
是我的问题
是什么问题呢?我也遇到了
什么原因?
我的安卓点击虚拟返回键没有效果
@yuanji123 你是怎么解决的?
如果是跟例子一样用Modal包着ImageView,给onRequestClose传一个函数控制visible属性就行了
@tosslee your solution is perfect. I'll just translate it.
如果是跟例子一样用Modal包着ImageView,给onRequestClose传一个函数控制visible属性就行了
Translation: If you're using a <Modal> just pass it onRequestClose props with your control state boolean toggle function.
Example:
//render
<Modal visible={this.state.isFullscreen} transparent={true}
onRequestClose={() => { this.toggleFullscreen(false) }}>{...}</Modal>
toggleFullscreen = (val) => {
this.setState((prevState) => ({
isFullscreen: val
}))
}
Most helpful comment
@tosslee your solution is perfect. I'll just translate it.
Translation: If you're using a
<Modal>just pass itonRequestCloseprops with your control state boolean toggle function.Example: