Skip to content

Commit

Permalink
Merge pull request #1658 from gluestack/release/@gluestack-ui/themed@…
Browse files Browse the repository at this point in the history
…1.0.37

Release/@gluestack UI/themed@1.0.37
  • Loading branch information
surajahmed authored Jan 17, 2024
2 parents 0bfc641 + dfe92eb commit d39a277
Show file tree
Hide file tree
Showing 33 changed files with 11,075 additions and 61 deletions.
10,036 changes: 10,036 additions & 0 deletions example/next/yarn.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion example/storybook/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
// use: ['style-loader', 'css-loader', 'sass-loader'],
// include: path.resolve(__dirname, '../'),
// });

config.resolve.extensions.push('.mjs');
config.module.rules.push({
test: /\.(js|ts|tsx)$/,
// include: [path.resolve('../../', 'node_modules/@gluestack-style/react')],
Expand Down Expand Up @@ -62,6 +62,10 @@ module.exports = {
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
});

// Return the altered config
Expand Down
136 changes: 136 additions & 0 deletions example/storybook/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,142 @@ module.exports = function (api) {
__dirname,
'../../packages/unstyled/accordion/src'
),
'@gluestack-ui/popover': path.join(
__dirname,
'../../packages/unstyled/popover/src'
),
'@gluestack-ui/actionsheet': path.join(
__dirname,
'../../packages/unstyled/actionsheet/src'
),
'@gluestack-ui/select': path.join(
__dirname,
'../../packages/unstyled/select/src'
),
'@gluestack-ui/alert': path.join(
__dirname,
'../../packages/unstyled/alert/src'
),
'@gluestack-ui/alert-dialog': path.join(
__dirname,
'../../packages/unstyled/alert-dialog/src'
),
'@gluestack-ui/avatar': path.join(
__dirname,
'../../packages/unstyled/avatar/src'
),
'@gluestack-ui/button': path.join(
__dirname,
'../../packages/unstyled/button/src'
),
'@gluestack-ui/checkbox': path.join(
__dirname,
'../../packages/unstyled/checkbox/src'
),
'@gluestack-ui/divider': path.join(
__dirname,
'../../packages/unstyled/divider/src'
),
'@gluestack-ui/fab': path.join(
__dirname,
'../../packages/unstyled/fab/src'
),
'@gluestack-ui/form-control': path.join(
__dirname,
'../../packages/unstyled/form-control/src'
),
'@gluestack-ui/hstack': path.join(
__dirname,
'../../packages/unstyled/hstack/src'
),
'@gluestack-ui/icon': path.join(
__dirname,
'../../packages/unstyled/icon/src'
),
'@gluestack-ui/input': path.join(
__dirname,
'../../packages/unstyled/input/src'
),
'@gluestack-ui/linear-gradient': path.join(
__dirname,
'../../packages/unstyled/linear-gradient/src'
),
'@gluestack-ui/link': path.join(
__dirname,
'../../packages/unstyled/link/src'
),
'@gluestack-ui/menu': path.join(
__dirname,
'../../packages/unstyled/menu/src'
),
'@gluestack-ui/modal': path.join(
__dirname,
'../../packages/unstyled/modal/src'
),
'@gluestack-ui/overlay': path.join(
__dirname,
'../../packages/unstyled/overlay/src'
),
'@gluestack-ui/pressable': path.join(
__dirname,
'../../packages/unstyled/pressable/src'
),
'@gluestack-ui/progress': path.join(
__dirname,
'../../packages/unstyled/progress/src'
),
'@gluestack-ui/provider': path.join(
__dirname,
'../../packages/unstyled/provider/src'
),
'@gluestack-ui/radio': path.join(
__dirname,
'../../packages/unstyled/radio/src'
),
'@gluestack-ui/select': path.join(
__dirname,
'../../packages/unstyled/select/src'
),
'@gluestack-ui/slider': path.join(
__dirname,
'../../packages/unstyled/slider/src'
),
'@gluestack-ui/spinner': path.join(
__dirname,
'../../packages/unstyled/spinner/src'
),
'@gluestack-ui/switch': path.join(
__dirname,
'../../packages/unstyled/switch/src'
),
'@gluestack-ui/tabs': path.join(
__dirname,
'../../packages/unstyled/tabs/src'
),
'@gluestack-ui/textarea': path.join(
__dirname,
'../../packages/unstyled/textarea/src'
),
'@gluestack-ui/toast': path.join(
__dirname,
'../../packages/unstyled/toast/src'
),
'@gluestack-ui/tooltip': path.join(
__dirname,
'../../packages/unstyled/tooltip/src'
),
'@gluestack-ui/transitions': path.join(
__dirname,
'../../packages/unstyled/transitions/src'
),
'@gluestack-ui/utils': path.join(
__dirname,
'../../packages/unstyled/utils/src'
),
'@gluestack-ui/vstack': path.join(
__dirname,
'../../packages/unstyled/vstack/src'
),
'@gluestack-style/react': path.join(
__dirname,
'../../packages/styled/react/src'
Expand Down
1 change: 1 addition & 0 deletions example/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@react-native-community/slider": "4.2.4",
"@react-stately/collections": "^3.6.0",
"@react-stately/tree": "^3.5.0",
"@storybook/preview-api": "^7.6.8",
"@typescript-eslint/parser": "^6.13.2",
"expo": "^47.0.0",
"expo-linear-gradient": "^12.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { ComponentMeta } from '@storybook/react-native';
import ImageBackground from './ImageBackground';

const ImageBackgroundMeta: ComponentMeta<typeof ImageBackground> = {
title: 'stories/React Native Components/ImageBackground',
component: ImageBackground,
};

export default ImageBackgroundMeta;

export { ImageBackground };
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {
Center,
Heading,
Text,
View,
ImageBackground,
} from '@gluestack-ui/themed';
import React from 'react';
import Wrapper from '../../components/Wrapper';

export default function ImageBackgroundStory() {
return (
<View h="$96" w="$96">
<ImageBackground
source={{ uri: 'https://legacy.reactjs.org/logo-og.png' }}
style={{ flex: 1, justifyContent: 'center' }}
>
<Text
color="$white"
fontSize={42}
lineHeight={84}
fontWeight="$bold"
textAlign="center"
backgroundColor="#000000c0"
>
Inside
</Text>
</ImageBackground>
</View>
);
}

export { View, Center, Heading, Text, Wrapper, ImageBackground };
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
title: ImageBackground | gluestack-ui
description: ImageBackground is the most fundamental component for building a UI. It is a common feature request from developers familiar with the web is background-image.
---

import { Canvas, Meta, Story } from '@storybook/addon-docs';
import { transformedCode } from '../../utils';
import {
AppProvider,
CodePreview,
Table,
TableContainer,
InlineCode,
} from '@gluestack/design-system';
import {ImageBackground, Text, Heading, Wrapper, View } from './ImageBackground';

<Meta title="ui/React Native Components/ImageBackground" />

#ImageBackground

The most fundamental component for building a UI.

<AppProvider>
<CodePreview
showComponentRenderer={true}
showArgsController={false}
metaData={{
code: `
<View h="$96" w="$96">
<ImageBackground
source={{ uri: 'https://legacy.reactjs.org/logo-og.png' }}
style={{ flex: 1, justifyContent: 'center' }}
>
<Text
color="$white"
fontSize={42}
lineHeight={84}
fontWeight="$bold"
textAlign="center"
backgroundColor="#000000c0"
>
Inside
</Text>
</ImageBackground>
</View>
`,
transformCode: (code) => {
return transformedCode(code);
},
scope: {
Wrapper,
Text,
Heading,View,
ImageBackground,
},
}}
/>
</AppProvider>

<br />

> Note: You can refer [here](https://github.com/gluestack/gluestack-ui/tree/main/packages/themed/src/components/ImageBackground/styled-components) to learn about default styling of StatusBar component
### Import

To use this component in your project, include the following import statement in your file.

```bash
import {ImageBackground } from '@gluestack-ui/themed';
```

### Anatomy

The structure provided below can help you identify and understand a badge component's various parts.

```jsx
export default () => <ImageBackground></ImageBackground>;
```

### Props

gluestack-uiImageBackground component is created usingImageBackground component from react-native. It extends all the props supported by [React Native ImageBackground](https://reactnative.dev/docs/ImageBackground#props), [utility props](/ui/docs/styling/utility-and-sx-props) and the props mentioned below.

#### ImageBackground

<AppProvider>
<TableContainer>
<Table>
<Table.THead>
<Table.TR>
<Table.TH>
<Table.TText>Name</Table.TText>
</Table.TH>
<Table.TH>
<Table.TText>Value</Table.TText>
</Table.TH>
<Table.TH>
<Table.TText>Default</Table.TText>
</Table.TH>
</Table.TR>
</Table.THead>
<Table.TBody>
<Table.TR>
<Table.TD>
<Table.TText>
<InlineCode>children</InlineCode>
</Table.TText>
</Table.TD>
<Table.TD>
<Table.TText>any</Table.TText>
</Table.TD>
<Table.TD>
<Table.TText>-</Table.TText>
</Table.TD>
</Table.TR>
</Table.TBody>
</Table>
</TableContainer>
</AppProvider>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { ComponentMeta } from '@storybook/react-native';
import RefreshControl from './RefreshControl';

const RefreshControlMeta: ComponentMeta<typeof RefreshControl> = {
title: 'stories/React Native Components/RefreshControl',
component: RefreshControl,
};

export default RefreshControlMeta;

export { RefreshControl };
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
Center,
Button,
ButtonText,
Text,
Box,
StatusBar,
} from '@gluestack-ui/themed';
import React from 'react';
import { Platform } from 'react-native';

export default function RefreshControlStory() {
const [visible, setVisible] = React.useState(true);
if (Platform.OS === 'web') {
return (
<Center
sx={{
_web: {
h: '100vh',
},
}}
>
<Text>This Component only work on native devices</Text>
</Center>
);
}
return (
<Center>
<Box flex={1} h="100%">
<StatusBar hidden={!visible} />
<Center flex={1} h="100%">
<Button
onPress={() => {
setVisible((prev) => !prev);
}}
>
<ButtonText>Toggle StatusBar Visibility</ButtonText>
</Button>
</Center>
</Box>
</Center>
);
}
Loading

0 comments on commit d39a277

Please sign in to comment.