Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #507 from gluestack/release/@gluestack-style/react…
Browse files Browse the repository at this point in the history
…@1.0.10

Release/@gluestack style/[email protected]
  • Loading branch information
ankit-tailor authored Oct 30, 2023
2 parents acb1010 + 4aefeb4 commit 15a2869
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 48 deletions.
41 changes: 6 additions & 35 deletions example/storybook/src/api/ExtendComponents/ExtendComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,19 @@
import React from 'react';
import { View, Text } from 'react-native';
import { Wrapper } from '../../components/Wrapper';
import { Camera } from 'lucide-react-native';
import { StyledHeading } from '../../ui-components/AsForwarder';
import { H2 } from '@expo/html-elements';
import {
StyledProvider,
createComponents,
styled,
} from '@gluestack-style/react';
import { StyledProvider, styled } from '@gluestack-style/react';
import { config } from '../../components/nb.config';

config.components = {
Box: {
theme: {
bg: '$red500',
p: '$10',
// props: {
// ':initial': {
// scale: 0.5,
// },
// ':animate': {
// scale: 1,
// },
// props: {
// p: '$5',
// },
// },
},
},
};

const Box = styled(
AnimatedView,
{},
View,
{
bg: '$amber400',
p: '$10',
},
{
componentName: 'Box',
}
);
import Svg from 'react-native-svg';
import { AnimatedView } from '@gluestack-style/animation-resolver';

export function ExtendComponentsExample() {
const [state, setState] = React.useState(false);
return (
<StyledProvider config={config} colorMode={'dark'}>
<View
Expand Down
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @gluestack-style/react

## 1.0.10

### Patch Changes

- Fixed theme and styled circular dependency

## 1.0.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@gluestack-style/react",
"description": "A universal & performant styling library for React Native, Next.js & React",
"version": "1.0.9",
"version": "1.0.10",
"keywords": [
"React Native",
"Next.js",
Expand Down
22 changes: 10 additions & 12 deletions packages/react/src/Theme.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { View } from 'react-native';
import type { ViewProps } from 'react-native';
import * as React from 'react';
import { styled } from './styled';
type Config = any;

export const defaultConfig: { theme?: string } = {
Expand All @@ -10,16 +10,14 @@ export const defaultConfig: { theme?: string } = {
const defaultContextData: Config = defaultConfig;
const ThemeContext = React.createContext<Config>(defaultContextData);
// Can be discussed should we provide flex 1 by default or not.
const StyledView = styled(
View,
{
// flex: 1
},
{ componentName: 'GluestackThemeView' }
);

// @ts-ignore
export const Theme: typeof StyledView = ({ children, name, ...props }) => {
export const Theme = ({
children,
name,
...props
}: ViewProps & {
name: string;
}) => {
const contextValue = React.useMemo(() => {
return {
theme: name,
Expand All @@ -29,9 +27,9 @@ export const Theme: typeof StyledView = ({ children, name, ...props }) => {
return (
<ThemeContext.Provider value={contextValue}>
{/* @ts-ignore */}
<StyledView dataSet={{ 'theme-id': name }} {...props}>
<View dataSet={{ 'theme-id': name }} {...props}>
{children}
</StyledView>
</View>
</ThemeContext.Provider>
);
};
Expand Down

0 comments on commit 15a2869

Please sign in to comment.