Skip to content

Commit

Permalink
Merge branch 'patch' into feat/cli-docs
Browse files Browse the repository at this point in the history
vaibhk20 committed Jun 27, 2024
2 parents ba6caf6 + 5d81777 commit 39fa0b7
Showing 5 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion example/storybook-nativewind/package.json
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
"@gluestack-style/animation-resolver": "^1.0.4",
"@gluestack-style/react": "^1.0.56",
"@gluestack-ui/config": "^1.1.18",
"@gluestack-ui/themed": "^1.1.30",
"@gluestack-ui/themed": "^1.1.31",
"@gluestack/design-system": "^0.5.36",
"@gorhom/bottom-sheet": "^5.0.0-alpha.10",
"@legendapp/motion": "^2.2.0",
4 changes: 2 additions & 2 deletions packages/config/package.json
Original file line number Diff line number Diff line change
@@ -66,14 +66,14 @@
"@gluestack-ui/switch": "0.1.21",
"@gluestack-ui/tabs": "0.1.16",
"@gluestack-ui/textarea": "0.1.22",
"@gluestack-ui/themed": "1.1.30",
"@gluestack-ui/themed": "1.1.31",
"@gluestack-ui/toast": "1.0.4",
"@gluestack-ui/tooltip": "0.1.30",
"@legendapp/motion": "latest"
},
"peerDependencies": {
"@gluestack-style/react": ">=1.0.56",
"@gluestack-ui/themed": ">=1.1.30"
"@gluestack-ui/themed": ">=1.1.31"
},
"release-it": {
"git": {
21 changes: 14 additions & 7 deletions packages/nativewind/utils/useBreakpointValue/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Dimensions, useWindowDimensions } from 'react-native';
import { useEffect, useState } from 'react';
type BreakPointValue = Partial<{
// @ts-ignore
[key]: any;
}>;

import DefaultTheme from 'tailwindcss/defaultConfig';
import resolveConfig from 'tailwindcss/resolveConfig';

const TailwindTheme = resolveConfig(DefaultTheme);
const screenSize = TailwindTheme.theme.screens;

type breakpoints = keyof typeof screenSize | 'default';

type BreakPointValue = Partial<Record<breakpoints, any>>;

const resolveScreenWidth: any = {
default: 0,
};
@@ -23,7 +23,13 @@ export const getBreakPointValue = (values: any, width: any) => {
if (typeof values !== 'object') return values;

let finalBreakPointResolvedValue: any;
const mediaQueriesBreakpoints: any = [];
const mediaQueriesBreakpoints: any = [
{
key: 'default',
breakpoint: 0,
isValid: true,
},
];
Object.keys(resolveScreenWidth).forEach((key) => {
const isValid = isValidBreakpoint(resolveScreenWidth[key], width);

@@ -40,15 +46,16 @@ export const getBreakPointValue = (values: any, width: any) => {
breakpoint.value = values.hasOwnProperty(breakpoint.key)
? // @ts-ignore
values[breakpoint.key]
: mediaQueriesBreakpoints[index - 1].value;
: mediaQueriesBreakpoints[index - 1]?.value ||
mediaQueriesBreakpoints[0]?.value;
});

const lastValidObject = getLastValidObject(mediaQueriesBreakpoints);

if (!lastValidObject) {
finalBreakPointResolvedValue = values;
} else {
finalBreakPointResolvedValue = lastValidObject.value;
finalBreakPointResolvedValue = lastValidObject?.value;
}
return finalBreakPointResolvedValue;
};
6 changes: 6 additions & 0 deletions packages/themed/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @gluestack-ui/themed

## 1.1.31

### Patch Changes

- TextArea Typing Issue

## 1.1.30

### Patch Changes
2 changes: 1 addition & 1 deletion packages/themed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gluestack-ui/themed",
"version": "1.1.30",
"version": "1.1.31",
"main": "build/index.js",
"types": "build/index.d.ts",
"module": "build/index",

0 comments on commit 39fa0b7

Please sign in to comment.