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
18 changes: 9 additions & 9 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"eslint": "9.39.1",
"eslint-config-codemask": "2.2.1",
"husky": "9.1.7",
"turbo": "2.6.3"
"turbo": "2.7.6"
},
"packageManager": "bun@1.3.2",
"trustedDependencies": [
Expand Down
6 changes: 6 additions & 0 deletions packages/uniwind/eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export default [
'nested-if/nested-if-statements': 'off',
'no-continue': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/no-unused-vars': ['error', {
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_',
'caughtErrorsIgnorePattern': '^_',
}],
'no-bitwise': 'off',
},
},
{
Expand Down
5 changes: 2 additions & 3 deletions packages/uniwind/src/components/native/ActivityIndicator.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ActivityIndicator as RNActivityIndicator, ActivityIndicatorProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const ActivityIndicator = copyComponentProperties(RNActivityIndicator, (props: ActivityIndicatorProps) => {
const style = useStyle(props.className)
const color = useUniwindAccent(props.colorClassName)
const style = useStyle(props.className, props)
const color = useStyle(props.colorClassName, props).accentColor

return (
<RNActivityIndicator
Expand Down
4 changes: 2 additions & 2 deletions packages/uniwind/src/components/native/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Button as RNButton, ButtonProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const Button = copyComponentProperties(RNButton, (props: ButtonProps) => {
const color = useUniwindAccent(props.colorClassName)
const color = useStyle(props.colorClassName, props).accentColor

return (
<RNButton
Expand Down
13 changes: 6 additions & 7 deletions packages/uniwind/src/components/native/FlatList.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { FlatList as RNFlatList, FlatListProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const FlatList = copyComponentProperties(RNFlatList, (props: FlatListProps<unknown>) => {
const style = useStyle(props.className)
const styleColumnWrapper = useStyle(props.columnWrapperClassName)
const styleContentContainer = useStyle(props.contentContainerClassName)
const styleListFooterComponent = useStyle(props.ListFooterComponentClassName)
const styleListHeaderComponent = useStyle(props.ListHeaderComponentClassName)
const endFillColor = useUniwindAccent(props.endFillColorClassName)
const style = useStyle(props.className, props)
const styleColumnWrapper = useStyle(props.columnWrapperClassName, props)
const styleContentContainer = useStyle(props.contentContainerClassName, props)
const styleListFooterComponent = useStyle(props.ListFooterComponentClassName, props)
const styleListHeaderComponent = useStyle(props.ListHeaderComponentClassName, props)
const endFillColor = useStyle(props.endFillColorClassName, props).accentColor
const hasSingleColumn = !('numColumns' in props) || props.numColumns === 1

return (
Expand Down
5 changes: 2 additions & 3 deletions packages/uniwind/src/components/native/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Image as RNImage, ImageProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const Image = copyComponentProperties(RNImage, (props: ImageProps) => {
const style = useStyle(props.className)
const tintColor = useUniwindAccent(props.tintColorClassName)
const style = useStyle(props.className, props)
const tintColor = useStyle(props.tintColorClassName, props).accentColor

return (
<RNImage
Expand Down
7 changes: 3 additions & 4 deletions packages/uniwind/src/components/native/ImageBackground.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ImageBackground as RNImageBackground, ImageBackgroundProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const ImageBackground = copyComponentProperties(RNImageBackground, (props: ImageBackgroundProps) => {
const style = useStyle(props.className)
const imageStyle = useStyle(props.imageClassName)
const tintColor = useUniwindAccent(props.tintColorClassName)
const style = useStyle(props.className, props)
const imageStyle = useStyle(props.imageClassName, props)
const tintColor = useStyle(props.tintColorClassName, props).accentColor

return (
<RNImageBackground
Expand Down
5 changes: 2 additions & 3 deletions packages/uniwind/src/components/native/InputAccessoryView.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { ForwardedRef } from 'react'
import { InputAccessoryView as RNInputAccessoryView, InputAccessoryViewProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const InputAccessoryView = copyComponentProperties(
RNInputAccessoryView,
(props: InputAccessoryViewProps & { ref?: ForwardedRef<RNInputAccessoryView> }) => {
const style = useStyle(props.className)
const backgroundColor = useUniwindAccent(props.backgroundColorClassName)
const style = useStyle(props.className, props)
const backgroundColor = useStyle(props.backgroundColorClassName, props).accentColor

return (
<RNInputAccessoryView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const KeyboardAvoidingView = copyComponentProperties(RNKeyboardAvoidingView, (props: KeyboardAvoidingViewProps) => {
const style = useStyle(props.className)
const contentContainerStyle = useStyle(props.contentContainerClassName)
const style = useStyle(props.className, props)
const contentContainerStyle = useStyle(props.contentContainerClassName, props)

return (
<RNKeyboardAvoidingView
Expand Down
5 changes: 2 additions & 3 deletions packages/uniwind/src/components/native/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Modal as RNModal, ModalProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const Modal = copyComponentProperties(RNModal, (props: ModalProps) => {
const style = useStyle(props.className)
const backdropColor = useUniwindAccent(props.backdropColorClassName)
const style = useStyle(props.className, props)
const backdropColor = useStyle(props.backdropColorClassName, props).accentColor

return (
<RNModal
Expand Down
11 changes: 8 additions & 3 deletions packages/uniwind/src/components/native/Pressable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const Pressable = copyComponentProperties(RNPressable, (props: PressableProps) => {
const style = useStyle(props.className, {
isDisabled: Boolean(props.disabled),
})
const style = useStyle(
props.className,
props,
{
isDisabled: Boolean(props.disabled),
},
)

return (
<RNPressable
Expand All @@ -16,6 +20,7 @@ export const Pressable = copyComponentProperties(RNPressable, (props: PressableP
return [
UniwindStore.getStyles(
props.className,
props,
{ isDisabled: Boolean(props.disabled), isPressed: true },
).styles,
typeof props.style === 'function' ? props.style(state) : props.style,
Expand Down
11 changes: 5 additions & 6 deletions packages/uniwind/src/components/native/RefreshControl.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { RefreshControl as RNRefreshControl, RefreshControlProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const RefreshControl = copyComponentProperties(RNRefreshControl, (props: RefreshControlProps) => {
const style = useStyle(props.className)
const color = useUniwindAccent(props.colorsClassName)
const tintColor = useUniwindAccent(props.tintColorClassName)
const titleColor = useUniwindAccent(props.titleColorClassName)
const progressBackgroundColor = useUniwindAccent(props.progressBackgroundColorClassName)
const style = useStyle(props.className, props)
const color = useStyle(props.colorsClassName, props).accentColor
const tintColor = useStyle(props.tintColorClassName, props).accentColor
const titleColor = useStyle(props.titleColorClassName, props).accentColor
const progressBackgroundColor = useStyle(props.progressBackgroundColorClassName, props).accentColor

return (
<RNRefreshControl
Expand Down
2 changes: 1 addition & 1 deletion packages/uniwind/src/components/native/SafeAreaView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const SafeAreaView = copyComponentProperties(RNSafeAreaView, (props: ViewProps) => {
const style = useStyle(props.className)
const style = useStyle(props.className, props)

return (
<RNSafeAreaView
Expand Down
7 changes: 3 additions & 4 deletions packages/uniwind/src/components/native/ScrollView.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ScrollView as RNScrollView, ScrollViewProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const ScrollView = copyComponentProperties(RNScrollView, (props: ScrollViewProps) => {
const style = useStyle(props.className)
const contentContainerStyle = useStyle(props.contentContainerClassName)
const endFillColor = useUniwindAccent(props.endFillColorClassName)
const style = useStyle(props.className, props)
const contentContainerStyle = useStyle(props.contentContainerClassName, props)
const endFillColor = useStyle(props.endFillColorClassName, props).accentColor

return (
<RNScrollView
Expand Down
11 changes: 5 additions & 6 deletions packages/uniwind/src/components/native/SectionList.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { SectionList as RNSectionList, SectionListProps } from 'react-native'
import { useUniwindAccent } from '../../hooks'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const SectionList = copyComponentProperties(RNSectionList, (props: SectionListProps<unknown, unknown>) => {
const style = useStyle(props.className)
const contentContainerStyle = useStyle(props.contentContainerClassName)
const listFooterComponentStyle = useStyle(props.ListFooterComponentClassName)
const listHeaderComponentStyle = useStyle(props.ListHeaderComponentClassName)
const endFillColor = useUniwindAccent(props.endFillColorClassName)
const style = useStyle(props.className, props)
const contentContainerStyle = useStyle(props.contentContainerClassName, props)
const listFooterComponentStyle = useStyle(props.ListFooterComponentClassName, props)
const listHeaderComponentStyle = useStyle(props.ListHeaderComponentClassName, props)
const endFillColor = useStyle(props.endFillColorClassName, props).accentColor

return (
<RNSectionList
Expand Down
11 changes: 5 additions & 6 deletions packages/uniwind/src/components/native/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { Switch as RNSwitch, SwitchProps } from 'react-native'
import { ComponentState } from '../../core/types'
import { useUniwindAccent } from '../../hooks/useUniwindAccent.native'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

export const Switch = copyComponentProperties(RNSwitch, (props: SwitchProps) => {
const state = {
isDisabled: Boolean(props.disabled),
} satisfies ComponentState
const style = useStyle(props.className, state)
const trackColorOn = useUniwindAccent(props.trackColorOnClassName, state)
const trackColorOff = useUniwindAccent(props.trackColorOffClassName, state)
const thumbColor = useUniwindAccent(props.thumbColorClassName, state)
const ios_backgroundColor = useUniwindAccent(props.ios_backgroundColorClassName, state)
const style = useStyle(props.className, props, state)
const trackColorOn = useStyle(props.trackColorOnClassName, props, state).accentColor
const trackColorOff = useStyle(props.trackColorOffClassName, props, state).accentColor
const thumbColor = useStyle(props.thumbColorClassName, props, state).accentColor
const ios_backgroundColor = useStyle(props.ios_backgroundColorClassName, props, state).accentColor

return (
<RNSwitch
Expand Down
5 changes: 2 additions & 3 deletions packages/uniwind/src/components/native/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState } from 'react'
import { Text as RNText, TextProps } from 'react-native'
import { ComponentState } from '../../core/types'
import { useUniwindAccent } from '../../hooks/useUniwindAccent.native'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

Expand All @@ -15,8 +14,8 @@ export const Text = copyComponentProperties(RNText, (props: TextProps) => {
isPressed,
isDisabled: Boolean(props.disabled),
} satisfies ComponentState
const style = useStyle(props.className, state)
const selectionColor = useUniwindAccent(props.selectionColorClassName, state)
const style = useStyle(props.className, props, state)
const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor

return (
<RNText
Expand Down
13 changes: 6 additions & 7 deletions packages/uniwind/src/components/native/TextInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState } from 'react'
import { TextInput as RNTextInput, TextInputProps } from 'react-native'
import { ComponentState } from '../../core/types'
import { useUniwindAccent } from '../../hooks/useUniwindAccent.native'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

Expand All @@ -13,12 +12,12 @@ export const TextInput = copyComponentProperties(RNTextInput, (props: TextInputP
isFocused,
isPressed,
} satisfies ComponentState
const style = useStyle(props.className, state)
const cursorColor = useUniwindAccent(props.cursorColorClassName, state)
const selectionColor = useUniwindAccent(props.selectionColorClassName, state)
const placeholderTextColor = useUniwindAccent(props.placeholderTextColorClassName, state)
const selectionHandleColor = useUniwindAccent(props.selectionHandleColorClassName, state)
const underlineColorAndroid = useUniwindAccent(props.underlineColorAndroidClassName, state)
const style = useStyle(props.className, props, state)
const cursorColor = useStyle(props.cursorColorClassName, props, state).accentColor
const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor
const placeholderTextColor = useStyle(props.placeholderTextColorClassName, props, state).accentColor
const selectionHandleColor = useStyle(props.selectionHandleColorClassName, props, state).accentColor
const underlineColorAndroid = useStyle(props.underlineColorAndroidClassName, props, state).accentColor

return (
<RNTextInput
Expand Down
5 changes: 2 additions & 3 deletions packages/uniwind/src/components/native/TouchableHighlight.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState } from 'react'
import { TouchableHighlight as RNTouchableHighlight, TouchableHighlightProps } from 'react-native'
import { ComponentState } from '../../core/types'
import { useUniwindAccent } from '../../hooks/useUniwindAccent.native'
import { copyComponentProperties } from '../utils'
import { useStyle } from './useStyle'

Expand All @@ -11,8 +10,8 @@ export const TouchableHighlight = copyComponentProperties(RNTouchableHighlight,
isDisabled: Boolean(props.disabled),
isPressed,
} satisfies ComponentState
const style = useStyle(props.className, state)
const underlayColor = useUniwindAccent(props.underlayColorClassName, state)
const style = useStyle(props.className, props, state)
const underlayColor = useStyle(props.underlayColorClassName, props, state).accentColor

return (
<RNTouchableHighlight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const TouchableNativeFeedback = copyComponentProperties(RNTouchableNative
isDisabled: Boolean(props.disabled),
isPressed,
} satisfies ComponentState
const style = useStyle(props.className, state)
const style = useStyle(props.className, props, state)

return (
<RNTouchableNativeFeedback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const TouchableOpacity = copyComponentProperties(RNTouchableOpacity, (pro
isDisabled: Boolean(props.disabled),
isPressed,
} satisfies ComponentState
const style = useStyle(props.className, state)
const style = useStyle(props.className, props, state)

return (
<RNTouchableOpacity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const TouchableWithoutFeedback = copyComponentProperties(RNTouchableWitho
isDisabled: Boolean(props.disabled),
isPressed,
} satisfies ComponentState
const style = useStyle(props.className, state)
const style = useStyle(props.className, props, state)

return (
<RNTouchableWithoutFeedback
Expand Down
Loading