我尝试创建react原生应用程序,看起来像现有的web应用程序。我在窗口底部有一个固定的页脚。有没有人知道如何使用react native来实现这一点?
在现有的应用程序中,这很简单:
.footer {
position: fixed;
bottom: 0;
}
发布于 2016-01-13 07:05:04
我在我的应用程序中对按钮使用了固定的页脚。我实现固定脚注的方式如下所示:
my text
My fixed footer
如果需要在键盘出现时将页脚上移,例如,您可以使用:
const { DeviceEventEmitter } = React
class MyClass {
constructor() {
this.state = {
btnLocation: 0
}
}
componentWillMount() {
DeviceEventEmitter.addListener('keyboardWillShow', this.keyboardWillShow.bind(this))
DeviceEventEmitter.addListener('keyboardWillHide', this.keyboardWillHide.bind(this))
}
keyboardWillShow(e) {
this.setState({btnLocation: e.endCoordinates.height})
}
keyboardWillHide(e) {
this.setState({btnLocation: 0})
}
}
然后在固定脚注类中使用{bottom: this.state.btnLocation}。我希望这能有所帮助!
https://stackoverflow.com/questions/29447715
复制相似问题