Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions example/storybook-nativewind/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ToastProvider } from '@gluestack-ui/toast';

import { GluestackUIProvider as GluestackUIWithNativewindProvider } from '../src/core-components/nativewind/gluestack-ui-provider';
import { GestureHandlerRootView } from 'react-native-gesture-handler';

import { BottomSheetModalProvider } from '../src/core-components/nativewind/bottomsheet';
// global css getting resolved from babel.config.js
import 'global.css';

Expand Down Expand Up @@ -155,27 +155,29 @@ export const decorators = [

return (
<GluestackUIWithGluestackStyleProvider colorMode={getColorMode()}>
<GestureHandlerRootView
style={{ flex: 1, display: 'flex', height: '100vh' }}
>
<GluestackUIWithNativewindProvider mode={getColorMode()}>
<OverlayProvider style={{ flex: 1, display: 'flex' }}>
<ToastProvider>
<View
style={{
flex: 1,
display: 'flex',
width: '100%',
justifyContent: 'center',
alignItems: 'center',
}}
>
<Story />
</View>
</ToastProvider>
</OverlayProvider>
</GluestackUIWithNativewindProvider>
</GestureHandlerRootView>
<GluestackUIWithNativewindProvider mode={getColorMode()}>
<GestureHandlerRootView
style={{ flex: 1, display: 'flex', height: '100vh' }}
>
<BottomSheetModalProvider>
<OverlayProvider style={{ flex: 1, display: 'flex' }}>
<ToastProvider>
<View
style={{
flex: 1,
display: 'flex',
width: '100%',
justifyContent: 'center',
alignItems: 'center',
}}
>
<Story />
</View>
</ToastProvider>
</OverlayProvider>
</BottomSheetModalProvider>
</GestureHandlerRootView>
</GluestackUIWithNativewindProvider>
</GluestackUIWithGluestackStyleProvider>
);
},
Expand All @@ -191,9 +193,11 @@ addParameters({
<GluestackUIWithNativewindProvider>
<DocsContainer context={context}>
<GestureHandlerRootView style={{ flex: 1 }}>
<OverlayProvider style={{ flex: 1 }}>
<ToastProvider>{children}</ToastProvider>
</OverlayProvider>
<BottomSheetModalProvider>
<OverlayProvider style={{ flex: 1 }}>
<ToastProvider>{children}</ToastProvider>
</OverlayProvider>
</BottomSheetModalProvider>
</GestureHandlerRootView>
</DocsContainer>
</GluestackUIWithNativewindProvider>
Expand Down
1 change: 1 addition & 0 deletions example/storybook-nativewind/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ module.exports = function (api) {
},
],
'@babel/plugin-transform-modules-commonjs',
'@babel/plugin-transform-export-namespace-from',
'react-native-reanimated/plugin',
],
};
Expand Down
4 changes: 2 additions & 2 deletions example/storybook-nativewind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@gluestack-ui/config": "^1.1.19",
"@gluestack-ui/themed": "^1.1.43",
"@gluestack/design-system": "^0.5.36",
"@gorhom/bottom-sheet": "^5.0.0-alpha.10",
"@gorhom/bottom-sheet": "^5.0.0-alpha.11",
"@legendapp/motion": "^2.2.0",
"@react-aria/button": "^3.7.0",
"@react-aria/focus": "^3.11.0",
Expand Down Expand Up @@ -63,7 +63,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "0.72.4",
"react-native-gesture-handler": "~2.14.0",
"react-native-gesture-handler": "^2.16.1",
"react-native-reanimated": "~3.6.2",
"react-native-safe-area-context": "^4.4.1",
"react-native-svg": "13.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ import {
BottomSheetDragIndicator,
BottomSheetItem,
BottomSheetItemText,
BottomSheetPortal,
BottomSheetTrigger,
} from '@/components/ui/bottomsheet';
import { Text } from '@/components/ui/text';

const BottomSheetBasic = ({
text = 'Open Action Sheet',
_colorMode,
...props
}: any) => {
import { Button, ButtonText } from '@/components/ui/button';
const BottomSheetBasic = ({ ...props }: any) => {
const [isOpen, setIsOpen] = React.useState(false);
return (
<BottomSheet {...props}>
<BottomSheetTrigger>
<Text>{text}</Text>
</BottomSheetTrigger>
<BottomSheetPortal
snapPoints={['25%', '50%']}
<>
<Button onPress={() => setIsOpen(true)}>
<ButtonText>Open Bottom Sheet</ButtonText>
</Button>
<BottomSheet
snapPoints={['25%', '90%']}
isOpen={isOpen}
index={0}
enableDynamicSizing={false}
onClose={() => {
setIsOpen(false);
}}
backdropComponent={BottomSheetBackdrop}
handleComponent={BottomSheetDragIndicator}
{...props}
>
<BottomSheetContent>
<BottomSheetItem>
Expand All @@ -37,8 +38,8 @@ const BottomSheetBasic = ({
<BottomSheetItemText>Item 3</BottomSheetItemText>
</BottomSheetItem>
</BottomSheetContent>
</BottomSheetPortal>
</BottomSheet>
</BottomSheet>
</>
);
};

Expand Down
Loading
Loading