react-native - React Native 中的底页覆盖 UI 元素
问题描述
在 iOS 的某些应用程序中,我遇到了一种视图类型,即overlay another view
, 和come from bottom of the screen
. 当覆盖视图出现时,后面的视图被最小化。例如:
我想在其中实现这个 UI 元素,react-native
但找不到好的解决方案。到目前为止,我所取得的成就是bottom-sheet
.
那么问题是这种类型的 UI 元素可以使用 react-native 来实现吗?如果是,您能否提供一些建议/库来实现这一目标?
解决方案
实际上,这不是覆盖视图,它是 iOS 上的本机模式屏幕。此功能由导航库提供。如果您使用的是 wix/react-native-navigation,则可以使用 Navigation.openModal() 函数打开这种模式,如果您使用的是 react-navigation,则需要使用 react-native-screens 来获得原生外观模态并使用某些配置将组件注册为模态组件。例如:
<NativeStack.Screen
name="Third"
component={Second}
options={{
title: 'MODAL',
stackPresentation: 'fullScreenModal',
headerBackTitle: 'back',
headerCenter: () => <Text>MODAL!!</Text>,
headerHideBackButton: false,
headerLeft: () => <Button title="Button" />,
headerLargeTitle: true,
headerShown: true,
headerRight: () => <Button title="Back" onPress={() => null} />,
}}
/>
推荐阅读
- visual-studio-code - 进程失败:spawn C:\WINDOWS\system32\cmd.exe ENOENT Jest 进程“watch-tests”以 wsl 2 和 jest 扩展名意外结束
- flutter - 如何使用 Flutter 语义?
- r - 使用 Rtweet 页面时出现错误代码:当我尝试将 Jason 文件从 Twitter 加载到 R studio 时权限被拒绝
- spring-cloud - 我们可以在同一个 SpringBootApplication 上配置 spring 云网关和服务发现(eureka 服务器)吗
- sql - 在连接字符串上设置 JPA 查询参数
- c# - 如何使用 VSCode 分析和测量代码性能?
- r - 将 PDF 文件导入 R 并组织数据
- cordova - 离子应用程序图标未出现在任务/应用程序视图中
- python - Amazon S3 下载文件方法返回空文件
- clickhouse - 从 *MergeTree 系列的分布式表中进行 SELECT 时,最后插入的数据是否可用?