@gluestack-ui/actionsheet
Actionsheet 组件向用户提供一组选项,在应用程序内容上覆盖,让他们可以在不离开当前页面或视图的情况下快速行动.
安装
要安装组件,请在终端中运行以下命令。 这将添加到您的项目的依赖性中, 并允许您在您的项目中使用它 .
npx install @gluestack-ui/actionsheet
使用量
所有这些组件的默认样式可以在组件/核心/动作表文件中找到. 作为参考,你可以查看 源代码 样式的“动作表”组件.
// import the styles
import {
Root,
Content,
Item,
ItemText,
DragIndicator,
IndicatorWrapper,
Backdrop,
} from '../components/core/actionsheet/styled-components';
// import the createActionsheet function
import { createActionsheet } from '@gluestack-ui/actionsheet';
// Understanding the API
const Actionsheet = createActionsheet({
Root,
Content,
Item,
ItemText,
DragIndicator,
IndicatorWrapper,
Backdrop,
});
// Using the actionsheet component
export default () => (
<Actionsheet isOpen={showActionsheet} onClose={handleClose}>
<ActionsheetBackdrop />
<ActionsheetContent>
<ActionsheetDragIndicatorWrapper>
<ActionsheetDragIndicator />
</ActionsheetDragIndicatorWrapper>
<ActionsheetItem onPress={handleClose}>
<ActionsheetItemText>Community</ActionsheetItemText>
</ActionsheetItem>
</ActionsheetContent>
</Actionsheet>
);
更多关于如何启动的指南 这里。 。 。 .