Skip to content

Commit

Permalink
Merge branch 'patch' of github.com:gluestack/gluestack-ui into patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj authored and Suraj committed Jul 12, 2024
2 parents 89f546d + 7a68b0e commit a1c0f1e
Show file tree
Hide file tree
Showing 23 changed files with 366 additions and 279 deletions.
2 changes: 1 addition & 1 deletion example/storybook-nativewind/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const parameters = {
'Recipes',
['Linear Gradient'],
'More',
['FAQ', 'Releases', 'Roadmap', 'Troubleshooting'],
['FAQs', 'Releases', 'Roadmap', 'Troubleshooting'],
],
],
icons: [
Expand Down
2 changes: 1 addition & 1 deletion example/storybook-nativewind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@gluestack-style/animation-resolver": "^1.0.4",
"@gluestack-style/react": "^1.0.57",
"@gluestack-ui/config": "^1.1.19",
"@gluestack-ui/themed": "^1.1.34",
"@gluestack-ui/themed": "^1.1.35",
"@gluestack/design-system": "^0.5.36",
"@gorhom/bottom-sheet": "^5.0.0-alpha.10",
"@legendapp/motion": "^2.2.0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 39 additions & 24 deletions example/storybook-nativewind/src/components/Toast/Toast.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import { Icon, CloseIcon } from '@/components/ui/icon';
import { VStack } from '@/components/ui/vstack';
import { Pressable } from '@/components/ui/pressable';
Expand Down Expand Up @@ -26,31 +26,46 @@ const ToastFigmaStory = ({ _placement = 'top', _colorMode, ...props }: any) => {
);
};

const ToastBasic = ({ placement = 'top', ...props }: any) => {
const ToastBasic = ({ ...props }: any) => {
const toast = useToast();
const [toastId, setToastId] = useState<number>(0);

const handleToast = () => {
if (!toast.isActive(toastId)) {
showNewToast();
}
};

const showNewToast = () => {
const newId = Math.random();
setToastId(newId);

toast.show({
id: newId,
placement: props.placement,
duration: 3000,
// duration: null,
render: ({ id }) => {
const uniqueToastId = `toast-${id}`;
return (
<Toast nativeID={uniqueToastId} {...props} className="flex-row gap-3">
<VStack space="xs">
<ToastTitle>Hello World Toast</ToastTitle>
<ToastDescription>
Please create a support ticket from the support page
</ToastDescription>
</VStack>
<Pressable onPress={() => toast.close(id)}>
<Icon as={CloseIcon} className="stroke-background-200" />
</Pressable>
</Toast>
);
},
});
};

return (
<Button
onPress={() => {
toast.show({
placement: placement,
duration: 3000,
// duration: null,
render: ({ id }) => {
const toastId = `toast-${id}`;
return (
<>
<Toast nativeID={toastId} {...props}>
<ToastTitle>Toast Heading</ToastTitle>
<ToastDescription>
Lorem ipsum dolor sit amet consectetur.
</ToastDescription>
</Toast>
</>
);
},
});
}}
>
<Button onPress={handleToast}>
<ButtonText>Press Me</ButtonText>
</Button>
);
Expand Down
Loading

0 comments on commit a1c0f1e

Please sign in to comment.