@niibase/uniwind 1.0.0 → 1.0.11
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/react-native-gesture-handler/index.js +122 -0
- package/dist/common/components/react-native-gesture-handler/native/BaseButton.js +18 -0
- package/dist/common/components/react-native-gesture-handler/native/BorderlessButton.js +18 -0
- package/dist/common/components/react-native-gesture-handler/native/DrawerLayoutAndroid.js +18 -0
- package/dist/common/components/react-native-gesture-handler/native/FlatList.js +30 -0
- package/dist/common/components/react-native-gesture-handler/native/GestureHandlerRootView.js +18 -0
- package/dist/common/components/react-native-gesture-handler/native/Pressable.js +29 -0
- package/dist/common/components/react-native-gesture-handler/native/PureNativeButton.js +18 -0
- package/dist/common/components/react-native-gesture-handler/native/RawButton.js +18 -0
- package/dist/common/components/react-native-gesture-handler/native/RectButton.js +18 -0
- package/dist/common/components/react-native-gesture-handler/native/RefreshControl.js +27 -0
- package/dist/common/components/react-native-gesture-handler/native/ScrollView.js +23 -0
- package/dist/common/components/react-native-gesture-handler/native/Switch.js +32 -0
- package/dist/common/components/react-native-gesture-handler/native/Text.js +36 -0
- package/dist/common/components/react-native-gesture-handler/native/TextInput.js +53 -0
- package/dist/common/components/react-native-gesture-handler/native/TouchableNativeFeedback.js +32 -0
- package/dist/common/components/react-native-gesture-handler/native/TouchableOpacity.js +32 -0
- package/dist/common/components/react-native-gesture-handler/native/TouchableWithoutFeedback.js +32 -0
- package/dist/common/components/react-native-svg/index.js +14 -0
- package/dist/common/components/react-native-svg/native/Svg.js +18 -0
- package/dist/common/components/react-native-svg/web/Svg.js +17 -0
- package/dist/common/core/native/runtime.js +2 -1
- package/dist/common/core/native/store.js +33 -3
- package/dist/metro/index.cjs +22 -6
- package/dist/metro/index.mjs +20 -4
- package/dist/metro/metro-transformer.cjs +56 -19
- package/dist/metro/metro-transformer.mjs +56 -19
- package/dist/module/components/react-native-gesture-handler/index.d.ts +0 -0
- package/dist/module/components/react-native-gesture-handler/index.js +120 -0
- package/dist/module/components/react-native-gesture-handler/native/BaseButton.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/BaseButton.js +15 -0
- package/dist/module/components/react-native-gesture-handler/native/BorderlessButton.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/BorderlessButton.js +18 -0
- package/dist/module/components/react-native-gesture-handler/native/DrawerLayoutAndroid.d.ts +5 -0
- package/dist/module/components/react-native-gesture-handler/native/DrawerLayoutAndroid.js +18 -0
- package/dist/module/components/react-native-gesture-handler/native/FlatList.d.ts +4 -0
- package/dist/module/components/react-native-gesture-handler/native/FlatList.js +27 -0
- package/dist/module/components/react-native-gesture-handler/native/GestureHandlerRootView.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/GestureHandlerRootView.js +18 -0
- package/dist/module/components/react-native-gesture-handler/native/Pressable.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/Pressable.js +29 -0
- package/dist/module/components/react-native-gesture-handler/native/PureNativeButton.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/PureNativeButton.js +15 -0
- package/dist/module/components/react-native-gesture-handler/native/RawButton.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/RawButton.js +15 -0
- package/dist/module/components/react-native-gesture-handler/native/RectButton.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/RectButton.js +15 -0
- package/dist/module/components/react-native-gesture-handler/native/RefreshControl.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/RefreshControl.js +24 -0
- package/dist/module/components/react-native-gesture-handler/native/ScrollView.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/ScrollView.js +20 -0
- package/dist/module/components/react-native-gesture-handler/native/Switch.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/Switch.js +26 -0
- package/dist/module/components/react-native-gesture-handler/native/Text.d.ts +2 -0
- package/dist/module/components/react-native-gesture-handler/native/Text.js +33 -0
- package/dist/module/components/react-native-gesture-handler/native/TextInput.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/TextInput.js +50 -0
- package/dist/module/components/react-native-gesture-handler/native/TouchableNativeFeedback.d.ts +2 -0
- package/dist/module/components/react-native-gesture-handler/native/TouchableNativeFeedback.js +32 -0
- package/dist/module/components/react-native-gesture-handler/native/TouchableOpacity.d.ts +3 -0
- package/dist/module/components/react-native-gesture-handler/native/TouchableOpacity.js +32 -0
- package/dist/module/components/react-native-gesture-handler/native/TouchableWithoutFeedback.d.ts +4 -0
- package/dist/module/components/react-native-gesture-handler/native/TouchableWithoutFeedback.js +34 -0
- package/dist/module/components/react-native-svg/index.d.ts +1 -0
- package/dist/module/components/react-native-svg/index.js +10 -0
- package/dist/module/components/react-native-svg/native/Svg.d.ts +3 -0
- package/dist/module/components/react-native-svg/native/Svg.js +15 -0
- package/dist/module/components/react-native-svg/web/Svg.d.ts +3 -0
- package/dist/module/components/react-native-svg/web/Svg.js +14 -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/react-native-gesture-handler/index.ts +121 -0
- package/src/components/react-native-gesture-handler/native/BaseButton.tsx +18 -0
- package/src/components/react-native-gesture-handler/native/BorderlessButton.tsx +19 -0
- package/src/components/react-native-gesture-handler/native/DrawerLayoutAndroid.tsx +20 -0
- package/src/components/react-native-gesture-handler/native/FlatList.tsx +29 -0
- package/src/components/react-native-gesture-handler/native/GestureHandlerRootView.tsx +20 -0
- package/src/components/react-native-gesture-handler/native/Pressable.tsx +31 -0
- package/src/components/react-native-gesture-handler/native/PureNativeButton.tsx +16 -0
- package/src/components/react-native-gesture-handler/native/RawButton.tsx +16 -0
- package/src/components/react-native-gesture-handler/native/RectButton.tsx +16 -0
- package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +26 -0
- package/src/components/react-native-gesture-handler/native/ScrollView.tsx +22 -0
- package/src/components/react-native-gesture-handler/native/Switch.tsx +29 -0
- package/src/components/react-native-gesture-handler/native/Text.tsx +40 -0
- package/src/components/react-native-gesture-handler/native/TextInput.tsx +53 -0
- package/src/components/react-native-gesture-handler/native/TouchableNativeFeedback.tsx +35 -0
- package/src/components/react-native-gesture-handler/native/TouchableOpacity.tsx +34 -0
- package/src/components/react-native-gesture-handler/native/TouchableWithoutFeedback.tsx +37 -0
- package/src/components/react-native-svg/index.ts +12 -0
- package/src/components/react-native-svg/native/Svg.tsx +16 -0
- package/src/components/react-native-svg/web/Svg.tsx +14 -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 +25 -3
- 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
|
@@ -9,6 +9,7 @@ class UniwindStoreBuilder {
|
|
|
9
9
|
vars = {};
|
|
10
10
|
runtimeThemeVariables = /* @__PURE__ */ new Map();
|
|
11
11
|
stylesheet = {};
|
|
12
|
+
varsWithMediaQueries = [];
|
|
12
13
|
cache = /* @__PURE__ */ new Map();
|
|
13
14
|
generateStyleSheetCallbackResult = null;
|
|
14
15
|
getStyles(className, state) {
|
|
@@ -36,10 +37,11 @@ class UniwindStoreBuilder {
|
|
|
36
37
|
if (!config) {
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
const { scopedVars, stylesheet, vars } = config;
|
|
40
|
+
const { scopedVars, stylesheet, vars, varsWithMediaQueries } = config;
|
|
41
|
+
this.vars = varsWithMediaQueries.length > 0 ? { ...vars } : vars;
|
|
42
|
+
this.varsWithMediaQueries = varsWithMediaQueries;
|
|
40
43
|
this.generateStyleSheetCallbackResult = config;
|
|
41
44
|
this.stylesheet = stylesheet;
|
|
42
|
-
this.vars = vars;
|
|
43
45
|
const themeVars = scopedVars[`__uniwind-theme-${this.runtime.currentThemeName}`];
|
|
44
46
|
const platformVars = scopedVars[`__uniwind-platform-${Platform.OS}`];
|
|
45
47
|
const runtimeThemeVars = this.runtimeThemeVariables.get(this.runtime.currentThemeName);
|
|
@@ -56,11 +58,36 @@ class UniwindStoreBuilder {
|
|
|
56
58
|
UniwindListener.notifyAll();
|
|
57
59
|
}
|
|
58
60
|
};
|
|
61
|
+
resolveMediaQueryVars(dependencies) {
|
|
62
|
+
for (const [varName, mqVariants] of this.varsWithMediaQueries) {
|
|
63
|
+
let bestMatch = null;
|
|
64
|
+
for (const variant of mqVariants) {
|
|
65
|
+
if (variant.orientation !== null) dependencies.add(StyleDependency.Orientation);
|
|
66
|
+
if (variant.maxWidth !== null || variant.minWidth !== null) dependencies.add(StyleDependency.Dimensions);
|
|
67
|
+
if (variant.colorScheme !== null) {
|
|
68
|
+
dependencies.add(StyleDependency.ColorScheme);
|
|
69
|
+
dependencies.add(StyleDependency.Theme);
|
|
70
|
+
}
|
|
71
|
+
if (variant.minWidth !== null && variant.minWidth > this.runtime.screen.width || variant.maxWidth !== null && variant.maxWidth !== Number.MAX_VALUE && variant.maxWidth < this.runtime.screen.width || variant.orientation !== null && this.runtime.orientation !== variant.orientation || variant.colorScheme !== null && this.runtime.currentThemeName !== variant.colorScheme) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (bestMatch === null || (variant.minWidth ?? 0) > (bestMatch.minWidth ?? 0)) bestMatch = variant;
|
|
75
|
+
}
|
|
76
|
+
if (bestMatch !== null) {
|
|
77
|
+
Object.defineProperty(this.vars, varName, {
|
|
78
|
+
configurable: true,
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: () => bestMatch.value
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return this.vars;
|
|
85
|
+
}
|
|
59
86
|
resolveStyles(classNames, state) {
|
|
60
87
|
const result = {};
|
|
61
|
-
let vars = this.vars;
|
|
62
88
|
const dependencies = /* @__PURE__ */ new Set();
|
|
63
89
|
const bestBreakpoints = /* @__PURE__ */ new Map();
|
|
90
|
+
let vars = this.resolveMediaQueryVars(dependencies);
|
|
64
91
|
for (const className of classNames.split(" ")) {
|
|
65
92
|
if (!(className in this.stylesheet)) {
|
|
66
93
|
continue;
|
|
@@ -22,6 +22,16 @@ export type GenerateStyleSheetsCallback = (rt: UniwindRuntime) => {
|
|
|
22
22
|
stylesheet: StyleSheets;
|
|
23
23
|
vars: Record<string, unknown>;
|
|
24
24
|
scopedVars: Partial<Record<string, Record<string, unknown>>>;
|
|
25
|
+
varsWithMediaQueries: Array<[
|
|
26
|
+
string,
|
|
27
|
+
Array<{
|
|
28
|
+
value: unknown;
|
|
29
|
+
minWidth: number | null;
|
|
30
|
+
maxWidth: number | null;
|
|
31
|
+
orientation: Orientation | null;
|
|
32
|
+
colorScheme: ColorScheme | null;
|
|
33
|
+
}>
|
|
34
|
+
]>;
|
|
25
35
|
};
|
|
26
36
|
type UserThemes = UniwindConfig extends {
|
|
27
37
|
themes: infer T extends readonly string[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@niibase/uniwind",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.11",
|
|
5
5
|
"description": "The fastest Tailwind bindings for React Native",
|
|
6
6
|
"homepage": "https://uniwind.dev",
|
|
7
7
|
"author": "Unistack",
|
|
@@ -84,6 +84,8 @@
|
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"react": ">=19.0.0",
|
|
86
86
|
"react-native": ">=0.81.0",
|
|
87
|
+
"react-native-gesture-handler": ">=2.28.0",
|
|
88
|
+
"react-native-svg": ">=15.15.1",
|
|
87
89
|
"tailwindcss": ">=4"
|
|
88
90
|
},
|
|
89
91
|
"devDependencies": {
|
|
@@ -96,6 +98,9 @@
|
|
|
96
98
|
"unbuild": "3.6.1",
|
|
97
99
|
"vite": "7.2.7",
|
|
98
100
|
"jest": "30.2.0",
|
|
101
|
+
"react-native-gesture-handler": "2.28.0",
|
|
102
|
+
"react-native-safe-area-context": "5.6.0",
|
|
103
|
+
"react-native-svg": "15.15.1",
|
|
99
104
|
"react-test-renderer": "19.1.0",
|
|
100
105
|
"@react-native/babel-preset": "0.83.0",
|
|
101
106
|
"@testing-library/jest-native": "5.4.3",
|
package/readme.md
CHANGED
|
@@ -25,6 +25,9 @@ bun add @niibase/uniwind tailwindcss
|
|
|
25
25
|
|
|
26
26
|
# Or install from the original package
|
|
27
27
|
bun add uniwind tailwindcss
|
|
28
|
+
|
|
29
|
+
# Or install @niibase/uniwind as alias for uniwind
|
|
30
|
+
bun add uniwind@npm:@niibase/uniwind tailwindcss
|
|
28
31
|
```
|
|
29
32
|
|
|
30
33
|
Then follow [installation guides](https://docs.uniwind.dev/quickstart)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
get BaseButton() {
|
|
3
|
+
return require('./native/BaseButton').BaseButton
|
|
4
|
+
},
|
|
5
|
+
get BorderlessButton() {
|
|
6
|
+
return require('./native/BorderlessButton').BorderlessButton
|
|
7
|
+
},
|
|
8
|
+
get DrawerLayoutAndroid() {
|
|
9
|
+
return require('./native/DrawerLayoutAndroid').DrawerLayoutAndroid
|
|
10
|
+
},
|
|
11
|
+
get FlatList() {
|
|
12
|
+
return require('./native/FlatList').FlatList
|
|
13
|
+
},
|
|
14
|
+
get GestureHandlerRootView() {
|
|
15
|
+
return require('./native/GestureHandlerRootView').GestureHandlerRootView
|
|
16
|
+
},
|
|
17
|
+
get Pressable() {
|
|
18
|
+
return require('./native/Pressable').Pressable
|
|
19
|
+
},
|
|
20
|
+
get PureNativeButton() {
|
|
21
|
+
return require('./native/PureNativeButton').PureNativeButton
|
|
22
|
+
},
|
|
23
|
+
get RawButton() {
|
|
24
|
+
return require('./native/RawButton').RawButton
|
|
25
|
+
},
|
|
26
|
+
get RectButton() {
|
|
27
|
+
return require('./native/RectButton').RectButton
|
|
28
|
+
},
|
|
29
|
+
get RefreshControl() {
|
|
30
|
+
return require('./native/RefreshControl').RefreshControl
|
|
31
|
+
},
|
|
32
|
+
get ScrollView() {
|
|
33
|
+
return require('./native/ScrollView').ScrollView
|
|
34
|
+
},
|
|
35
|
+
get Switch() {
|
|
36
|
+
return require('./native/Switch').Switch
|
|
37
|
+
},
|
|
38
|
+
get Text() {
|
|
39
|
+
return require('./native/Text').Text
|
|
40
|
+
},
|
|
41
|
+
get TextInput() {
|
|
42
|
+
return require('./native/TextInput').TextInput
|
|
43
|
+
},
|
|
44
|
+
get TouchableNativeFeedback() {
|
|
45
|
+
return require('./native/TouchableNativeFeedback').TouchableNativeFeedback
|
|
46
|
+
},
|
|
47
|
+
get TouchableOpacity() {
|
|
48
|
+
return require('./native/TouchableOpacity').TouchableOpacity
|
|
49
|
+
},
|
|
50
|
+
get TouchableWithoutFeedback() {
|
|
51
|
+
return require('./native/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,18 @@
|
|
|
1
|
+
import { BaseButton as RNGHBaseButton, BaseButtonProps } from 'react-native-gesture-handler'
|
|
2
|
+
import { useStyle } from '../../native/useStyle'
|
|
3
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
3
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
4
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
5
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
4
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
4
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
3
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
3
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
3
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
5
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
5
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
6
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
7
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
7
|
+
import { copyComponentProperties } from '../../utils'
|
|
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 { useStyle } from '../../native/useStyle'
|
|
6
|
+
import { copyComponentProperties } from '../../utils'
|
|
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
|