Skip to content
Merged
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
235 changes: 179 additions & 56 deletions bun.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
},
"devDependencies": {
"typescript": "catalog:",
"dprint": "0.50.2",
"dprint": "0.51.1",
"eslint": "9.39.1",
"eslint-config-codemask": "2.2.1",
"husky": "9.1.7",
"turbo": "2.7.6"
"turbo": "2.8.7"
},
"packageManager": "bun@1.3.2",
"trustedDependencies": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export default {
preset: 'react-native',
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect', './tests/setup.ts'],
displayName: 'native',
testMatch: ['<rootDir>/tests/native/**/*.test.{ts,tsx}'],
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect', '<rootDir>/tests/setup.native.ts'],
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)',
],
Expand Down
26 changes: 26 additions & 0 deletions packages/uniwind/jest.config.web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export default {
displayName: 'web',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/tests/web/**/*.test.{ts,tsx}'],
setupFilesAfterEnv: [
'@testing-library/jest-dom',
'<rootDir>/tests/setup.web.ts',
],
preset: 'ts-jest',
moduleNameMapper: {
'^react-native$': 'react-native-web',
'\\.css$': '<rootDir>/tests/__mocks__/styleMock.js',
},
transformIgnorePatterns: [
'node_modules/(?!(react-native-web)/)',
],
transform: {
'^.+\\.tsx?$': ['ts-jest', {
tsconfig: {
jsx: 'react-jsx',
esModuleInterop: true,
allowSyntheticDefaultImports: true,
},
}],
},
}
26 changes: 16 additions & 10 deletions packages/uniwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"prepublishOnly": "bun run build",
"circular:check": "dpdm --no-warning --no-tree -T --exit-code circular:1 'src/**/*.ts' 'src/**/*.tsx'",
"build:css": "bun run src/css/index.ts",
"test": "jest"
"test:native": "jest --config jest.config.native.js",
"test:web": "jest --config jest.config.web.js"
},
"keywords": [
"unistyles",
Expand Down Expand Up @@ -88,20 +89,25 @@
"tailwindcss": ">=4"
},
"devDependencies": {
"@react-native/babel-preset": "0.83.0",
"@testing-library/jest-dom": "6.9.1",
"@testing-library/jest-native": "5.4.3",
"@testing-library/react": "16.3.2",
"@testing-library/react-native": "13.3.3",
"@types/bun": "catalog:",
"@types/culori": "4.0.1",
"@types/jest": "30.0.0",
"@types/react": "catalog:",
"typescript": "catalog:",
"metro": "0.83.3",
"dpdm": "3.14.0",
"unbuild": "3.6.1",
"vite": "7.2.7",
"jest": "30.2.0",
"react-test-renderer": "19.1.0",
"@react-native/babel-preset": "0.83.0",
"@testing-library/jest-native": "5.4.3",
"@testing-library/react-native": "13.3.3",
"jest-environment-jsdom": "30.2.0",
"metro": "0.83.3",
"prettier": "3.7.4",
"@types/jest": "30.0.0"
"react-native-web": "catalog:",
"react-test-renderer": "19.1.0",
"ts-jest": "29.4.6",
"typescript": "catalog:",
"unbuild": "3.6.1",
"vite": "7.2.7"
}
}
17 changes: 16 additions & 1 deletion packages/uniwind/src/hoc/withUniwind.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,24 @@ const withManualUniwind = (Component: Component<AnyObject>, options: Record<Prop
}

const { styles, dependencies } = UniwindStore.getStyles(className)
acc.dependencies.push(...dependencies)

if (!isStyleProperty(propName)) {
acc.generatedProps[propName] = styles

return acc
}

const existingStyle = props[propName]

// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (existingStyle) {
acc.generatedProps[propName] = [styles, existingStyle]

return acc
}

acc.generatedProps[propName] = styles
acc.dependencies.push(...dependencies)

return acc
}, { generatedProps: {} as AnyObject, dependencies: [] as Array<StyleDependency> })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet } from 'react-native'
import ActivityIndicator from '../../src/components/native/ActivityIndicator'
import { TW_RED_500 } from '../consts'
import ActivityIndicator from '../../../src/components/native/ActivityIndicator'
import { TW_RED_500 } from '../../consts'

describe('ActivityIndicator', () => {
test('Basic rendering with colorClassName', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet } from 'react-native'
import Button from '../../src/components/native/Button'
import { TW_RED_500 } from '../consts'
import Button from '../../../src/components/native/Button'
import { TW_RED_500 } from '../../consts'

describe('Button', () => {
test('Basic rendering', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet } from 'react-native'
import FlatList from '../../src/components/native/FlatList'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import FlatList from '../../../src/components/native/FlatList'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('FlatList', () => {
test('Basic rendering with classNames and colors', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet, View } from 'react-native'
import ImageBackground from '../../src/components/native/ImageBackground'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import ImageBackground from '../../../src/components/native/ImageBackground'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('ImageBackground', () => {
test('Basic rendering with className, imageClassName and tintColorClassName', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet } from 'react-native'
import Image from '../../src/components/native/Image'
import { TW_BLUE_500, TW_RED_500 } from '../consts'
import Image from '../../../src/components/native/Image'
import { TW_BLUE_500, TW_RED_500 } from '../../consts'

describe('Image', () => {
test('Basic rendering with className and tintColorClassName', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { InputAccessoryView as RNInputAccessoryView, Platform, StyleSheet } from 'react-native'
import InputAccessoryView from '../../src/components/native/InputAccessoryView'
import { TW_BLUE_500, TW_RED_500 } from '../consts'
import InputAccessoryView from '../../../src/components/native/InputAccessoryView'
import { TW_BLUE_500, TW_RED_500 } from '../../consts'

describe('InputAccessoryView', () => {
beforeAll(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { KeyboardAvoidingView as RNKeyboardAvoidingView, StyleSheet } from 'react-native'
import KeyboardAvoidingView from '../../src/components/native/KeyboardAvoidingView'
import { TW_BLUE_500, TW_RED_500 } from '../consts'
import KeyboardAvoidingView from '../../../src/components/native/KeyboardAvoidingView'
import { TW_BLUE_500, TW_RED_500 } from '../../consts'

describe('KeyboardAvoidingView', () => {
test('Basic rendering with className and contentContainerClassName', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { Modal as RNModal, StyleSheet } from 'react-native'
import Modal from '../../src/components/native/Modal'
import { TW_BLUE_500, TW_RED_500 } from '../consts'
import Modal from '../../../src/components/native/Modal'
import { TW_BLUE_500, TW_RED_500 } from '../../consts'

describe('Modal', () => {
test('Basic rendering with className and backdropColorClassName', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet } from 'react-native'
import Pressable from '../../src/components/native/Pressable'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import Pressable from '../../../src/components/native/Pressable'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('Pressable', () => {
test('Basic rendering with className', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { RefreshControl as RNRefreshControl, StyleSheet } from 'react-native'
import RefreshControl from '../../src/components/native/RefreshControl'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import RefreshControl from '../../../src/components/native/RefreshControl'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('RefreshControl', () => {
test('Basic rendering with className and color props', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { SafeAreaView as RNSafeAreaView, StyleSheet } from 'react-native'
import SafeAreaView from '../../src/components/native/SafeAreaView'
import { TW_RED_500 } from '../consts'
import SafeAreaView from '../../../src/components/native/SafeAreaView'
import { TW_RED_500 } from '../../consts'

describe('SafeAreaView', () => {
test('Basic rendering with className', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { ScrollView as RNScrollView, StyleSheet } from 'react-native'
import ScrollView from '../../src/components/native/ScrollView'
import { TW_BLUE_500, TW_RED_500 } from '../consts'
import ScrollView from '../../../src/components/native/ScrollView'
import { TW_BLUE_500, TW_RED_500 } from '../../consts'

describe('ScrollView', () => {
test('Basic rendering with className, contentContainerClassName and endFillColorClassName', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { SectionList as RNSectionList, StyleSheet } from 'react-native'
import SectionList from '../../src/components/native/SectionList'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import SectionList from '../../../src/components/native/SectionList'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('SectionList', () => {
test('Basic rendering with classNames and colors', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { Switch as RNSwitch } from 'react-native'
import Switch from '../../src/components/native/Switch'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import Switch from '../../../src/components/native/Switch'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('Switch', () => {
test('Basic rendering with className and color props', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet } from 'react-native'
import TextInput from '../../src/components/native/TextInput'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import TextInput from '../../../src/components/native/TextInput'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('TextInput', () => {
test('Basic rendering with className and color props', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet } from 'react-native'
import Text from '../../src/components/native/Text'
import { TW_BLUE_500, TW_RED_500 } from '../consts'
import Text from '../../../src/components/native/Text'
import { TW_BLUE_500, TW_RED_500 } from '../../consts'

describe('Text', () => {
test('Basic rendering with className and selectionColorClassName', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet, TouchableHighlight as RNTouchableHighlight, View } from 'react-native'
import TouchableHighlight from '../../src/components/native/TouchableHighlight'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import TouchableHighlight from '../../../src/components/native/TouchableHighlight'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('TouchableHighlight', () => {
test('Basic rendering with className and underlayColorClassName', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, render } from '@testing-library/react-native'
import * as React from 'react'
import { Platform, StyleSheet, TouchableNativeFeedback as RNTouchableNativeFeedback, View } from 'react-native'
import TouchableNativeFeedback from '../../src/components/native/TouchableNativeFeedback'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import TouchableNativeFeedback from '../../../src/components/native/TouchableNativeFeedback'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('TouchableNativeFeedback', () => {
beforeAll(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet, TouchableOpacity as RNTouchableOpacity, View } from 'react-native'
import TouchableOpacity from '../../src/components/native/TouchableOpacity'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import TouchableOpacity from '../../../src/components/native/TouchableOpacity'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('TouchableOpacity', () => {
test('Basic rendering with className', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet, TouchableWithoutFeedback as RNTouchableWithoutFeedback, View } from 'react-native'
import TouchableWithoutFeedback from '../../src/components/native/TouchableWithoutFeedback'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../consts'
import TouchableWithoutFeedback from '../../../src/components/native/TouchableWithoutFeedback'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500 } from '../../consts'

describe('TouchableWithoutFeedback', () => {
test('Basic rendering with className', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet } from 'react-native'
import View from '../../src/components/native/View'
import { TW_RED_500 } from '../consts'
import View from '../../../src/components/native/View'
import { TW_RED_500 } from '../../consts'

describe('View', () => {
test('Basic rendering', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from '@testing-library/react-native'
import * as React from 'react'
import { StyleSheet, Text, VirtualizedList as RNVirtualizedList } from 'react-native'
import VirtualizedList from '../../src/components/native/VirtualizedList'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500, TW_YELLOW_500 } from '../consts'
import VirtualizedList from '../../../src/components/native/VirtualizedList'
import { TW_BLUE_500, TW_GREEN_500, TW_RED_500, TW_YELLOW_500 } from '../../consts'

describe('VirtualizedList', () => {
const data = ['Item 1', 'Item 2']
Expand Down
Loading