@prototyp/skeletor 1.0.12 → 1.0.15
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/README.md +84 -80
- package/lib/module/components/Block/Block.js +35 -17
- package/lib/module/components/Block/Block.js.map +1 -1
- package/lib/module/components/InputFocusScrollView/InputFocusScrollView.js +23 -8
- package/lib/module/components/InputFocusScrollView/InputFocusScrollView.js.map +1 -1
- package/lib/module/components/Screen/Screen.js +11 -19
- package/lib/module/components/Screen/Screen.js.map +1 -1
- package/lib/module/components/Text/Text.js +6 -2
- package/lib/module/components/Text/Text.js.map +1 -1
- package/lib/module/utils/animations.js +69 -72
- package/lib/module/utils/animations.js.map +1 -1
- package/lib/module/utils/extractGapProperties.js +20 -0
- package/lib/module/utils/extractGapProperties.js.map +1 -0
- package/lib/module/utils/index.js +1 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/components/Block/Block.d.ts +13 -11
- package/lib/typescript/components/Block/Block.d.ts.map +1 -1
- package/lib/typescript/components/InputFocusScrollView/InputFocusScrollView.d.ts +9 -1
- package/lib/typescript/components/InputFocusScrollView/InputFocusScrollView.d.ts.map +1 -1
- package/lib/typescript/components/Screen/Screen.d.ts +2 -3
- package/lib/typescript/components/Screen/Screen.d.ts.map +1 -1
- package/lib/typescript/components/Text/Text.d.ts.map +1 -1
- package/lib/typescript/models/Animation.d.ts +8 -4
- package/lib/typescript/models/Animation.d.ts.map +1 -1
- package/lib/typescript/models/Spacing.d.ts +6 -0
- package/lib/typescript/models/Spacing.d.ts.map +1 -1
- package/lib/typescript/utils/animations.d.ts +1 -1
- package/lib/typescript/utils/animations.d.ts.map +1 -1
- package/lib/typescript/utils/extractGapProperties.d.ts +8 -0
- package/lib/typescript/utils/extractGapProperties.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +1 -0
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -54,6 +54,69 @@ const skeletor = useSkeletor();
|
|
|
54
54
|
return <SomeComponent style={{ fontFamily: skeletor.defaultFont }} />;
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
## Custom types legend
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
type Spacing = {
|
|
61
|
+
/** All margin properties from ViewStyle */
|
|
62
|
+
margins?: {...}
|
|
63
|
+
/** All padding properties from ViewStyle */
|
|
64
|
+
paddings?: {...}
|
|
65
|
+
gap?: { row?: number; col?: number } | [number, number] | number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type Alignment = {
|
|
69
|
+
align?: ViewStyle["alignItems"];
|
|
70
|
+
alignSelf?: ViewStyle["alignSelf"];
|
|
71
|
+
justify?: ViewStyle["justifyContent"];
|
|
72
|
+
flexDirection?: ViewStyle["flexDirection"];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type Border = {
|
|
76
|
+
/** All border properties from ViewStyle */
|
|
77
|
+
border: {...}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
type Flex = {
|
|
81
|
+
/** Either just a number or all flex properties from ViewStyle + gap, columnGap & rowGap for backwards compatibility */
|
|
82
|
+
flex?: number | {...}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type Offsets =
|
|
86
|
+
| [ViewStyle["top"]]
|
|
87
|
+
| [ViewStyle["top"], ViewStyle["left"]]
|
|
88
|
+
| [ViewStyle["top"], ViewStyle["left"], ViewStyle["bottom"]]
|
|
89
|
+
| [
|
|
90
|
+
ViewStyle["top"],
|
|
91
|
+
ViewStyle["left"],
|
|
92
|
+
ViewStyle["bottom"],
|
|
93
|
+
ViewStyle["right"],
|
|
94
|
+
]
|
|
95
|
+
| {
|
|
96
|
+
top?: ViewStyle["top"];
|
|
97
|
+
bottom?: ViewStyle["bottom"];
|
|
98
|
+
left?: ViewStyle["left"];
|
|
99
|
+
right?: ViewStyle["right"];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type Position = {
|
|
103
|
+
absolute?: boolean;
|
|
104
|
+
zIndex?: number;
|
|
105
|
+
offsets?: Offsets;
|
|
106
|
+
overflow?: ViewStyle["overflow"];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
type Size = {
|
|
110
|
+
width?: DimensionValue;
|
|
111
|
+
height?: DimensionValue;
|
|
112
|
+
minHeight?: DimensionValue;
|
|
113
|
+
minWidth?: DimensionValue;
|
|
114
|
+
maxHeight?: DimensionValue;
|
|
115
|
+
maxWidth?: DimensionValue;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
|
|
57
120
|
## Components
|
|
58
121
|
|
|
59
122
|
### Screen
|
|
@@ -75,7 +138,6 @@ bottomSafeAreaColor?: string;
|
|
|
75
138
|
topSafeAreaColor?: string;
|
|
76
139
|
/** Set device status bar color type. */
|
|
77
140
|
statusBarType?: "default" | "light-content" | "dark-content";
|
|
78
|
-
isLandscape?: boolean;
|
|
79
141
|
```
|
|
80
142
|
|
|
81
143
|
#### Usage
|
|
@@ -106,6 +168,10 @@ letterSpacing?: TextStyle["letterSpacing"];
|
|
|
106
168
|
color?: string;
|
|
107
169
|
textAlign?: TextStyle["textAlign"];
|
|
108
170
|
opacity?: TextStyle["opacity"];
|
|
171
|
+
...Spacing,
|
|
172
|
+
...Size,
|
|
173
|
+
...Flex,
|
|
174
|
+
...Position,
|
|
109
175
|
animations?: Partial<ViewStyle>;
|
|
110
176
|
```
|
|
111
177
|
|
|
@@ -129,84 +195,23 @@ function MyComponent() {
|
|
|
129
195
|
|
|
130
196
|
---
|
|
131
197
|
|
|
132
|
-
This is a flexible and customizable React Native component that can be used as either a `View` or a `ScrollView`. The `Block` component allows you to add paddings, margins, sizes, alignments, and borders to your layout.
|
|
198
|
+
This is a flexible and customizable React Native component that can be used as either a `View` or a `ScrollView`. The `Block` component allows you to add paddings, margins, sizes, alignments, and borders to your layout. Can be turned into a ScrollView by passing in `scrollable`. ScrollView props can be updated through `scrollProps`.
|
|
133
199
|
|
|
134
200
|
#### Props
|
|
135
201
|
|
|
136
202
|
```javascript
|
|
137
|
-
/** Determine if Block is scrollable or not
|
|
203
|
+
/** Determine if Block is scrollable or not.*/
|
|
138
204
|
scrollable?: boolean;
|
|
205
|
+
/** If scrollable, used to control ScrollView props. Some default props are applied, check JSDOC of component by hovering over it in your IDE. */
|
|
206
|
+
scrollProps?: ScrollViewProps
|
|
139
207
|
opacity?: ViewStyle["opacity"];
|
|
140
208
|
animations?: Partial<ViewStyle>;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
| [ViewStyle["top"]]
|
|
148
|
-
| [ViewStyle["top"], ViewStyle["left"]]
|
|
149
|
-
| [ViewStyle["top"], ViewStyle["left"], ViewStyle["bottom"]]
|
|
150
|
-
| [ViewStyle["top"], ViewStyle["left"], ViewStyle["bottom"], ViewStyle["right"]]
|
|
151
|
-
| {
|
|
152
|
-
top?: ViewStyle["top"];
|
|
153
|
-
bottom?: ViewStyle["bottom"];
|
|
154
|
-
left?: ViewStyle["left"];
|
|
155
|
-
right?: ViewStyle["right"];
|
|
156
|
-
};
|
|
157
|
-
align?: ViewStyle["alignItems"];
|
|
158
|
-
alignSelf?: ViewStyle["alignSelf"];
|
|
159
|
-
justify?: ViewStyle["justifyContent"];
|
|
160
|
-
flexDirection?: ViewStyle["flexDirection"];
|
|
161
|
-
flex?:
|
|
162
|
-
| number
|
|
163
|
-
| {
|
|
164
|
-
columnGap?: ViewStyle["columnGap"],
|
|
165
|
-
flex?: ViewStyle["flex"],
|
|
166
|
-
flexBasis?: ViewStyle["flexBasis"],
|
|
167
|
-
flexGrow?: ViewStyle["flexGrow"],
|
|
168
|
-
flexShrink?: ViewStyle["flexShrink"],
|
|
169
|
-
flexWrap?: ViewStyle["flexWrap"],
|
|
170
|
-
gap?: ViewStyle["gap"],
|
|
171
|
-
rowGap?: ViewStyle["rowGap"]
|
|
172
|
-
};
|
|
173
|
-
width?: number | string;
|
|
174
|
-
height?: number | string;
|
|
175
|
-
minHeight?: number | string;
|
|
176
|
-
minWidth?: number | string;
|
|
177
|
-
maxHeight?: number | string;
|
|
178
|
-
maxWidth?: number | string;
|
|
179
|
-
margins?: {
|
|
180
|
-
marginTop?: number | string;
|
|
181
|
-
marginBottom?: number | string;
|
|
182
|
-
marginLeft?: number | string;
|
|
183
|
-
marginRight?: number | string;
|
|
184
|
-
marginHorizontal?: number | string;
|
|
185
|
-
marginVertical?: number | string;
|
|
186
|
-
margin?: number | string;
|
|
187
|
-
};
|
|
188
|
-
paddings?: {
|
|
189
|
-
paddingTop?: number | string;
|
|
190
|
-
paddingBottom?: number | string;
|
|
191
|
-
paddingLeft?: number | string;
|
|
192
|
-
paddingRight?: number | string;
|
|
193
|
-
paddingHorizontal?: number | string;
|
|
194
|
-
paddingVertical?: number | string;
|
|
195
|
-
padding?: number | string;
|
|
196
|
-
};
|
|
197
|
-
border?: {
|
|
198
|
-
borderWidth?: number;
|
|
199
|
-
borderTopWidth?: number;
|
|
200
|
-
borderBottomWidth?: number;
|
|
201
|
-
borderLeftWidth?: number;
|
|
202
|
-
borderRightWidth?: number;
|
|
203
|
-
borderColor?: string;
|
|
204
|
-
borderRadius?: number;
|
|
205
|
-
borderTopLeftRadius?: number;
|
|
206
|
-
borderTopRightRadius?: number;
|
|
207
|
-
borderBottomLeftRadius?: number;
|
|
208
|
-
... // all other border-related properties
|
|
209
|
-
};
|
|
209
|
+
...Position,
|
|
210
|
+
...Alignment,
|
|
211
|
+
...Flex,
|
|
212
|
+
...Size,
|
|
213
|
+
...Spacing,
|
|
214
|
+
...Border,
|
|
210
215
|
|
|
211
216
|
```
|
|
212
217
|
|
|
@@ -233,6 +238,8 @@ This scroll view will automatically scroll to an active input field rendered ins
|
|
|
233
238
|
|
|
234
239
|
<b>NOTE</b> — This works on iOS only, Android does this by default with `android:windowSoftInputMode`
|
|
235
240
|
|
|
241
|
+
Some default props are applied, check JSDOC of component by hovering over it in your IDE.
|
|
242
|
+
|
|
236
243
|
#### Props
|
|
237
244
|
|
|
238
245
|
```javascript
|
|
@@ -241,6 +248,8 @@ This scroll view will automatically scroll to an active input field rendered ins
|
|
|
241
248
|
focusPositionOffset?: number;
|
|
242
249
|
/** Is the scrollview 100% in height or automatic. Defaults to auto. */
|
|
243
250
|
height?: "full" | "auto";
|
|
251
|
+
/** Margins are applied to ScrollView style, paddings and gap to contentContainerStyle */
|
|
252
|
+
...Spacing,
|
|
244
253
|
```
|
|
245
254
|
|
|
246
255
|
#### Usage
|
|
@@ -282,7 +291,7 @@ The concept behind this approach is to:
|
|
|
282
291
|
|
|
283
292
|
Use these methods to construct <b>element</b> animations in a super simple way. Create these animations outside the component body to avoid unnecessary re-renders and other lifecycle related issues. All animations are done via native driver, <i>except if the animation loops to avoid issues with the animation itself.</i>
|
|
284
293
|
|
|
285
|
-
`animateParallel` will animate all of the defined element styles in parallel (meaning they will all start animating at the same time). In the example below, this means that opacity, translateY and translateX will all start animating at once. Additional configuration is possible as a second parameter, where you can define the animation `duration`, `loop` and `easing`. The default configuration is `{ duration
|
|
294
|
+
`animateParallel` will animate all of the defined element styles in parallel (meaning they will all start animating at the same time). In the example below, this means that opacity, translateY and translateX will all start animating at once. Additional configuration is possible as a second parameter, where you can define the animation `duration`, `loop` and `easing`. The default configuration is `{ duration = 400, easing = Easing.inOut(Easing.ease), loop = false, native = true, }`.
|
|
286
295
|
|
|
287
296
|
Usage
|
|
288
297
|
|
|
@@ -294,7 +303,7 @@ const element1 = animateParallel({
|
|
|
294
303
|
});
|
|
295
304
|
```
|
|
296
305
|
|
|
297
|
-
`animateSequence` will animate all of the defined element styles in sequence (meaning every property will start animating only when the previous property has finished animating). In the example below, that means that opacity, translateY and translateX will animate in sequence as they are defined - opacity first, translateX second, translateY last. Additional configuration is possible as a second parameter, where you can define the animation `duration`, `loop` and `easing`. The default configuration is `{ duration
|
|
306
|
+
`animateSequence` will animate all of the defined element styles in sequence (meaning every property will start animating only when the previous property has finished animating). In the example below, that means that opacity, translateY and translateX will animate in sequence as they are defined - opacity first, translateX second, translateY last. Additional configuration is possible as a second parameter, where you can define the animation `duration`, `loop` and `easing`. The default configuration is `{ duration = 400, easing = Easing.inOut(Easing.ease), loop = false, native = true, }`.
|
|
298
307
|
|
|
299
308
|
Usage
|
|
300
309
|
|
|
@@ -306,7 +315,7 @@ const element1 = animateSequence({
|
|
|
306
315
|
});
|
|
307
316
|
```
|
|
308
317
|
|
|
309
|
-
`animateStagger` will animate all of the defined elements in the order they are defined at a staggered pace defined in the configuration object (meaning every property will start animating after an X amount of miliseconds between animation starts, in the order they are defined in). In the example below, that means that opacity, translateY and translateX will animate in sequence with a 400ms delay between them. Additional configuration is possible as a second parameter, where you can define the animation `duration`, `stagger`, `loop` and `easing`. The default configuration is `{ duration
|
|
318
|
+
`animateStagger` will animate all of the defined elements in the order they are defined at a staggered pace defined in the configuration object (meaning every property will start animating after an X amount of miliseconds between animation starts, in the order they are defined in). In the example below, that means that opacity, translateY and translateX will animate in sequence with a 400ms delay between them. Additional configuration is possible as a second parameter, where you can define the animation `duration`, `stagger`, `loop` and `easing`. The default configuration is `{ duration = 400, stagger = 200, easing = Easing.inOut(Easing.ease), loop = false, native = true, }`.
|
|
310
319
|
|
|
311
320
|
Usage
|
|
312
321
|
|
|
@@ -469,8 +478,3 @@ useAppState({ onForeground: () => Alert.alert("Foreground") });
|
|
|
469
478
|
## Contributions
|
|
470
479
|
|
|
471
480
|
Suggestions and requests welcome, contributions appreciated but will be reviewed.
|
|
472
|
-
|
|
473
|
-
## Disclaimer
|
|
474
|
-
|
|
475
|
-
Parts of this readme file were generated with ChatGPT.
|
|
476
|
-
Thank you for making documentation easy for a lazy programmer.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React, { useMemo } from "react";
|
|
3
3
|
import { Animated, ScrollView, StyleSheet } from "react-native";
|
|
4
|
-
import { extractAlignmentProperties, extractAnimationProperties, extractFlexProperties, extractPositionProperties, extractSizeProperties } from "../../utils";
|
|
4
|
+
import { extractAlignmentProperties, extractAnimationProperties, extractFlexProperties, extractGapProperties, extractPositionProperties, extractSizeProperties } from "../../utils";
|
|
5
5
|
const BlockElement = ({
|
|
6
6
|
children,
|
|
7
7
|
...props
|
|
@@ -15,10 +15,17 @@ const BlockElement = ({
|
|
|
15
15
|
overflow,
|
|
16
16
|
animations,
|
|
17
17
|
opacity,
|
|
18
|
+
flex,
|
|
19
|
+
gap,
|
|
18
20
|
...view
|
|
19
21
|
} = props;
|
|
20
22
|
const animationProps = useMemo(() => extractAnimationProperties(animations), [animations]);
|
|
21
|
-
const flexProps = useMemo(() => extractFlexProperties(
|
|
23
|
+
const flexProps = useMemo(() => extractFlexProperties({
|
|
24
|
+
flex
|
|
25
|
+
}), [flex]);
|
|
26
|
+
const gapProps = useMemo(() => extractGapProperties({
|
|
27
|
+
gap
|
|
28
|
+
}), [gap]);
|
|
22
29
|
const sizeProps = useMemo(() => extractSizeProperties(props), [props]);
|
|
23
30
|
const positionProps = useMemo(() => extractPositionProperties(props), [props]);
|
|
24
31
|
const alignmentProps = useMemo(() => extractAlignmentProperties(props), [props]);
|
|
@@ -26,39 +33,50 @@ const BlockElement = ({
|
|
|
26
33
|
backgroundColor: background,
|
|
27
34
|
overflow,
|
|
28
35
|
opacity
|
|
29
|
-
}, alignmentProps, margins, paddings, border, flexProps, sizeProps, positionProps, style]), [alignmentProps, sizeProps, background, style, overflow, margins, paddings, positionProps, flexProps, border, opacity]);
|
|
36
|
+
}, alignmentProps, margins, paddings, border, flexProps, sizeProps, positionProps, gapProps, style]), [alignmentProps, sizeProps, background, style, overflow, margins, paddings, positionProps, flexProps, gapProps, border, opacity]);
|
|
30
37
|
return /*#__PURE__*/React.createElement(Animated.View, _extends({}, view, {
|
|
31
38
|
style: [styles, animationProps]
|
|
32
39
|
}), children);
|
|
33
40
|
};
|
|
41
|
+
function isScrollable(props) {
|
|
42
|
+
return !!props.scrollable;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Can be switched to a scrollable view by passing in `scrollable`. When scrollable, control ScrollView related parameters through `scrollProps`. Default values for `scrollProps` are:
|
|
46
|
+
* @param keyboardShouldPersistTaps `handled`
|
|
47
|
+
* @param showsVerticalScrollIndicator `false`
|
|
48
|
+
* @param showsHorizontalScrollIndicator `false`
|
|
49
|
+
* @param bounces `false`
|
|
50
|
+
* @param contentContainerStyle `{ flexGrow: 1, backgroundColor: rest.background }` */
|
|
34
51
|
export const Block = ({
|
|
35
52
|
children,
|
|
36
53
|
...props
|
|
37
54
|
}) => {
|
|
55
|
+
if (!isScrollable(props)) {
|
|
56
|
+
return /*#__PURE__*/React.createElement(BlockElement, props, children);
|
|
57
|
+
}
|
|
38
58
|
const {
|
|
39
|
-
|
|
59
|
+
scrollProps,
|
|
40
60
|
...rest
|
|
41
61
|
} = props;
|
|
42
|
-
const element = () => /*#__PURE__*/React.createElement(BlockElement, rest, children);
|
|
43
|
-
if (!scrollable) {
|
|
44
|
-
return element();
|
|
45
|
-
}
|
|
46
62
|
const {
|
|
47
63
|
horizontal,
|
|
48
|
-
|
|
49
|
-
showsVerticalScrollIndicator,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
keyboardShouldPersistTaps = "handled",
|
|
65
|
+
showsVerticalScrollIndicator = false,
|
|
66
|
+
showsHorizontalScrollIndicator = false,
|
|
67
|
+
bounces = false,
|
|
68
|
+
contentContainerStyle
|
|
69
|
+
} = scrollProps || {};
|
|
70
|
+
return /*#__PURE__*/React.createElement(ScrollView, _extends({
|
|
53
71
|
horizontal: horizontal,
|
|
54
|
-
keyboardShouldPersistTaps:
|
|
72
|
+
keyboardShouldPersistTaps: keyboardShouldPersistTaps,
|
|
55
73
|
showsHorizontalScrollIndicator: showsHorizontalScrollIndicator,
|
|
56
74
|
showsVerticalScrollIndicator: showsVerticalScrollIndicator,
|
|
75
|
+
bounces: bounces,
|
|
57
76
|
contentContainerStyle: [{
|
|
58
77
|
flexGrow: 1,
|
|
59
78
|
backgroundColor: rest.background
|
|
60
|
-
}]
|
|
61
|
-
|
|
62
|
-
}, element());
|
|
79
|
+
}, contentContainerStyle]
|
|
80
|
+
}, scrollProps), /*#__PURE__*/React.createElement(BlockElement, rest, children));
|
|
63
81
|
};
|
|
64
82
|
//# sourceMappingURL=Block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","Animated","ScrollView","StyleSheet","extractAlignmentProperties","extractAnimationProperties","extractFlexProperties","extractPositionProperties","extractSizeProperties","BlockElement","children","props","border","paddings","margins","background","style","overflow","animations","opacity","view","animationProps","flexProps","sizeProps","positionProps","alignmentProps","styles","flatten","backgroundColor","createElement","View","_extends","
|
|
1
|
+
{"version":3,"names":["React","useMemo","Animated","ScrollView","StyleSheet","extractAlignmentProperties","extractAnimationProperties","extractFlexProperties","extractGapProperties","extractPositionProperties","extractSizeProperties","BlockElement","children","props","border","paddings","margins","background","style","overflow","animations","opacity","flex","gap","view","animationProps","flexProps","gapProps","sizeProps","positionProps","alignmentProps","styles","flatten","backgroundColor","createElement","View","_extends","isScrollable","scrollable","Block","scrollProps","rest","horizontal","keyboardShouldPersistTaps","showsVerticalScrollIndicator","showsHorizontalScrollIndicator","bounces","contentContainerStyle","flexGrow"],"sourceRoot":"../../src","sources":["Block.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAuBC,OAAO,QAAQ,OAAO;AACzD,SACEC,QAAQ,EACRC,UAAU,EAEVC,UAAU,QAGL,cAAc;AAWrB,SACEC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,qBAAqB,EACrBC,oBAAoB,EACpBC,yBAAyB,EACzBC,qBAAqB,QAChB,aAAa;AA8BpB,MAAM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AY,EAAK8B,IAAI,EAAG7B,QAAuB,CACtC,CAAC;AAEjB,CAAC"}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import React, { useRef, useState } from "react";
|
|
2
|
+
import React, { useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Dimensions, Platform, ScrollView, StyleSheet } from "react-native";
|
|
4
|
+
import { extractGapProperties } from "../../utils";
|
|
4
5
|
/**
|
|
5
|
-
* This scroll view will automatically scroll to an active input field rendered within it, provided you attach the onInputFocus callback to the input onFocus prop.
|
|
6
|
+
* This scroll view will automatically scroll to an active input field rendered within it, provided you attach the `onInputFocus` callback to the input onFocus prop.
|
|
6
7
|
*
|
|
7
8
|
* The return value is a lambda component, returning a callback which you attach to input fields rendered within it.
|
|
8
9
|
* @example <InputFocusScrollView>{(onInputFocus) => <TextInput onFocus={onInputFocus} ... />}</InputFocusScrollView>
|
|
9
10
|
* NOTE: This works on iOS only, Android does this by default with @param android:windowSoftInputMode
|
|
11
|
+
*
|
|
12
|
+
* Default props are:
|
|
13
|
+
* @param height `full`
|
|
14
|
+
* @param focusPositionOffset `0.3`
|
|
15
|
+
* @param showsVerticalScrollIndicator `false`
|
|
16
|
+
* @param showsHorizontalScrollIndicator `false`
|
|
17
|
+
* @param bounces `false`
|
|
18
|
+
* @param contentContainerStyle `{flexGrow: 1, paddingBottom: 30}`
|
|
10
19
|
*/
|
|
11
20
|
export const InputFocusScrollView = ({
|
|
12
21
|
children,
|
|
@@ -16,6 +25,10 @@ export const InputFocusScrollView = ({
|
|
|
16
25
|
focusPositionOffset = 0.3,
|
|
17
26
|
margins,
|
|
18
27
|
paddings,
|
|
28
|
+
gap,
|
|
29
|
+
showsVerticalScrollIndicator = false,
|
|
30
|
+
showsHorizontalScrollIndicator = false,
|
|
31
|
+
bounces = false,
|
|
19
32
|
...rest
|
|
20
33
|
}) => {
|
|
21
34
|
const screenHeight = useRef(Dimensions.get("screen").height).current;
|
|
@@ -55,18 +68,20 @@ export const InputFocusScrollView = ({
|
|
|
55
68
|
});
|
|
56
69
|
setScrollPosition(null);
|
|
57
70
|
}
|
|
71
|
+
const gapProps = useMemo(() => extractGapProperties({
|
|
72
|
+
gap
|
|
73
|
+
}), [gap]);
|
|
58
74
|
const containerStyles = StyleSheet.flatten([styles[height], margins, style]);
|
|
59
|
-
const contentStyles = StyleSheet.flatten([styles.content,
|
|
60
|
-
...paddings
|
|
61
|
-
}, contentContainerStyle]);
|
|
75
|
+
const contentStyles = StyleSheet.flatten([styles.content, paddings, gapProps, contentContainerStyle]);
|
|
62
76
|
return /*#__PURE__*/React.createElement(ScrollView, _extends({
|
|
63
77
|
ref: ref,
|
|
64
78
|
scrollToOverflowEnabled: true,
|
|
65
|
-
scrollEventThrottle:
|
|
79
|
+
scrollEventThrottle: 33,
|
|
66
80
|
onLayout: e => setScrollTarget(e.currentTarget),
|
|
67
81
|
onContentSizeChange: onContentSizeChange,
|
|
68
|
-
showsVerticalScrollIndicator:
|
|
69
|
-
showsHorizontalScrollIndicator:
|
|
82
|
+
showsVerticalScrollIndicator: showsVerticalScrollIndicator,
|
|
83
|
+
showsHorizontalScrollIndicator: showsHorizontalScrollIndicator,
|
|
84
|
+
bounces: bounces,
|
|
70
85
|
style: containerStyles,
|
|
71
86
|
contentContainerStyle: contentStyles
|
|
72
87
|
}, rest), children(onInputFocus));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useRef","useState","Dimensions","Platform","ScrollView","StyleSheet","InputFocusScrollView","children","style","contentContainerStyle","height","focusPositionOffset","margins","paddings","rest","screenHeight","get","current","ref","scrollPosition","setScrollPosition","scrollTarget","setScrollTarget","onInputFocus","e","OS","currentTarget","measureLayout","nope","top","nuuh","elementHeight","_ref$current","scrollY","undefined","scrollTo","y","console","error","onContentSizeChange","_ref$current2","animated","containerStyles","flatten","styles","contentStyles","content","createElement","_extends","scrollToOverflowEnabled","scrollEventThrottle","onLayout","
|
|
1
|
+
{"version":3,"names":["React","useMemo","useRef","useState","Dimensions","Platform","ScrollView","StyleSheet","extractGapProperties","InputFocusScrollView","children","style","contentContainerStyle","height","focusPositionOffset","margins","paddings","gap","showsVerticalScrollIndicator","showsHorizontalScrollIndicator","bounces","rest","screenHeight","get","current","ref","scrollPosition","setScrollPosition","scrollTarget","setScrollTarget","onInputFocus","e","OS","currentTarget","measureLayout","nope","top","nuuh","elementHeight","_ref$current","scrollY","undefined","scrollTo","y","console","error","onContentSizeChange","_ref$current2","animated","gapProps","containerStyles","flatten","styles","contentStyles","content","createElement","_extends","scrollToOverflowEnabled","scrollEventThrottle","onLayout","create","full","auto","flexGrow","paddingBottom"],"sourceRoot":"../../src","sources":["InputFocusScrollView.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACxD,SACEC,UAAU,EAEVC,QAAQ,EACRC,UAAU,EAEVC,UAAU,QAGL,cAAc;AAGrB,SAASC,oBAAoB,QAAQ,aAAa;AAalD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,oBAAyD,GAAGA,CAAC;EACxEC,QAAQ;EACRC,KAAK;EACLC,qBAAqB;EACrBC,MAAM,GAAG,MAAM;EACfC,mBAAmB,GAAG,GAAG;EACzBC,OAAO;EACPC,QAAQ;EACRC,GAAG;EACHC,4BAA4B,GAAG,KAAK;EACpCC,8BAA8B,GAAG,KAAK;EACtCC,OAAO,GAAG,KAAK;EACf,GAAGC;AACL,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAGpB,MAAM,CAACE,UAAU,CAACmB,GAAG,CAAC,QAAQ,CAAC,CAACV,MAAM,CAAC,CAACW,O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B;EAEA,MAAMsB,QAAQ,GAAGhD,OAAO,CAAC,MAAMO,oBAAoB,CAAC;IAAES;EAAI,CAAC,CAAC,EAAE,CAACA,GAAG,CAAC,CAAC;EACpE,MAAMiC,eAAe,GAAG3C,UAAU,CAAC4C,OAAO,CAAC,CAACC,MAAM,CAACvC,MAAM,CAAC,EAAEE,OAAO,EAAEJ,KAAK,CAAC,CAAC;EAE5E,MAAM0C,aAAa,GAAG9C,UAAU,CAAC4C,OAAO,CAAC,CACvCC,MAAM,CAACE,OAAO,EACdtC,QAAQ,EACRiC,QAAQ,EACRrC,qBAAqB,CACtB,CAAC;EAEF,oBACEZ,KAAA,CAAAuD,aAAA,CAACjD,UAAU,EAAAkD,QAAA;IACT/B,GAAG,EAAEA,GAAI;IACTgC,uBAAuB;IACvBC,mBAAmB,EAAE,EAAG;IACxBC,QAAQ,EAAE5B,CAAC,IAAIF,eAAe,CAACE,CAAC,CAACE,aAAa,CAAE;IAChDa,mBAAmB,EAAEA,mBAAoB;IACzC5B,4BAA4B,EAAEA,4BAA6B;IAC3DC,8BAA8B,EAAEA,8BAA+B;IAC/DC,OAAO,EAAEA,OAAQ;IACjBT,KAAK,EAAEuC,eAAgB;IACvBtC,qBAAqB,EAAEyC;EAAc,GACjChC,IAAI,GAEPX,QAAQ,CAACoB,YAAY,CACZ,CAAC;AAEjB,CAAC;AAED,MAAMsB,MAAM,GAAG7C,UAAU,CAACqD,MAAM,CAAC;EAC/BC,IAAI,EAAE;IAAEhD,MAAM,EAAE;EAAO,CAAC;EACxBiD,IAAI,EAAE;IAAEjD,MAAM,EAAE;EAAO,CAAC;EACxByC,OAAO,EAAE;IACPS,QAAQ,EAAE,CAAC;IACXC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { Platform, SafeAreaView, StatusBar, StyleSheet, View } from "react-native";
|
|
4
4
|
import { useSkeletor } from "../../hooks";
|
|
5
5
|
import { Block } from "../Block";
|
|
6
6
|
export const Screen = ({
|
|
@@ -10,20 +10,22 @@ export const Screen = ({
|
|
|
10
10
|
hideTopSafeArea,
|
|
11
11
|
bottomSafeAreaColor,
|
|
12
12
|
topSafeAreaColor,
|
|
13
|
-
style,
|
|
14
13
|
statusBarType,
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
paddings = {
|
|
15
|
+
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0
|
|
16
|
+
},
|
|
17
|
+
flex = 1,
|
|
18
|
+
...blockProps
|
|
17
19
|
}) => {
|
|
18
20
|
const {
|
|
19
21
|
defaultStatusBarType
|
|
20
22
|
} = useSkeletor();
|
|
21
23
|
return /*#__PURE__*/React.createElement(React.Fragment, null, background && (typeof background === "string" ? /*#__PURE__*/React.createElement(View, {
|
|
22
|
-
style: [
|
|
24
|
+
style: [StyleSheet.absoluteFill, {
|
|
23
25
|
backgroundColor: background
|
|
24
26
|
}]
|
|
25
27
|
}) : /*#__PURE__*/React.createElement(View, {
|
|
26
|
-
style:
|
|
28
|
+
style: StyleSheet.absoluteFill
|
|
27
29
|
}, background)), !hideTopSafeArea && /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
28
30
|
style: {
|
|
29
31
|
backgroundColor: topSafeAreaColor
|
|
@@ -33,22 +35,12 @@ export const Screen = ({
|
|
|
33
35
|
backgroundColor: "transparent",
|
|
34
36
|
barStyle: statusBarType || defaultStatusBarType
|
|
35
37
|
}), /*#__PURE__*/React.createElement(Block, _extends({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
flex: 1,
|
|
40
|
-
style: style
|
|
41
|
-
}, rest), children), !hideBottomSafeArea && /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
38
|
+
flex: flex,
|
|
39
|
+
paddings: paddings
|
|
40
|
+
}, blockProps), children), !hideBottomSafeArea && /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
42
41
|
style: {
|
|
43
42
|
backgroundColor: bottomSafeAreaColor
|
|
44
43
|
}
|
|
45
44
|
}));
|
|
46
45
|
};
|
|
47
|
-
const styles = StyleSheet.create({
|
|
48
|
-
container: {
|
|
49
|
-
position: "absolute",
|
|
50
|
-
height: Dimensions.get("screen").height,
|
|
51
|
-
width: Dimensions.get("screen").width
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
46
|
//# sourceMappingURL=Screen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","Platform","SafeAreaView","StatusBar","StyleSheet","View","useSkeletor","Block","Screen","background","children","hideBottomSafeArea","hideTopSafeArea","bottomSafeAreaColor","topSafeAreaColor","statusBarType","paddings","paddingTop","OS","currentHeight","flex","blockProps","defaultStatusBarType","createElement","Fragment","style","absoluteFill","backgroundColor","translucent","barStyle","_extends"],"sourceRoot":"../../src","sources":["Screen.tsx"],"mappings":";AAAA,OAAOA,KAAK,MAA6B,OAAO;AAChD,SACEC,QAAQ,EACRC,YAAY,EACZC,SAAS,EACTC,UAAU,EACVC,IAAI,QACC,cAAc;AAErB,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,KAAK,QAAoB,UAAU;AAc5C,OAAO,MAAMC,MAAgD,GAAGA,CAAC;EAC/DC,UAAU;EACVC,QAAQ;EACRC,kBAAkB;EAClBC,eAAe;EACfC,mBAAmB;EACnBC,gBAAgB;EAChBC,aAAa;EACbC,QAAQ,GAAG;IACTC,UAAU,EAAEhB,QAAQ,CAACiB,EAAE,KAAK,SAAS,GAAGf,SAAS,CAACgB,aAAa,GAAG;EACpE,CAAC;EACDC,IAAI,GAAG,CAAC;EACR,GAAGC;AACL,CAAC,KAAK;EACJ,MAAM;IAAEC;EAAqB,CAAC,GAAGhB,WAAW,CAAC,CAAC;EAE9C,oBACEN,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAwB,QAAA,QACGf,UAAU,KACR,OAAOA,UAAU,KAAK,QAAQ,gBAC7BT,KAAA,CAAAuB,aAAA,CAAClB,IAAI;IACHoB,KAAK,EAAE,CAACrB,UAAU,CAACsB,YAAY,EAAE;MAAEC,eAAe,EAAElB;IAAW,CAAC;EAAE,CACnE,CAAC,gBAEFT,KAAA,CAAAuB,aAAA,CAAClB,IAAI;IAACoB,KAAK,EAAErB,UAAU,CAACsB;EAAa,GAAEjB,UAAiB,CACzD,CAAC,EAEH,CAACG,eAAe,iBACfZ,KAAA,CAAAuB,aAAA,CAACrB,YAAY;IAACuB,KAAK,EAAE;MAAEE,eAAe,EAAEb;IAAiB;EAAE,CAAE,CAC9D,eAEDd,KAAA,CAAAuB,aAAA,CAACpB,SAAS;IACRyB,WAAW;IACXD,eAAe,EAAC,aAAa;IAC7BE,QAAQ,EAAEd,aAAa,IAAIO;EAAqB,CACjD,CAAC,eAEFtB,KAAA,CAAAuB,aAAA,CAAChB,KAAK,EAAAuB,QAAA;IAACV,IAAI,EAAEA,IAAK;IAACJ,QAAQ,EAAEA;EAAS,GAAKK,UAAU,GAClDX,QACI,CAAC,EAEP,CAACC,kBAAkB,iBAClBX,KAAA,CAAAuB,aAAA,CAACrB,YAAY;IACXuB,KAAK,EAAE;MACLE,eAAe,EAAEd;IACnB;EAAE,CACH,CAEH,CAAC;AAEP,CAAC"}
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import React, { useMemo } from "react";
|
|
3
3
|
import { Animated, StyleSheet } from "react-native";
|
|
4
4
|
import { useSkeletor } from "../../hooks";
|
|
5
|
-
import { extractAnimationProperties, extractFlexProperties, extractPositionProperties, extractSizeProperties } from "../../utils";
|
|
5
|
+
import { extractAnimationProperties, extractFlexProperties, extractGapProperties, extractPositionProperties, extractSizeProperties } from "../../utils";
|
|
6
6
|
/** Create a Font.d.ts type in your typescript types directory and define fonts as follows:
|
|
7
7
|
* @example type Font = "Helvetica" | "Montserrat" ... */
|
|
8
8
|
export const Text = ({
|
|
@@ -18,6 +18,7 @@ export const Text = ({
|
|
|
18
18
|
margins,
|
|
19
19
|
paddings,
|
|
20
20
|
animations,
|
|
21
|
+
gap,
|
|
21
22
|
...props
|
|
22
23
|
}) => {
|
|
23
24
|
const {
|
|
@@ -29,6 +30,9 @@ export const Text = ({
|
|
|
29
30
|
const positionProps = useMemo(() => extractPositionProperties(props), [props]);
|
|
30
31
|
const flexProps = useMemo(() => extractFlexProperties(props), [props]);
|
|
31
32
|
const sizeProps = useMemo(() => extractSizeProperties(props), [props]);
|
|
33
|
+
const gapProps = useMemo(() => extractGapProperties({
|
|
34
|
+
gap
|
|
35
|
+
}), [gap]);
|
|
32
36
|
const textSize = useMemo(() => {
|
|
33
37
|
function mapper(value) {
|
|
34
38
|
if (Array.isArray(value)) {
|
|
@@ -53,7 +57,7 @@ export const Text = ({
|
|
|
53
57
|
textAlign,
|
|
54
58
|
textTransform,
|
|
55
59
|
letterSpacing
|
|
56
|
-
}, textSize, margins, paddings, sizeProps, flexProps, positionProps, style]), [color, font, opacity, textAlign, textTransform, textSize, margins, paddings, style, positionProps, sizeProps, flexProps, defaultTextColor, defaultFont, letterSpacing]);
|
|
60
|
+
}, textSize, margins, paddings, sizeProps, flexProps, positionProps, gapProps, style]), [color, font, opacity, textAlign, textTransform, textSize, margins, paddings, style, positionProps, sizeProps, flexProps, gapProps, defaultTextColor, defaultFont, letterSpacing]);
|
|
57
61
|
return /*#__PURE__*/React.createElement(Animated.Text, _extends({
|
|
58
62
|
style: [styles, animationProps],
|
|
59
63
|
allowFontScaling: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","Animated","StyleSheet","useSkeletor","extractAnimationProperties","extractFlexProperties","extractPositionProperties","extractSizeProperties","Text","font","size","textTransform","letterSpacing","color","style","children","textAlign","opacity","margins","paddings","animations","props","defaultFont","defaultFontSize","defaultTextColor","animationProps","positionProps","flexProps","sizeProps","textSize","mapper","value","Array","isArray","fontSize","lineHeight","styles","flatten","fontFamily","createElement","_extends","allowFontScaling","maxFontSizeMultiplier"],"sourceRoot":"../../src","sources":["Text.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAuBC,OAAO,QAAQ,OAAO;AACzD,SACEC,QAAQ,EACRC,UAAU,QAGL,cAAc;AAErB,SAASC,WAAW,QAAQ,aAAa;AAEzC,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,yBAAyB,EACzBC,qBAAqB,QAChB,aAAa;AAsBpB;AACA;AACA,OAAO,MAAMC,IAA4C,GAAGA,CAAC;EAC3DC,IAAI;EACJC,IAAI;EACJC,aAAa;EACbC,aAAa;EACbC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACRC,SAAS;EACTC,OAAO;EACPC,OAAO;EACPC,QAAQ;EACRC,UAAU;
|
|
1
|
+
{"version":3,"names":["React","useMemo","Animated","StyleSheet","useSkeletor","extractAnimationProperties","extractFlexProperties","extractGapProperties","extractPositionProperties","extractSizeProperties","Text","font","size","textTransform","letterSpacing","color","style","children","textAlign","opacity","margins","paddings","animations","gap","props","defaultFont","defaultFontSize","defaultTextColor","animationProps","positionProps","flexProps","sizeProps","gapProps","textSize","mapper","value","Array","isArray","fontSize","lineHeight","styles","flatten","fontFamily","createElement","_extends","allowFontScaling","maxFontSizeMultiplier"],"sourceRoot":"../../src","sources":["Text.tsx"],"mappings":";AAAA,OAAOA,KAAK,IAAuBC,OAAO,QAAQ,OAAO;AACzD,SACEC,QAAQ,EACRC,UAAU,QAGL,cAAc;AAErB,SAASC,WAAW,QAAQ,aAAa;AAEzC,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,oBAAoB,EACpBC,yBAAyB,EACzBC,qBAAqB,QAChB,aAAa;AAsBpB;AACA;AACA,O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AIc,eAAe,CAAC;EACxC,CAAC,EAAE,CAACd,IAAI,EAAEc,eAAe,CAAC,CAAC;EAE3B,MAAMc,MAAM,GAAGvC,OAAO,CACpB,MACEE,UAAU,CAACsC,OAAO,CAAC,CACjB;IACE1B,KAAK,EAAEA,KAAK,IAAIY,gBAAgB;IAChCe,UAAU,EAAE/B,IAAI,IAAIc,WAAW;IAC/BN,OAAO;IACPD,SAAS;IACTL,aAAa;IACbC;EACF,CAAC,EACDmB,QAAQ,EACRb,OAAO,EACPC,QAAQ,EACRU,SAAS,EACTD,SAAS,EACTD,aAAa,EACbG,QAAQ,EACRhB,KAAK,CACN,CAAC,EACJ,CACED,KAAK,EACLJ,IAAI,EACJQ,OAAO,EACPD,SAAS,EACTL,aAAa,EACboB,QAAQ,EACRb,OAAO,EACPC,QAAQ,EACRL,KAAK,EACLa,aAAa,EACbE,SAAS,EACTD,SAAS,EACTE,QAAQ,EACRL,gBAAgB,EAChBF,WAAW,EACXX,aAAa,CAEjB,CAAC;EAED,oBACEd,KAAA,CAAA2C,aAAA,CAACzC,QAAQ,CAACQ,IAAI,EAAAkC,QAAA;IACZ5B,KAAK,EAAE,CAACwB,MAAM,EAAEZ,cAAc,CAAE;IAChCiB,gBAAgB,EAAE,KAAM;IACxBC,qBAAqB,EAAE;EAAE,GACrBtB,KAAK,GAERP,QACY,CAAC;AAEpB,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Animated, Easing } from "react-native";
|
|
2
|
-
function processStyles(styles,
|
|
2
|
+
function processStyles(styles, {
|
|
3
|
+
duration = 400,
|
|
4
|
+
easing = Easing.inOut(Easing.ease),
|
|
5
|
+
loop = false,
|
|
6
|
+
native = true
|
|
7
|
+
}) {
|
|
3
8
|
const keys = Object.keys(styles);
|
|
4
9
|
const values = keys.map(() => new Animated.Value(0));
|
|
5
10
|
const compositions = [];
|
|
@@ -14,19 +19,19 @@ function processStyles(styles, config) {
|
|
|
14
19
|
});
|
|
15
20
|
let composition = Animated.timing(value, {
|
|
16
21
|
toValue: definition.length - 1,
|
|
17
|
-
duration
|
|
18
|
-
useNativeDriver: !
|
|
19
|
-
easing
|
|
22
|
+
duration,
|
|
23
|
+
useNativeDriver: !loop && !!native,
|
|
24
|
+
easing
|
|
20
25
|
});
|
|
21
|
-
if (config.loop) {
|
|
22
|
-
composition = Animated.loop(composition);
|
|
23
|
-
}
|
|
24
26
|
const reverseComposition = Animated.timing(value, {
|
|
25
27
|
toValue: 0,
|
|
26
|
-
duration
|
|
27
|
-
useNativeDriver: !
|
|
28
|
-
easing
|
|
28
|
+
duration,
|
|
29
|
+
useNativeDriver: !loop && !!native,
|
|
30
|
+
easing
|
|
29
31
|
});
|
|
32
|
+
if (loop) {
|
|
33
|
+
composition = Animated.loop(composition);
|
|
34
|
+
}
|
|
30
35
|
animations[key] = animation;
|
|
31
36
|
compositions.push(composition);
|
|
32
37
|
reverseCompositions.push(reverseComposition);
|
|
@@ -38,21 +43,9 @@ function processStyles(styles, config) {
|
|
|
38
43
|
animations: animations
|
|
39
44
|
};
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
/** Animate styles in parallel.
|
|
43
|
-
* Example: if you define opacity and top styles, this will start the opacity animation and the top animation at the same time. */
|
|
44
|
-
export function animateParallel(styles, config = {
|
|
45
|
-
duration: 800
|
|
46
|
-
}) {
|
|
47
|
-
const {
|
|
48
|
-
animations,
|
|
49
|
-
reverseCompositions,
|
|
50
|
-
compositions
|
|
51
|
-
} = processStyles(styles, config);
|
|
52
|
-
const trigger = Animated.parallel(compositions);
|
|
53
|
-
const reverseTrigger = Animated.parallel(reverseCompositions);
|
|
46
|
+
function getAnimationTriggers(forward, backward) {
|
|
54
47
|
function start(onFinished) {
|
|
55
|
-
|
|
48
|
+
forward.start(({
|
|
56
49
|
finished
|
|
57
50
|
}) => {
|
|
58
51
|
if (finished) {
|
|
@@ -60,10 +53,40 @@ export function animateParallel(styles, config = {
|
|
|
60
53
|
}
|
|
61
54
|
});
|
|
62
55
|
}
|
|
56
|
+
function reverse(onFinished) {
|
|
57
|
+
backward.start(({
|
|
58
|
+
finished
|
|
59
|
+
}) => {
|
|
60
|
+
if (finished) {
|
|
61
|
+
onFinished === null || onFinished === void 0 || onFinished();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function reset() {
|
|
66
|
+
forward.reset();
|
|
67
|
+
}
|
|
63
68
|
return {
|
|
69
|
+
/** Will start the animation and interpolate the value as defined in the animation style configuration object. */
|
|
64
70
|
start,
|
|
65
|
-
reverse
|
|
66
|
-
|
|
71
|
+
/** Should only be triggered when `start()` has already been called. This will interpolate the Animated.Value back to the initial value defined in the animation from whatever value it is currently at. If the current value is already the initial value, reverse does nothing. */
|
|
72
|
+
reverse,
|
|
73
|
+
/** Reset only resets the forward trigger (called with start()). Both triggers are attached to the same Animated.Value, so resetting the forward one resets the value to the true initial value defined in the animation. */
|
|
74
|
+
reset
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Animate styles in parallel.
|
|
79
|
+
* Example: if you define opacity and top styles, this will start the opacity animation and the top animation at the same time. */
|
|
80
|
+
export function animateParallel(styles, config) {
|
|
81
|
+
const {
|
|
82
|
+
animations,
|
|
83
|
+
reverseCompositions,
|
|
84
|
+
compositions
|
|
85
|
+
} = processStyles(styles, config || {});
|
|
86
|
+
const trigger = Animated.parallel(compositions);
|
|
87
|
+
const reverseTrigger = Animated.parallel(reverseCompositions);
|
|
88
|
+
return {
|
|
89
|
+
...getAnimationTriggers(trigger, reverseTrigger),
|
|
67
90
|
forward: trigger,
|
|
68
91
|
backward: reverseTrigger,
|
|
69
92
|
animations
|
|
@@ -87,30 +110,16 @@ function createStaggerComposition(compositions, stagger) {
|
|
|
87
110
|
|
|
88
111
|
/** Stagger defined styles animations.
|
|
89
112
|
* Example: if you define opacity and top styles, this will start the opacity animation and stagger the top animation by stagger amount. */
|
|
90
|
-
export function animateStagger(styles, config
|
|
91
|
-
duration: 800,
|
|
92
|
-
stagger: 400
|
|
93
|
-
}) {
|
|
113
|
+
export function animateStagger(styles, config) {
|
|
94
114
|
const {
|
|
95
115
|
animations,
|
|
96
116
|
reverseCompositions,
|
|
97
117
|
compositions
|
|
98
|
-
} = processStyles(styles, config);
|
|
99
|
-
const trigger = createStaggerComposition(compositions, config.stagger);
|
|
100
|
-
const reverseTrigger = createStaggerComposition(reverseCompositions, config.stagger);
|
|
101
|
-
function start(onFinished) {
|
|
102
|
-
trigger.start(({
|
|
103
|
-
finished
|
|
104
|
-
}) => {
|
|
105
|
-
if (finished) {
|
|
106
|
-
onFinished === null || onFinished === void 0 || onFinished();
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
118
|
+
} = processStyles(styles, config || {});
|
|
119
|
+
const trigger = createStaggerComposition(compositions, config.stagger || 200);
|
|
120
|
+
const reverseTrigger = createStaggerComposition(reverseCompositions, config.stagger || 200);
|
|
110
121
|
return {
|
|
111
|
-
|
|
112
|
-
reverse: reverseTrigger.start,
|
|
113
|
-
reset: trigger.reset,
|
|
122
|
+
...getAnimationTriggers(trigger, reverseTrigger),
|
|
114
123
|
forward: trigger,
|
|
115
124
|
backward: reverseTrigger,
|
|
116
125
|
animations
|
|
@@ -149,29 +158,16 @@ function createSequenceComposition(compositions) {
|
|
|
149
158
|
|
|
150
159
|
/** This will animate the passed in styles in sequence.
|
|
151
160
|
* Example: if you define opacity and top styles, this will start the opacity animation and then start the top animation when the opacity animation finishes. */
|
|
152
|
-
export function animateSequence(styles, config
|
|
153
|
-
duration: 800
|
|
154
|
-
}) {
|
|
161
|
+
export function animateSequence(styles, config) {
|
|
155
162
|
const {
|
|
156
163
|
animations,
|
|
157
164
|
reverseCompositions,
|
|
158
165
|
compositions
|
|
159
|
-
} = processStyles(styles, config);
|
|
166
|
+
} = processStyles(styles, config || {});
|
|
160
167
|
const trigger = createSequenceComposition(compositions);
|
|
161
168
|
const reverseTrigger = createSequenceComposition(reverseCompositions);
|
|
162
|
-
function start(onFinished) {
|
|
163
|
-
trigger.start(({
|
|
164
|
-
finished
|
|
165
|
-
}) => {
|
|
166
|
-
if (finished) {
|
|
167
|
-
onFinished === null || onFinished === void 0 || onFinished();
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
169
|
return {
|
|
172
|
-
|
|
173
|
-
reverse: reverseTrigger.start,
|
|
174
|
-
reset: trigger.reset,
|
|
170
|
+
...getAnimationTriggers(trigger, reverseTrigger),
|
|
175
171
|
forward: trigger,
|
|
176
172
|
backward: reverseTrigger,
|
|
177
173
|
animations
|
|
@@ -179,22 +175,23 @@ export function animateSequence(styles, config = {
|
|
|
179
175
|
}
|
|
180
176
|
export function createAnimationTimeline(timeline) {
|
|
181
177
|
const times = Object.keys(timeline).map(ms => Number(ms));
|
|
182
|
-
const
|
|
178
|
+
const lastTime = times[times.length - 1];
|
|
179
|
+
const reverseTimes = times.reverse();
|
|
180
|
+
let compositions = [];
|
|
181
|
+
let reverseCompositions = [];
|
|
182
|
+
for (const ms of times) {
|
|
183
183
|
const elements = timeline[ms];
|
|
184
184
|
const trigger = Animated.parallel(elements.map(e => e.forward));
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
let lastTime = times[times.length - 1];
|
|
189
|
-
const reverseCompositions = times.reverse().map(ms => {
|
|
185
|
+
compositions.push(!ms ? trigger : createSequenceComposition([Animated.delay(ms), trigger]));
|
|
186
|
+
}
|
|
187
|
+
for (const ms of reverseTimes) {
|
|
190
188
|
const delay = lastTime - ms;
|
|
191
189
|
const elements = timeline[ms];
|
|
192
190
|
const trigger = Animated.parallel(elements.map(e => e.backward));
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
const backward = Animated.parallel(reverseCompositions);
|
|
191
|
+
reverseCompositions.push(!delay ? trigger : createSequenceComposition([Animated.delay(delay), trigger]));
|
|
192
|
+
}
|
|
193
|
+
const forward = Animated.parallel(compositions.flat());
|
|
194
|
+
const backward = Animated.parallel(reverseCompositions.flat());
|
|
198
195
|
return {
|
|
199
196
|
start: forward.start,
|
|
200
197
|
reverse: backward.start,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Animated","Easing","processStyles","styles","
|
|
1
|
+
{"version":3,"names":["Animated","Easing","processStyles","styles","duration","easing","inOut","ease","loop","native","keys","Object","values","map","Value","compositions","reverseCompositions","animations","forEach","key","index","value","definition","animation","interpolate","inputRange","_","i","outputRange","composition","timing","toValue","length","useNativeDriver","reverseComposition","push","reverse","getAnimationTriggers","forward","backward","start","onFinished","finished","reset","animateParallel","config","trigger","parallel","reverseTrigger","createStaggerComposition","stagger","callback","c","createSequenceComposition","delay","stop","animateStagger","startComposition","nextIndex","animateSequence","createAnimationTimeline","timeline","times","ms","Number","lastTime","reverseTimes","elements","e","flat"],"sourceRoot":"../../src","sources":["animations.ts"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,QAAmB,cAAc;AAU1D,SAASC,aAAaA,CACpBC,MAA4B,EAC5B;EACEC,QAAQ,GAAG,GAAG;EACdC,MAAM,GAAGJ,MAAM,CAACK,KAAK,CAACL,MAAM,CAACM,IAAI,CAAC;EAClCC,IAAI,GAAG,KAAK;EACZC,MAAM,GAAG;AACa,CAAC,EACzB;EACA,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACP,MAAM,CAAW;EAC1C,MAAMS,MAAM,GAAGF,IAAI,CAACG,GAAG,CAAC,MAAM,IAAIb,QAAQ,CAACc,KAAK,CAAC,CAAC,CAAC,CAAC;EACpD,MAAMC,YAA2C,GAAG,EAAE;EACtD,MAAMC,mBAAkD,GAAG,EAAE;EAC7D,MAAMC,UAAoC,GAAG,CAAC,CAAC;EAE/CP,IAAI,CAACQ,OAAO,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IAC3B,MAAMC,KAAK,GAAGT,MAAM,CAACQ,KAAK,CAAC;IAC3B,MAAME,UAAU,GAAGnB,MAA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
|
|
1
|
+
export function extractGapProperties(props) {
|
|
2
|
+
const value = props.gap;
|
|
3
|
+
if (!value) return {};
|
|
4
|
+
if (Array.isArray(value)) {
|
|
5
|
+
return {
|
|
6
|
+
columnGap: value[0],
|
|
7
|
+
rowGap: value[1]
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
if (typeof value === "number") {
|
|
11
|
+
return {
|
|
12
|
+
gap: value
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
columnGap: value.col,
|
|
17
|
+
rowGap: value.row
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=extractGapProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["extractGapProperties","props","value","gap","Array","isArray","columnGap","rowGap","col","row"],"sourceRoot":"../../src","sources":["extractGapProperties.ts"],"mappings":"AAGA,OAAO,SAASA,oBAAoBA,CAClCC,KAAY,EAKZ;EACA,MAAMC,KAAK,GAAGD,KAAK,CAACE,GAAG;EACvB,IAAI,CAACD,KAAK,EAAE,OAAO,CAAC,CAAC;EAErB,IAAIE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACxB,OAAO;MACLI,SAAS,EAAEJ,KAAK,CAAC,CAAC,CAAC;MACnBK,MAAM,EAAEL,KAAK,CAAC,CAAC;IACjB,CAAC;EACH;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAO;MACLC,GAAG,EAAED;IACP,CAAC;EACH;EAEA,OAAO;IACLI,SAAS,EAAEJ,KAAK,CAACM,GAAG;IACpBD,MAAM,EAAEL,KAAK,CAACO;EAChB,CAAC;AACH"}
|
|
@@ -2,6 +2,7 @@ export * from "./animations";
|
|
|
2
2
|
export * from "./extractAlignmentProperties";
|
|
3
3
|
export * from "./extractAnimationProperties";
|
|
4
4
|
export * from "./extractFlexProperties";
|
|
5
|
+
export * from "./extractGapProperties";
|
|
5
6
|
export * from "./extractPositionProperties";
|
|
6
7
|
export * from "./extractSizeProperties";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,8BAA8B;AAC5C,cAAc,8BAA8B;AAC5C,cAAc,yBAAyB;AACvC,cAAc,6BAA6B;AAC3C,cAAc,yBAAyB"}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,8BAA8B;AAC5C,cAAc,8BAA8B;AAC5C,cAAc,yBAAyB;AACvC,cAAc,wBAAwB;AACtC,cAAc,6BAA6B;AAC3C,cAAc,yBAAyB"}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import { ScrollViewProps,
|
|
2
|
+
import { ScrollViewProps, ViewProps, ViewStyle } from "react-native";
|
|
3
3
|
import { Alignment, Animations, Border, Flex, Position, Size, Spacing } from "../../models";
|
|
4
|
-
|
|
4
|
+
declare type SkeletorProps = Alignment & Spacing & Size & Border & Flex & Position & Animations;
|
|
5
|
+
declare type SharedProps = SkeletorProps & {
|
|
5
6
|
background?: string;
|
|
6
7
|
opacity?: ViewStyle["opacity"];
|
|
7
|
-
}
|
|
8
|
-
export declare type BlockScrollViewProps = SharedProps &
|
|
8
|
+
};
|
|
9
|
+
export declare type BlockScrollViewProps = SharedProps & ViewProps & {
|
|
9
10
|
scrollable: true;
|
|
10
|
-
|
|
11
|
-
showsVerticalScrollIndicator?: boolean;
|
|
12
|
-
showsHorizontalScrollIndicator?: boolean;
|
|
13
|
-
bounces?: boolean;
|
|
14
|
-
style?: StyleProp<ViewStyle>;
|
|
11
|
+
scrollProps?: ScrollViewProps;
|
|
15
12
|
};
|
|
16
13
|
export declare type BlockViewProps = SharedProps & ViewProps & {
|
|
17
14
|
scrollable?: false | undefined;
|
|
18
15
|
};
|
|
19
|
-
declare type
|
|
20
|
-
|
|
16
|
+
export declare type BlockProps = BlockScrollViewProps | BlockViewProps;
|
|
17
|
+
/** Can be switched to a scrollable view by passing in `scrollable`. When scrollable, control ScrollView related parameters through `scrollProps`. Default values for `scrollProps` are:
|
|
18
|
+
* @param keyboardShouldPersistTaps `handled`
|
|
19
|
+
* @param showsVerticalScrollIndicator `false`
|
|
20
|
+
* @param showsHorizontalScrollIndicator `false`
|
|
21
|
+
* @param bounces `false`
|
|
22
|
+
* @param contentContainerStyle `{ flexGrow: 1, backgroundColor: rest.background }` */
|
|
21
23
|
export declare const Block: React.FC<PropsWithChildren<BlockProps>>;
|
|
22
24
|
export {};
|
|
23
25
|
//# sourceMappingURL=Block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../../src/components/Block/Block.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAC1D,OAAO,EAGL,eAAe,
|
|
1
|
+
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../../src/components/Block/Block.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAC1D,OAAO,EAGL,eAAe,EAEf,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,SAAS,EACT,UAAU,EACV,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,EACR,MAAM,cAAc,CAAC;AAUtB,aAAK,aAAa,GAAG,SAAS,GAC5B,OAAO,GACP,IAAI,GACJ,MAAM,GACN,IAAI,GACJ,QAAQ,GACR,UAAU,CAAC;AAEb,aAAK,WAAW,GAAG,aAAa,GAAG;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC,CAAC;AAEF,oBAAY,oBAAoB,GAAG,WAAW,GAC5C,SAAS,GAAG;IACV,UAAU,EAAE,IAAI,CAAC;IACjB,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,CAAC;AAEJ,oBAAY,cAAc,GAAG,WAAW,GACtC,SAAS,GAAG;IACV,UAAU,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CAChC,CAAC;AAEJ,oBAAY,UAAU,GAAG,oBAAoB,GAAG,cAAc,CAAC;AAmF/D;;;;;sFAKsF;AACtF,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAkCzD,CAAC"}
|
|
@@ -8,11 +8,19 @@ export interface InputFocusScrollViewProps extends Omit<ScrollViewProps, "childr
|
|
|
8
8
|
children: (onInputFocus: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void) => React.ReactNode;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* This scroll view will automatically scroll to an active input field rendered within it, provided you attach the onInputFocus callback to the input onFocus prop.
|
|
11
|
+
* This scroll view will automatically scroll to an active input field rendered within it, provided you attach the `onInputFocus` callback to the input onFocus prop.
|
|
12
12
|
*
|
|
13
13
|
* The return value is a lambda component, returning a callback which you attach to input fields rendered within it.
|
|
14
14
|
* @example <InputFocusScrollView>{(onInputFocus) => <TextInput onFocus={onInputFocus} ... />}</InputFocusScrollView>
|
|
15
15
|
* NOTE: This works on iOS only, Android does this by default with @param android:windowSoftInputMode
|
|
16
|
+
*
|
|
17
|
+
* Default props are:
|
|
18
|
+
* @param height `full`
|
|
19
|
+
* @param focusPositionOffset `0.3`
|
|
20
|
+
* @param showsVerticalScrollIndicator `false`
|
|
21
|
+
* @param showsHorizontalScrollIndicator `false`
|
|
22
|
+
* @param bounces `false`
|
|
23
|
+
* @param contentContainerStyle `{flexGrow: 1, paddingBottom: 30}`
|
|
16
24
|
*/
|
|
17
25
|
export declare const InputFocusScrollView: React.FC<InputFocusScrollViewProps>;
|
|
18
26
|
//# sourceMappingURL=InputFocusScrollView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputFocusScrollView.d.ts","sourceRoot":"","sources":["../../../../src/components/InputFocusScrollView/InputFocusScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"InputFocusScrollView.d.ts","sourceRoot":"","sources":["../../../../src/components/InputFocusScrollView/InputFocusScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAEL,oBAAoB,EAGpB,eAAe,EAGf,uBAAuB,EACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,EACvC,OAAO;IACT,4LAA4L;IAC5L,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,EAAE,CACR,YAAY,EAAE,CAAC,CAAC,EAAE,oBAAoB,CAAC,uBAAuB,CAAC,KAAK,IAAI,KACrE,KAAK,CAAC,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA8EpE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { BlockProps } from "../Block";
|
|
3
3
|
declare type OwnProps = {
|
|
4
4
|
/** Pass a specific background view OR just a background color value. Custom components should be 100% height and width. */
|
|
5
5
|
background?: JSX.Element | string;
|
|
@@ -8,9 +8,8 @@ declare type OwnProps = {
|
|
|
8
8
|
bottomSafeAreaColor?: string;
|
|
9
9
|
topSafeAreaColor?: string;
|
|
10
10
|
statusBarType?: "default" | "light-content" | "dark-content";
|
|
11
|
-
isLandscape?: boolean;
|
|
12
11
|
};
|
|
13
|
-
export declare type ScreenProps = OwnProps &
|
|
12
|
+
export declare type ScreenProps = OwnProps & Omit<BlockProps, "background">;
|
|
14
13
|
export declare const Screen: React.FC<PropsWithChildren<ScreenProps>>;
|
|
15
14
|
export {};
|
|
16
15
|
//# sourceMappingURL=Screen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../../src/components/Screen/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../../src/components/Screen/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAUjD,OAAO,EAAS,UAAU,EAAE,MAAM,UAAU,CAAC;AAE7C,aAAK,QAAQ,GAAG;IACd,2HAA2H;IAC3H,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,SAAS,GAAG,eAAe,GAAG,cAAc,CAAC;CAC9D,CAAC;AAEF,oBAAY,WAAW,GAAG,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAEpE,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAkD3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/components/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11 +1,15 @@
|
|
|
1
1
|
import { Animated, EasingFunction, ViewStyle } from "react-native";
|
|
2
2
|
export declare type AnimationConfiguration = {
|
|
3
|
-
duration
|
|
3
|
+
duration?: number;
|
|
4
|
+
/** Note: Disables native driver. */
|
|
4
5
|
loop?: boolean;
|
|
6
|
+
/** Enables or disables native driver. Defaults to true. */
|
|
7
|
+
native?: boolean;
|
|
8
|
+
/** Defaults to Easing.inOut(Easing.ease) */
|
|
5
9
|
easing?: EasingFunction;
|
|
6
10
|
};
|
|
7
11
|
export declare type StaggerAnimationConfiguration = AnimationConfiguration & {
|
|
8
|
-
stagger
|
|
12
|
+
stagger?: number;
|
|
9
13
|
};
|
|
10
14
|
export declare type AnimationStyle<Keys extends keyof ViewStyle> = {
|
|
11
15
|
[K in Keys | keyof ViewStyle]?: string[] | number[];
|
|
@@ -20,8 +24,8 @@ export declare type ElementAnimation<Keys extends keyof ViewStyle> = {
|
|
|
20
24
|
/** Start animation with onFinished callback. Using forward.start() */
|
|
21
25
|
start(onFinished?: () => void): void;
|
|
22
26
|
/** Reverse all animation values to initial value and reset main trigger. Using backward.start() */
|
|
23
|
-
reverse: () => void;
|
|
24
|
-
/** Reset
|
|
27
|
+
reverse: (onFinished?: () => void) => void;
|
|
28
|
+
/** Reset animations to initial value. Using forward.reset() */
|
|
25
29
|
reset: Animated.CompositeAnimation["reset"];
|
|
26
30
|
};
|
|
27
31
|
export interface Animations {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animation.d.ts","sourceRoot":"","sources":["../../../src/models/Animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnE,oBAAY,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Animation.d.ts","sourceRoot":"","sources":["../../../src/models/Animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA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CACjC"}
|
|
@@ -7,9 +7,15 @@ declare type MarginStyles = {
|
|
|
7
7
|
declare type PaddingStyles = {
|
|
8
8
|
[K in PaddingKey]?: ViewStyle[K];
|
|
9
9
|
};
|
|
10
|
+
declare type GapType = {
|
|
11
|
+
row?: number;
|
|
12
|
+
col?: number;
|
|
13
|
+
} | [number, number] | number;
|
|
10
14
|
export interface Spacing {
|
|
11
15
|
margins?: MarginStyles;
|
|
12
16
|
paddings?: PaddingStyles;
|
|
17
|
+
/** Possible value formats are { row, col } or [col, row] or just a number applied to both column and row gap. */
|
|
18
|
+
gap?: GapType;
|
|
13
19
|
}
|
|
14
20
|
export {};
|
|
15
21
|
//# sourceMappingURL=Spacing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spacing.d.ts","sourceRoot":"","sources":["../../../src/models/Spacing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,aAAK,SAAS,GAAG,OAAO,CAAC,MAAM,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;AAC7D,aAAK,UAAU,GAAG,OAAO,CAAC,MAAM,SAAS,EAAE,UAAU,MAAM,EAAE,CAAC,CAAC;AAE/D,aAAK,YAAY,GAAG;KACjB,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;CAChC,CAAC;AAEF,aAAK,aAAa,GAAG;KAClB,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,OAAO;IACtB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Spacing.d.ts","sourceRoot":"","sources":["../../../src/models/Spacing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,aAAK,SAAS,GAAG,OAAO,CAAC,MAAM,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;AAC7D,aAAK,UAAU,GAAG,OAAO,CAAC,MAAM,SAAS,EAAE,UAAU,MAAM,EAAE,CAAC,CAAC;AAE/D,aAAK,YAAY,GAAG;KACjB,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;CAChC,CAAC;AAEF,aAAK,aAAa,GAAG;KAClB,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;CACjC,CAAC;AAEF,aAAK,OAAO,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;AAE1E,MAAM,WAAW,OAAO;IACtB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,iHAAiH;IACjH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf"}
|
|
@@ -5,7 +5,7 @@ import { AnimationConfiguration, AnimationStyle, ElementAnimation, StaggerAnimat
|
|
|
5
5
|
export declare function animateParallel<Styles extends keyof ViewStyle>(styles: AnimationStyle<Styles>, config?: AnimationConfiguration): ElementAnimation<Styles>;
|
|
6
6
|
/** Stagger defined styles animations.
|
|
7
7
|
* Example: if you define opacity and top styles, this will start the opacity animation and stagger the top animation by stagger amount. */
|
|
8
|
-
export declare function animateStagger<Styles extends keyof ViewStyle>(styles: AnimationStyle<Styles>, config
|
|
8
|
+
export declare function animateStagger<Styles extends keyof ViewStyle>(styles: AnimationStyle<Styles>, config: StaggerAnimationConfiguration): ElementAnimation<Styles>;
|
|
9
9
|
/** This will animate the passed in styles in sequence.
|
|
10
10
|
* Example: if you define opacity and top styles, this will start the opacity animation and then start the top animation when the opacity animation finishes. */
|
|
11
11
|
export declare function animateSequence<Styles extends keyof ViewStyle>(styles: AnimationStyle<Styles>, config?: AnimationConfiguration): ElementAnimation<Styles>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animations.d.ts","sourceRoot":"","sources":["../../../src/utils/animations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,SAAS,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAEL,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,6BAA6B,EAC9B,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"animations.d.ts","sourceRoot":"","sources":["../../../src/utils/animations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,SAAS,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAEL,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,6BAA6B,EAC9B,MAAM,WAAW,CAAC;AA2FnB;kIACkI;AAClI,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,SAAS,EAC5D,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,EAC9B,MAAM,CAAC,EAAE,sBAAsB,GAC9B,gBAAgB,CAAC,MAAM,CAAC,CAc1B;AAuBD;2IAC2I;AAC3I,wBAAgB,cAAc,CAAC,MAAM,SAAS,MAAM,SAAS,EAC3D,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,EAC9B,MAAM,EAAE,6BAA6B,GACpC,gBAAgB,CAAC,MAAM,CAAC,CAiB1B;AAgCD;gKACgK;AAChK,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,SAAS,EAC5D,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,EAC9B,MAAM,CAAC,EAAE,sBAAsB,GAC9B,gBAAgB,CAAC,MAAM,CAAC,CAc1B;AAED,UAAU,8BAA8B;IACtC,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;CACvC;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,8BAA8B;;;;EAoCzC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Spacing } from "models";
|
|
2
|
+
import { ViewStyle } from "react-native";
|
|
3
|
+
export declare function extractGapProperties<Props extends Spacing>(props: Props): {
|
|
4
|
+
gap?: ViewStyle["gap"];
|
|
5
|
+
columnGap?: ViewStyle["columnGap"];
|
|
6
|
+
rowGap?: ViewStyle["rowGap"];
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=extractGapProperties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractGapProperties.d.ts","sourceRoot":"","sources":["../../../src/utils/extractGapProperties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,wBAAgB,oBAAoB,CAAC,KAAK,SAAS,OAAO,EACxD,KAAK,EAAE,KAAK,GACX;IACD,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC9B,CAqBA"}
|
|
@@ -2,6 +2,7 @@ export * from "./animations";
|
|
|
2
2
|
export * from "./extractAlignmentProperties";
|
|
3
3
|
export * from "./extractAnimationProperties";
|
|
4
4
|
export * from "./extractFlexProperties";
|
|
5
|
+
export * from "./extractGapProperties";
|
|
5
6
|
export * from "./extractPositionProperties";
|
|
6
7
|
export * from "./extractSizeProperties";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"Luka Buljan <luka@prototyp.digital>",
|
|
7
7
|
"Vlatko Vlahek <vlatko@prototyp.digital>"
|
|
8
8
|
],
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.15",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"types": "lib/typescript/index.d.ts",
|
|
12
12
|
"main": "lib/module/index.js",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"react-native",
|
|
52
|
+
"toolkit",
|
|
52
53
|
"ui",
|
|
53
54
|
"kit",
|
|
54
55
|
"form",
|
|
@@ -60,9 +61,7 @@
|
|
|
60
61
|
"utils"
|
|
61
62
|
],
|
|
62
63
|
"files": [
|
|
63
|
-
"lib"
|
|
64
|
-
"README.md",
|
|
65
|
-
"package.json"
|
|
64
|
+
"lib"
|
|
66
65
|
],
|
|
67
66
|
"react-native-builder-bob": {
|
|
68
67
|
"source": "src",
|