我正在寻找创建一个抽屉,类似于抽屉导航器,但没有路线/导航要求。
我计划在那里放置一些更新查询的其他组件。有什么建议吗?具体来说,抽屉将用于显示选项列表、 slider 和日期范围组件,这些组件将更新用于更新在主页上显示的 map 上呈现的标记的状态和变量。
最佳答案
使用 Redux
您可以使用 contentComponent
的createDrawerNavigator创建您自己的自定义抽屉并将其绑定(bind)到 redux-store
.
通过发送 行动 通过相关查询,您可以在变量从商店传递到您的组件时更新它们。
没有 Redux
您可以创建 定制抽屉 具有相似动画的组件并将其呈现在您的组件中或使用此 react-native-drawer
.
import Drawer from 'react-native-drawer'
class Application extends Component {
closeControlPanel = () => {
this._drawer.close()
};
openControlPanel = () => {
this._drawer.open()
};
render () {
return (
<Drawer
ref={(ref) => this._drawer = ref}
content={<DrawerContentComponent {...// Your Updater props}/>}
>
<Component />
</Drawer>
)
}
})
关于react-native - 如何在没有导航的情况下创建抽屉菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52246782/