@niibase/uniwind 1.0.0 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/components/native/react-native-gesture-handler/BaseButton.js +18 -0
- package/dist/common/components/native/react-native-gesture-handler/BorderlessButton.js +18 -0
- package/dist/common/components/native/react-native-gesture-handler/DrawerLayoutAndroid.js +18 -0
- package/dist/common/components/native/react-native-gesture-handler/FlatList.js +30 -0
- package/dist/common/components/native/react-native-gesture-handler/GestureHandlerRootView.js +18 -0
- package/dist/common/components/native/react-native-gesture-handler/Pressable.js +29 -0
- package/dist/common/components/native/react-native-gesture-handler/PureNativeButton.js +18 -0
- package/dist/common/components/native/react-native-gesture-handler/RawButton.js +18 -0
- package/dist/common/components/native/react-native-gesture-handler/RectButton.js +18 -0
- package/dist/common/components/native/react-native-gesture-handler/RefreshControl.js +27 -0
- package/dist/common/components/native/react-native-gesture-handler/ScrollView.js +23 -0
- package/dist/common/components/native/react-native-gesture-handler/Switch.js +32 -0
- package/dist/common/components/native/react-native-gesture-handler/Text.js +36 -0
- package/dist/common/components/native/react-native-gesture-handler/TextInput.js +53 -0
- package/dist/common/components/native/react-native-gesture-handler/TouchableNativeFeedback.js +32 -0
- package/dist/common/components/native/react-native-gesture-handler/TouchableOpacity.js +32 -0
- package/dist/common/components/native/react-native-gesture-handler/TouchableWithoutFeedback.js +32 -0
- package/dist/common/components/native/react-native-gesture-handler/index.js +122 -0
- package/dist/common/components/native/react-native-svg/Svg.js +18 -0
- package/dist/common/components/native/react-native-svg/index.js +35 -0
- package/dist/common/core/native/runtime.js +2 -1
- package/dist/common/core/native/store.js +33 -3
- package/dist/metro/index.cjs +17 -3
- package/dist/metro/index.mjs +17 -3
- package/dist/metro/metro-transformer.cjs +56 -19
- package/dist/metro/metro-transformer.mjs +56 -19
- package/dist/module/components/native/react-native-gesture-handler/BaseButton.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/BaseButton.js +15 -0
- package/dist/module/components/native/react-native-gesture-handler/BorderlessButton.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/BorderlessButton.js +18 -0
- package/dist/module/components/native/react-native-gesture-handler/DrawerLayoutAndroid.d.ts +5 -0
- package/dist/module/components/native/react-native-gesture-handler/DrawerLayoutAndroid.js +18 -0
- package/dist/module/components/native/react-native-gesture-handler/FlatList.d.ts +4 -0
- package/dist/module/components/native/react-native-gesture-handler/FlatList.js +27 -0
- package/dist/module/components/native/react-native-gesture-handler/GestureHandlerRootView.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/GestureHandlerRootView.js +18 -0
- package/dist/module/components/native/react-native-gesture-handler/Pressable.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/Pressable.js +29 -0
- package/dist/module/components/native/react-native-gesture-handler/PureNativeButton.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/PureNativeButton.js +15 -0
- package/dist/module/components/native/react-native-gesture-handler/RawButton.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/RawButton.js +15 -0
- package/dist/module/components/native/react-native-gesture-handler/RectButton.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/RectButton.js +15 -0
- package/dist/module/components/native/react-native-gesture-handler/RefreshControl.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/RefreshControl.js +24 -0
- package/dist/module/components/native/react-native-gesture-handler/ScrollView.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/ScrollView.js +20 -0
- package/dist/module/components/native/react-native-gesture-handler/Switch.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/Switch.js +26 -0
- package/dist/module/components/native/react-native-gesture-handler/Text.d.ts +2 -0
- package/dist/module/components/native/react-native-gesture-handler/Text.js +33 -0
- package/dist/module/components/native/react-native-gesture-handler/TextInput.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/TextInput.js +50 -0
- package/dist/module/components/native/react-native-gesture-handler/TouchableNativeFeedback.d.ts +2 -0
- package/dist/module/components/native/react-native-gesture-handler/TouchableNativeFeedback.js +32 -0
- package/dist/module/components/native/react-native-gesture-handler/TouchableOpacity.d.ts +3 -0
- package/dist/module/components/native/react-native-gesture-handler/TouchableOpacity.js +32 -0
- package/dist/module/components/native/react-native-gesture-handler/TouchableWithoutFeedback.d.ts +4 -0
- package/dist/module/components/native/react-native-gesture-handler/TouchableWithoutFeedback.js +34 -0
- package/dist/module/components/native/react-native-gesture-handler/index.d.ts +0 -0
- package/dist/module/components/native/react-native-gesture-handler/index.js +120 -0
- package/dist/module/components/native/react-native-svg/Svg.d.ts +3 -0
- package/dist/module/components/native/react-native-svg/Svg.js +15 -0
- package/dist/module/components/native/react-native-svg/index.d.ts +3 -0
- package/dist/module/components/native/react-native-svg/index.js +3 -0
- package/dist/module/core/native/runtime.js +2 -6
- package/dist/module/core/native/store.d.ts +2 -0
- package/dist/module/core/native/store.js +30 -3
- package/dist/module/core/types.d.ts +10 -0
- package/package.json +6 -1
- package/readme.md +3 -0
- package/src/components/native/react-native-gesture-handler/BaseButton.tsx +18 -0
- package/src/components/native/react-native-gesture-handler/BorderlessButton.tsx +19 -0
- package/src/components/native/react-native-gesture-handler/DrawerLayoutAndroid.tsx +20 -0
- package/src/components/native/react-native-gesture-handler/FlatList.tsx +29 -0
- package/src/components/native/react-native-gesture-handler/GestureHandlerRootView.tsx +20 -0
- package/src/components/native/react-native-gesture-handler/Pressable.tsx +31 -0
- package/src/components/native/react-native-gesture-handler/PureNativeButton.tsx +16 -0
- package/src/components/native/react-native-gesture-handler/RawButton.tsx +16 -0
- package/src/components/native/react-native-gesture-handler/RectButton.tsx +16 -0
- package/src/components/native/react-native-gesture-handler/RefreshControl.tsx +26 -0
- package/src/components/native/react-native-gesture-handler/ScrollView.tsx +22 -0
- package/src/components/native/react-native-gesture-handler/Switch.tsx +29 -0
- package/src/components/native/react-native-gesture-handler/Text.tsx +40 -0
- package/src/components/native/react-native-gesture-handler/TextInput.tsx +53 -0
- package/src/components/native/react-native-gesture-handler/TouchableNativeFeedback.tsx +35 -0
- package/src/components/native/react-native-gesture-handler/TouchableOpacity.tsx +34 -0
- package/src/components/native/react-native-gesture-handler/TouchableWithoutFeedback.tsx +37 -0
- package/src/components/native/react-native-gesture-handler/index.ts +121 -0
- package/src/components/native/react-native-svg/Svg.tsx +16 -0
- package/src/components/native/react-native-svg/index.ts +5 -0
- package/src/core/native/runtime.ts +2 -6
- package/src/core/native/store.ts +51 -5
- package/src/core/types.ts +10 -0
- package/src/metro/compileVirtual.ts +5 -1
- package/src/metro/processor/mq.ts +15 -10
- package/src/metro/processor/processor.ts +55 -16
- package/src/metro/resolvers.ts +22 -2
- package/src/metro/types.ts +3 -2
- package/src/metro/withUniwindConfig.ts +1 -1
- package/types.d.ts +38 -0
- package/uniwind.css +1 -6
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseButton as RNGHBaseButton, BaseButtonProps } from 'react-native-gesture-handler'
|
|
2
|
+
import { copyComponentProperties } from '../../utils'
|
|
3
|
+
import { useStyle } from '../useStyle'
|
|
4
|
+
|
|
5
|
+
type BaseButtonPropsWithClassName = BaseButtonProps & { className?: string }
|
|
6
|
+
|
|
7
|
+
export const BaseButton = copyComponentProperties(RNGHBaseButton, (props: BaseButtonPropsWithClassName) => {
|
|
8
|
+
const style = useStyle(props.className)
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<RNGHBaseButton
|
|
12
|
+
{...props}
|
|
13
|
+
style={[style, props.style]}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export default BaseButton
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BorderlessButton as RNGHBorderlessButton, BorderlessButtonProps } from 'react-native-gesture-handler'
|
|
2
|
+
import { copyComponentProperties } from '../../utils'
|
|
3
|
+
import { useStyle } from '../useStyle'
|
|
4
|
+
|
|
5
|
+
export const BorderlessButton = copyComponentProperties(
|
|
6
|
+
RNGHBorderlessButton,
|
|
7
|
+
(props: BorderlessButtonProps) => {
|
|
8
|
+
const style = useStyle(props.className)
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<RNGHBorderlessButton
|
|
12
|
+
{...props}
|
|
13
|
+
style={[style, props.style]}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
},
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
export default BorderlessButton
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DrawerLayoutAndroidProps } from 'react-native'
|
|
2
|
+
import { DrawerLayoutAndroid as RNGHDrawerLayoutAndroid } from 'react-native-gesture-handler'
|
|
3
|
+
import { copyComponentProperties } from '../../utils'
|
|
4
|
+
import { useStyle } from '../useStyle'
|
|
5
|
+
|
|
6
|
+
export const DrawerLayoutAndroid = copyComponentProperties(
|
|
7
|
+
RNGHDrawerLayoutAndroid,
|
|
8
|
+
(props: DrawerLayoutAndroidProps) => {
|
|
9
|
+
const style = useStyle(props.className)
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<RNGHDrawerLayoutAndroid
|
|
13
|
+
{...props}
|
|
14
|
+
style={[style, props.style]}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
},
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
export default DrawerLayoutAndroid
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FlatListProps } from 'react-native'
|
|
2
|
+
import { FlatList as RNGHFlatList } from 'react-native-gesture-handler'
|
|
3
|
+
import { useUniwindAccent } from '../../../hooks'
|
|
4
|
+
import { copyComponentProperties } from '../../utils'
|
|
5
|
+
import { useStyle } from '../useStyle'
|
|
6
|
+
|
|
7
|
+
export const FlatList = copyComponentProperties(RNGHFlatList, (props: FlatListProps<unknown>) => {
|
|
8
|
+
const style = useStyle(props.className)
|
|
9
|
+
const styleColumnWrapper = useStyle(props.columnWrapperClassName)
|
|
10
|
+
const styleContentContainer = useStyle(props.contentContainerClassName)
|
|
11
|
+
const styleListFooterComponent = useStyle(props.ListFooterComponentClassName)
|
|
12
|
+
const styleListHeaderComponent = useStyle(props.ListHeaderComponentClassName)
|
|
13
|
+
const endFillColor = useUniwindAccent(props.endFillColorClassName)
|
|
14
|
+
const hasSingleColumn = !('numColumns' in props) || props.numColumns === 1
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<RNGHFlatList
|
|
18
|
+
{...props}
|
|
19
|
+
style={[style, props.style]}
|
|
20
|
+
columnWrapperStyle={hasSingleColumn ? undefined : [styleColumnWrapper, props.columnWrapperStyle]}
|
|
21
|
+
contentContainerStyle={[styleContentContainer, props.contentContainerStyle]}
|
|
22
|
+
ListFooterComponentStyle={[styleListFooterComponent, props.ListFooterComponentStyle]}
|
|
23
|
+
ListHeaderComponentStyle={[styleListHeaderComponent, props.ListHeaderComponentStyle]}
|
|
24
|
+
endFillColor={props.endFillColor ?? endFillColor}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export default FlatList
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GestureHandlerRootView as RNGestureHandlerRootView } from 'react-native-gesture-handler'
|
|
2
|
+
import { GestureHandlerRootViewProps } from 'react-native-gesture-handler/lib/typescript/components/GestureHandlerRootView'
|
|
3
|
+
import { copyComponentProperties } from '../../utils'
|
|
4
|
+
import { useStyle } from '../useStyle'
|
|
5
|
+
|
|
6
|
+
export const GestureHandlerRootView = copyComponentProperties(
|
|
7
|
+
RNGestureHandlerRootView,
|
|
8
|
+
(props: GestureHandlerRootViewProps) => {
|
|
9
|
+
const style = useStyle(props.className)
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<RNGestureHandlerRootView
|
|
13
|
+
{...props}
|
|
14
|
+
style={[style, props.style]}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
},
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
export default GestureHandlerRootView
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Pressable as RNGHPressable, PressableProps } from 'react-native-gesture-handler'
|
|
2
|
+
import { UniwindStore } from '../../../core/native'
|
|
3
|
+
import { copyComponentProperties } from '../../utils'
|
|
4
|
+
import { useStyle } from '../useStyle'
|
|
5
|
+
|
|
6
|
+
export const Pressable = copyComponentProperties(RNGHPressable, (props: PressableProps) => {
|
|
7
|
+
const style = useStyle(props.className, {
|
|
8
|
+
isDisabled: Boolean(props.disabled),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<RNGHPressable
|
|
13
|
+
{...props}
|
|
14
|
+
style={state => {
|
|
15
|
+
if (state.pressed) {
|
|
16
|
+
return [
|
|
17
|
+
UniwindStore.getStyles(
|
|
18
|
+
props.className,
|
|
19
|
+
{ isDisabled: Boolean(props.disabled), isPressed: true },
|
|
20
|
+
).styles,
|
|
21
|
+
typeof props.style === 'function' ? props.style(state) : props.style,
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return [style, typeof props.style === 'function' ? props.style(state) : props.style]
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export default Pressable
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PureNativeButton as RNGHPureNativeButton, RawButtonProps } from 'react-native-gesture-handler'
|
|
2
|
+
import { copyComponentProperties } from '../../utils'
|
|
3
|
+
import { useStyle } from '../useStyle'
|
|
4
|
+
|
|
5
|
+
export const PureNativeButton = copyComponentProperties(RNGHPureNativeButton, (props: RawButtonProps) => {
|
|
6
|
+
const style = useStyle(props.className)
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<RNGHPureNativeButton
|
|
10
|
+
{...props}
|
|
11
|
+
style={[style, props.style]}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export default PureNativeButton
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RawButton as RNGHRawButton, RawButtonProps } from 'react-native-gesture-handler'
|
|
2
|
+
import { copyComponentProperties } from '../../utils'
|
|
3
|
+
import { useStyle } from '../useStyle'
|
|
4
|
+
|
|
5
|
+
export const RawButton = copyComponentProperties(RNGHRawButton, (props: RawButtonProps) => {
|
|
6
|
+
const style = useStyle(props.className)
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<RNGHRawButton
|
|
10
|
+
{...props}
|
|
11
|
+
style={[style, props.style]}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export default RawButton
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RectButton as RNGHRectButton, RectButtonProps } from 'react-native-gesture-handler'
|
|
2
|
+
import { copyComponentProperties } from '../../utils'
|
|
3
|
+
import { useStyle } from '../useStyle'
|
|
4
|
+
|
|
5
|
+
export const RectButton = copyComponentProperties(RNGHRectButton, (props: RectButtonProps) => {
|
|
6
|
+
const style = useStyle(props.className)
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<RNGHRectButton
|
|
10
|
+
{...props}
|
|
11
|
+
style={[style, props.style]}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export default RectButton
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RefreshControlProps } from 'react-native'
|
|
2
|
+
import { RefreshControl as RNGHRefreshControl } from 'react-native-gesture-handler'
|
|
3
|
+
import { useUniwindAccent } from '../../../hooks'
|
|
4
|
+
import { copyComponentProperties } from '../../utils'
|
|
5
|
+
import { useStyle } from '../useStyle'
|
|
6
|
+
|
|
7
|
+
export const RefreshControl = copyComponentProperties(RNGHRefreshControl, (props: RefreshControlProps) => {
|
|
8
|
+
const style = useStyle(props.className)
|
|
9
|
+
const color = useUniwindAccent(props.colorsClassName)
|
|
10
|
+
const tintColor = useUniwindAccent(props.tintColorClassName)
|
|
11
|
+
const titleColor = useUniwindAccent(props.titleColorClassName)
|
|
12
|
+
const progressBackgroundColor = useUniwindAccent(props.progressBackgroundColorClassName)
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<RNGHRefreshControl
|
|
16
|
+
{...props}
|
|
17
|
+
style={[style, props.style]}
|
|
18
|
+
colors={props.colors ?? (color !== undefined ? [color] : undefined)}
|
|
19
|
+
tintColor={props.tintColor ?? tintColor}
|
|
20
|
+
titleColor={props.titleColor ?? titleColor}
|
|
21
|
+
progressBackgroundColor={props.progressBackgroundColor ?? progressBackgroundColor}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
export default RefreshControl
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ScrollViewProps } from 'react-native'
|
|
2
|
+
import { ScrollView as RNGHScrollView } from 'react-native-gesture-handler'
|
|
3
|
+
import { useUniwindAccent } from '../../../hooks'
|
|
4
|
+
import { copyComponentProperties } from '../../utils'
|
|
5
|
+
import { useStyle } from '../useStyle'
|
|
6
|
+
|
|
7
|
+
export const ScrollView = copyComponentProperties(RNGHScrollView, (props: ScrollViewProps) => {
|
|
8
|
+
const style = useStyle(props.className)
|
|
9
|
+
const contentContainerStyle = useStyle(props.contentContainerClassName)
|
|
10
|
+
const endFillColor = useUniwindAccent(props.endFillColorClassName)
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<RNGHScrollView
|
|
14
|
+
{...props}
|
|
15
|
+
style={[style, props.style]}
|
|
16
|
+
contentContainerStyle={[contentContainerStyle, props.contentContainerStyle]}
|
|
17
|
+
endFillColor={props.endFillColor ?? endFillColor}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export default ScrollView
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SwitchProps } from 'react-native'
|
|
2
|
+
import { Switch as RNGHSwitch } from 'react-native-gesture-handler'
|
|
3
|
+
import { ComponentState } from '../../../core/types'
|
|
4
|
+
import { useUniwindAccent } from '../../../hooks/useUniwindAccent.native'
|
|
5
|
+
import { copyComponentProperties } from '../../utils'
|
|
6
|
+
import { useStyle } from '../useStyle'
|
|
7
|
+
|
|
8
|
+
export const Switch = copyComponentProperties(RNGHSwitch, (props: SwitchProps) => {
|
|
9
|
+
const state = {
|
|
10
|
+
isDisabled: Boolean(props.disabled),
|
|
11
|
+
} satisfies ComponentState
|
|
12
|
+
const style = useStyle(props.className, state)
|
|
13
|
+
const trackColorOn = useUniwindAccent(props.trackColorOnClassName, state)
|
|
14
|
+
const trackColorOff = useUniwindAccent(props.trackColorOffClassName, state)
|
|
15
|
+
const thumbColor = useUniwindAccent(props.thumbColorClassName, state)
|
|
16
|
+
const ios_backgroundColor = useUniwindAccent(props.ios_backgroundColorClassName, state)
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<RNGHSwitch
|
|
20
|
+
{...props}
|
|
21
|
+
style={[style, props.style]}
|
|
22
|
+
thumbColor={props.thumbColor ?? thumbColor}
|
|
23
|
+
trackColor={{ true: props.trackColor?.true ?? trackColorOn, false: props.trackColor?.false ?? trackColorOff }}
|
|
24
|
+
ios_backgroundColor={props.ios_backgroundColor ?? ios_backgroundColor}
|
|
25
|
+
/>
|
|
26
|
+
)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export default Switch
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { TextProps } from 'react-native'
|
|
3
|
+
import { Text as RNGHText } from 'react-native-gesture-handler'
|
|
4
|
+
import { ComponentState } from '../../../core/types'
|
|
5
|
+
import { useUniwindAccent } from '../../../hooks/useUniwindAccent.native'
|
|
6
|
+
import { copyComponentProperties } from '../../utils'
|
|
7
|
+
import { useStyle } from '../useStyle'
|
|
8
|
+
|
|
9
|
+
type StyleWithWebkitLineClamp = {
|
|
10
|
+
WebkitLineClamp?: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Text = copyComponentProperties(RNGHText, (props: TextProps) => {
|
|
14
|
+
const [isPressed, setIsPressed] = useState(false)
|
|
15
|
+
const state = {
|
|
16
|
+
isPressed,
|
|
17
|
+
isDisabled: Boolean(props.disabled),
|
|
18
|
+
} satisfies ComponentState
|
|
19
|
+
const style = useStyle(props.className, state)
|
|
20
|
+
const selectionColor = useUniwindAccent(props.selectionColorClassName, state)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<RNGHText
|
|
24
|
+
{...props}
|
|
25
|
+
style={[style, props.style]}
|
|
26
|
+
selectionColor={props.selectionColor ?? selectionColor}
|
|
27
|
+
numberOfLines={(style as StyleWithWebkitLineClamp).WebkitLineClamp ?? props.numberOfLines}
|
|
28
|
+
onPressIn={event => {
|
|
29
|
+
setIsPressed(true)
|
|
30
|
+
props.onPressIn?.(event)
|
|
31
|
+
}}
|
|
32
|
+
onPressOut={event => {
|
|
33
|
+
setIsPressed(false)
|
|
34
|
+
props.onPressOut?.(event)
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export default Text
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { TextInputProps } from 'react-native'
|
|
3
|
+
import { TextInput as RNGHTextInput } from 'react-native-gesture-handler'
|
|
4
|
+
import { ComponentState } from '../../../core/types'
|
|
5
|
+
import { useUniwindAccent } from '../../../hooks/useUniwindAccent.native'
|
|
6
|
+
import { copyComponentProperties } from '../../utils'
|
|
7
|
+
import { useStyle } from '../useStyle'
|
|
8
|
+
|
|
9
|
+
export const TextInput = copyComponentProperties(RNGHTextInput, (props: TextInputProps) => {
|
|
10
|
+
const [isFocused, setIsFocused] = useState(false)
|
|
11
|
+
const [isPressed, setIsPressed] = useState(false)
|
|
12
|
+
const state = {
|
|
13
|
+
isDisabled: props.editable === false,
|
|
14
|
+
isFocused,
|
|
15
|
+
isPressed,
|
|
16
|
+
} satisfies ComponentState
|
|
17
|
+
const style = useStyle(props.className, state)
|
|
18
|
+
const cursorColor = useUniwindAccent(props.cursorColorClassName, state)
|
|
19
|
+
const selectionColor = useUniwindAccent(props.selectionColorClassName, state)
|
|
20
|
+
const placeholderTextColor = useUniwindAccent(props.placeholderTextColorClassName, state)
|
|
21
|
+
const selectionHandleColor = useUniwindAccent(props.selectionHandleColorClassName, state)
|
|
22
|
+
const underlineColorAndroid = useUniwindAccent(props.underlineColorAndroidClassName, state)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<RNGHTextInput
|
|
26
|
+
{...props}
|
|
27
|
+
style={[style, props.style]}
|
|
28
|
+
cursorColor={props.cursorColor ?? cursorColor}
|
|
29
|
+
selectionColor={props.selectionColor ?? selectionColor}
|
|
30
|
+
placeholderTextColor={props.placeholderTextColor ?? placeholderTextColor}
|
|
31
|
+
selectionHandleColor={props.selectionHandleColor ?? selectionHandleColor}
|
|
32
|
+
underlineColorAndroid={props.underlineColorAndroid ?? underlineColorAndroid}
|
|
33
|
+
onFocus={event => {
|
|
34
|
+
setIsFocused(true)
|
|
35
|
+
props.onFocus?.(event)
|
|
36
|
+
}}
|
|
37
|
+
onBlur={event => {
|
|
38
|
+
setIsFocused(false)
|
|
39
|
+
props.onBlur?.(event)
|
|
40
|
+
}}
|
|
41
|
+
onPressIn={event => {
|
|
42
|
+
setIsPressed(true)
|
|
43
|
+
props.onPressIn?.(event)
|
|
44
|
+
}}
|
|
45
|
+
onPressOut={event => {
|
|
46
|
+
setIsPressed(false)
|
|
47
|
+
props.onPressOut?.(event)
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
export default TextInput
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { TouchableNativeFeedbackProps } from 'react-native'
|
|
3
|
+
import { TouchableNativeFeedback as RNGHTouchableNativeFeedback } from 'react-native-gesture-handler'
|
|
4
|
+
import { ComponentState } from '../../../core/types'
|
|
5
|
+
import { copyComponentProperties } from '../../utils'
|
|
6
|
+
import { useStyle } from '../useStyle'
|
|
7
|
+
|
|
8
|
+
export const TouchableNativeFeedback = copyComponentProperties(
|
|
9
|
+
RNGHTouchableNativeFeedback,
|
|
10
|
+
(props: TouchableNativeFeedbackProps) => {
|
|
11
|
+
const [isPressed, setIsPressed] = useState(false)
|
|
12
|
+
const state = {
|
|
13
|
+
isDisabled: Boolean(props.disabled),
|
|
14
|
+
isPressed,
|
|
15
|
+
} satisfies ComponentState
|
|
16
|
+
const style = useStyle(props.className, state)
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<RNGHTouchableNativeFeedback
|
|
20
|
+
{...props}
|
|
21
|
+
style={[style, props.style]}
|
|
22
|
+
onPressIn={event => {
|
|
23
|
+
setIsPressed(true)
|
|
24
|
+
props.onPressIn?.(event)
|
|
25
|
+
}}
|
|
26
|
+
onPressOut={event => {
|
|
27
|
+
setIsPressed(false)
|
|
28
|
+
props.onPressOut?.(event)
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
export default TouchableNativeFeedback
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { TouchableOpacity as RNGHTouchableOpacity, TouchableOpacityProps } from 'react-native-gesture-handler'
|
|
3
|
+
import { ComponentState } from '../../../core/types'
|
|
4
|
+
import { copyComponentProperties } from '../../utils'
|
|
5
|
+
import { useStyle } from '../useStyle'
|
|
6
|
+
|
|
7
|
+
export const TouchableOpacity = copyComponentProperties(
|
|
8
|
+
RNGHTouchableOpacity,
|
|
9
|
+
(props: TouchableOpacityProps) => {
|
|
10
|
+
const [isPressed, setIsPressed] = useState(false)
|
|
11
|
+
const state = {
|
|
12
|
+
isDisabled: Boolean(props.disabled),
|
|
13
|
+
isPressed,
|
|
14
|
+
} satisfies ComponentState
|
|
15
|
+
const style = useStyle(props.className, state)
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<RNGHTouchableOpacity
|
|
19
|
+
{...props}
|
|
20
|
+
style={[style, props.style]}
|
|
21
|
+
onPressIn={() => {
|
|
22
|
+
setIsPressed(true)
|
|
23
|
+
props.onPressIn?.()
|
|
24
|
+
}}
|
|
25
|
+
onPressOut={() => {
|
|
26
|
+
setIsPressed(false)
|
|
27
|
+
props.onPressOut?.()
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
},
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
export default TouchableOpacity
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
TouchableWithoutFeedback as RNGHTouchableWithoutFeedback,
|
|
4
|
+
TouchableWithoutFeedbackProps,
|
|
5
|
+
} from 'react-native-gesture-handler'
|
|
6
|
+
import { ComponentState } from '../../../core/types'
|
|
7
|
+
import { copyComponentProperties } from '../../utils'
|
|
8
|
+
import { useStyle } from '../useStyle'
|
|
9
|
+
|
|
10
|
+
export const TouchableWithoutFeedback = copyComponentProperties(
|
|
11
|
+
RNGHTouchableWithoutFeedback,
|
|
12
|
+
(props: TouchableWithoutFeedbackProps) => {
|
|
13
|
+
const [isPressed, setIsPressed] = useState(false)
|
|
14
|
+
const state = {
|
|
15
|
+
isDisabled: Boolean(props.disabled),
|
|
16
|
+
isPressed,
|
|
17
|
+
} satisfies ComponentState
|
|
18
|
+
const style = useStyle(props.className, state)
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<RNGHTouchableWithoutFeedback
|
|
22
|
+
{...props}
|
|
23
|
+
style={[style, props.style]}
|
|
24
|
+
onPressIn={() => {
|
|
25
|
+
setIsPressed(true)
|
|
26
|
+
props.onPressIn?.()
|
|
27
|
+
}}
|
|
28
|
+
onPressOut={() => {
|
|
29
|
+
setIsPressed(false)
|
|
30
|
+
props.onPressOut?.()
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
},
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
export default TouchableWithoutFeedback
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
get BaseButton() {
|
|
3
|
+
return require('./BaseButton').BaseButton
|
|
4
|
+
},
|
|
5
|
+
get BorderlessButton() {
|
|
6
|
+
return require('./BorderlessButton').BorderlessButton
|
|
7
|
+
},
|
|
8
|
+
get DrawerLayoutAndroid() {
|
|
9
|
+
return require('./DrawerLayoutAndroid').DrawerLayoutAndroid
|
|
10
|
+
},
|
|
11
|
+
get FlatList() {
|
|
12
|
+
return require('./FlatList').FlatList
|
|
13
|
+
},
|
|
14
|
+
get GestureHandlerRootView() {
|
|
15
|
+
return require('./GestureHandlerRootView').GestureHandlerRootView
|
|
16
|
+
},
|
|
17
|
+
get Pressable() {
|
|
18
|
+
return require('./Pressable').Pressable
|
|
19
|
+
},
|
|
20
|
+
get PureNativeButton() {
|
|
21
|
+
return require('./PureNativeButton').PureNativeButton
|
|
22
|
+
},
|
|
23
|
+
get RawButton() {
|
|
24
|
+
return require('./RawButton').RawButton
|
|
25
|
+
},
|
|
26
|
+
get RectButton() {
|
|
27
|
+
return require('./RectButton').RectButton
|
|
28
|
+
},
|
|
29
|
+
get RefreshControl() {
|
|
30
|
+
return require('./RefreshControl').RefreshControl
|
|
31
|
+
},
|
|
32
|
+
get ScrollView() {
|
|
33
|
+
return require('./ScrollView').ScrollView
|
|
34
|
+
},
|
|
35
|
+
get Switch() {
|
|
36
|
+
return require('./Switch').Switch
|
|
37
|
+
},
|
|
38
|
+
get Text() {
|
|
39
|
+
return require('./Text').Text
|
|
40
|
+
},
|
|
41
|
+
get TextInput() {
|
|
42
|
+
return require('./TextInput').TextInput
|
|
43
|
+
},
|
|
44
|
+
get TouchableNativeFeedback() {
|
|
45
|
+
return require('./TouchableNativeFeedback').TouchableNativeFeedback
|
|
46
|
+
},
|
|
47
|
+
get TouchableOpacity() {
|
|
48
|
+
return require('./TouchableOpacity').TouchableOpacity
|
|
49
|
+
},
|
|
50
|
+
get TouchableWithoutFeedback() {
|
|
51
|
+
return require('./TouchableWithoutFeedback').TouchableWithoutFeedback
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// Re-export non-component exports from react-native-gesture-handler
|
|
55
|
+
get DrawerLayout() {
|
|
56
|
+
return require('react-native-gesture-handler').DrawerLayout
|
|
57
|
+
},
|
|
58
|
+
get Swipeable() {
|
|
59
|
+
return require('react-native-gesture-handler').Swipeable
|
|
60
|
+
},
|
|
61
|
+
get TouchableHighlight() {
|
|
62
|
+
return require('react-native-gesture-handler').TouchableHighlight
|
|
63
|
+
},
|
|
64
|
+
get Directions() {
|
|
65
|
+
return require('react-native-gesture-handler').Directions
|
|
66
|
+
},
|
|
67
|
+
get State() {
|
|
68
|
+
return require('react-native-gesture-handler').State
|
|
69
|
+
},
|
|
70
|
+
get PointerType() {
|
|
71
|
+
return require('react-native-gesture-handler').PointerType
|
|
72
|
+
},
|
|
73
|
+
get gestureHandlerRootHOC() {
|
|
74
|
+
return require('react-native-gesture-handler').gestureHandlerRootHOC
|
|
75
|
+
},
|
|
76
|
+
get GestureDetector() {
|
|
77
|
+
return require('react-native-gesture-handler').GestureDetector
|
|
78
|
+
},
|
|
79
|
+
get Gesture() {
|
|
80
|
+
return require('react-native-gesture-handler').Gesture
|
|
81
|
+
},
|
|
82
|
+
get TapGestureHandler() {
|
|
83
|
+
return require('react-native-gesture-handler').TapGestureHandler
|
|
84
|
+
},
|
|
85
|
+
get ForceTouchGestureHandler() {
|
|
86
|
+
return require('react-native-gesture-handler').ForceTouchGestureHandler
|
|
87
|
+
},
|
|
88
|
+
get LongPressGestureHandler() {
|
|
89
|
+
return require('react-native-gesture-handler').LongPressGestureHandler
|
|
90
|
+
},
|
|
91
|
+
get PanGestureHandler() {
|
|
92
|
+
return require('react-native-gesture-handler').PanGestureHandler
|
|
93
|
+
},
|
|
94
|
+
get PinchGestureHandler() {
|
|
95
|
+
return require('react-native-gesture-handler').PinchGestureHandler
|
|
96
|
+
},
|
|
97
|
+
get RotationGestureHandler() {
|
|
98
|
+
return require('react-native-gesture-handler').RotationGestureHandler
|
|
99
|
+
},
|
|
100
|
+
get FlingGestureHandler() {
|
|
101
|
+
return require('react-native-gesture-handler').FlingGestureHandler
|
|
102
|
+
},
|
|
103
|
+
get createNativeWrapper() {
|
|
104
|
+
return require('react-native-gesture-handler').createNativeWrapper
|
|
105
|
+
},
|
|
106
|
+
get NativeViewGestureHandler() {
|
|
107
|
+
return require('react-native-gesture-handler').NativeViewGestureHandler
|
|
108
|
+
},
|
|
109
|
+
get HoverEffect() {
|
|
110
|
+
return require('react-native-gesture-handler').HoverEffect
|
|
111
|
+
},
|
|
112
|
+
get MouseButton() {
|
|
113
|
+
return require('react-native-gesture-handler').MouseButton
|
|
114
|
+
},
|
|
115
|
+
get enableExperimentalWebImplementation() {
|
|
116
|
+
return require('react-native-gesture-handler').enableExperimentalWebImplementation
|
|
117
|
+
},
|
|
118
|
+
get enableLegacyWebImplementation() {
|
|
119
|
+
return require('react-native-gesture-handler').enableLegacyWebImplementation
|
|
120
|
+
},
|
|
121
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Svg as RNSvg, SvgProps } from 'react-native-svg'
|
|
2
|
+
import { copyComponentProperties } from '../../utils'
|
|
3
|
+
import { useStyle } from '../useStyle'
|
|
4
|
+
|
|
5
|
+
export const Svg = copyComponentProperties(RNSvg, (props: SvgProps) => {
|
|
6
|
+
const style = useStyle(props.className)
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<RNSvg
|
|
10
|
+
{...props}
|
|
11
|
+
style={[style, props.style]}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export default Svg
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Appearance, Dimensions, I18nManager, PixelRatio, StyleSheet } from 'react-native'
|
|
2
|
+
import { initialWindowMetrics } from 'react-native-safe-area-context'
|
|
2
3
|
import { ColorScheme, Orientation } from '../../types'
|
|
3
4
|
import type { UniwindRuntime as UniwindRuntimeType } from '../types'
|
|
4
5
|
import { colorMix, lightDark } from './native-utils'
|
|
@@ -17,12 +18,7 @@ export const UniwindRuntime = {
|
|
|
17
18
|
fontScale: value => value * PixelRatio.getFontScale(),
|
|
18
19
|
hairlineWidth: StyleSheet.hairlineWidth,
|
|
19
20
|
rtl: I18nManager.isRTL,
|
|
20
|
-
insets: {
|
|
21
|
-
top: 0,
|
|
22
|
-
left: 0,
|
|
23
|
-
bottom: 0,
|
|
24
|
-
right: 0,
|
|
25
|
-
},
|
|
21
|
+
insets: initialWindowMetrics?.insets ?? { top: 0, left: 0, bottom: 0, right: 0 },
|
|
26
22
|
colorMix,
|
|
27
23
|
pixelRatio: value => value * PixelRatio.get(),
|
|
28
24
|
cubicBezier: () => '',
|