@kaushverse/pickify 1.0.11 → 1.0.12
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/index.js +35 -12
- package/dist/index.mjs +37 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -274,24 +274,22 @@ var toggleValue = (arr, value) => {
|
|
|
274
274
|
var import_react2 = require("react");
|
|
275
275
|
var import_react_native2 = require("react-native");
|
|
276
276
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
277
|
-
if (import_react_native2.Platform.OS === "android") {
|
|
278
|
-
import_react_native2.UIManager.setLayoutAnimationEnabledExperimental?.(true);
|
|
279
|
-
}
|
|
280
277
|
function MultiPickerGroup({
|
|
281
278
|
label,
|
|
282
279
|
children,
|
|
283
280
|
renderGroupIcon
|
|
284
281
|
}) {
|
|
285
282
|
const [open, setOpen] = (0, import_react2.useState)(true);
|
|
283
|
+
const [contentHeight, setContentHeight] = (0, import_react2.useState)(0);
|
|
284
|
+
const animatedHeight = (0, import_react2.useRef)(new import_react_native2.Animated.Value(0)).current;
|
|
286
285
|
const toggle = () => {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
);
|
|
294
|
-
setOpen((prev) => !prev);
|
|
286
|
+
const toValue = open ? 0 : contentHeight;
|
|
287
|
+
import_react_native2.Animated.timing(animatedHeight, {
|
|
288
|
+
toValue,
|
|
289
|
+
duration: 250,
|
|
290
|
+
useNativeDriver: false
|
|
291
|
+
}).start();
|
|
292
|
+
setOpen(!open);
|
|
295
293
|
};
|
|
296
294
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native2.View, { style: styles.group, children: [
|
|
297
295
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native2.TouchableOpacity, { style: styles.header, onPress: toggle, children: [
|
|
@@ -302,7 +300,26 @@ function MultiPickerGroup({
|
|
|
302
300
|
color: "#6B7280"
|
|
303
301
|
})
|
|
304
302
|
] }),
|
|
305
|
-
|
|
303
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
304
|
+
import_react_native2.View,
|
|
305
|
+
{
|
|
306
|
+
style: styles.hidden,
|
|
307
|
+
onLayout: (e) => {
|
|
308
|
+
setContentHeight(e.nativeEvent.layout.height);
|
|
309
|
+
},
|
|
310
|
+
children
|
|
311
|
+
}
|
|
312
|
+
),
|
|
313
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
314
|
+
import_react_native2.Animated.View,
|
|
315
|
+
{
|
|
316
|
+
style: {
|
|
317
|
+
height: animatedHeight,
|
|
318
|
+
overflow: "hidden"
|
|
319
|
+
},
|
|
320
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.View, { style: styles.content, children })
|
|
321
|
+
}
|
|
322
|
+
)
|
|
306
323
|
] });
|
|
307
324
|
}
|
|
308
325
|
var styles = import_react_native2.StyleSheet.create({
|
|
@@ -320,6 +337,12 @@ var styles = import_react_native2.StyleSheet.create({
|
|
|
320
337
|
},
|
|
321
338
|
content: {
|
|
322
339
|
marginTop: 6
|
|
340
|
+
},
|
|
341
|
+
// invisible layout measurement
|
|
342
|
+
hidden: {
|
|
343
|
+
position: "absolute",
|
|
344
|
+
opacity: 0,
|
|
345
|
+
zIndex: -1
|
|
323
346
|
}
|
|
324
347
|
});
|
|
325
348
|
|
package/dist/index.mjs
CHANGED
|
@@ -254,35 +254,31 @@ var toggleValue = (arr, value) => {
|
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
// src/components/MultiPickerGroup.tsx
|
|
257
|
-
import { useState as useState2 } from "react";
|
|
257
|
+
import { useRef, useState as useState2 } from "react";
|
|
258
258
|
import {
|
|
259
259
|
View as View2,
|
|
260
260
|
Text as Text2,
|
|
261
261
|
TouchableOpacity as TouchableOpacity2,
|
|
262
262
|
StyleSheet as StyleSheet2,
|
|
263
|
-
|
|
264
|
-
Platform,
|
|
265
|
-
UIManager
|
|
263
|
+
Animated
|
|
266
264
|
} from "react-native";
|
|
267
265
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
268
|
-
if (Platform.OS === "android") {
|
|
269
|
-
UIManager.setLayoutAnimationEnabledExperimental?.(true);
|
|
270
|
-
}
|
|
271
266
|
function MultiPickerGroup({
|
|
272
267
|
label,
|
|
273
268
|
children,
|
|
274
269
|
renderGroupIcon
|
|
275
270
|
}) {
|
|
276
271
|
const [open, setOpen] = useState2(true);
|
|
272
|
+
const [contentHeight, setContentHeight] = useState2(0);
|
|
273
|
+
const animatedHeight = useRef(new Animated.Value(0)).current;
|
|
277
274
|
const toggle = () => {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
);
|
|
285
|
-
setOpen((prev) => !prev);
|
|
275
|
+
const toValue = open ? 0 : contentHeight;
|
|
276
|
+
Animated.timing(animatedHeight, {
|
|
277
|
+
toValue,
|
|
278
|
+
duration: 250,
|
|
279
|
+
useNativeDriver: false
|
|
280
|
+
}).start();
|
|
281
|
+
setOpen(!open);
|
|
286
282
|
};
|
|
287
283
|
return /* @__PURE__ */ jsxs2(View2, { style: styles.group, children: [
|
|
288
284
|
/* @__PURE__ */ jsxs2(TouchableOpacity2, { style: styles.header, onPress: toggle, children: [
|
|
@@ -293,7 +289,26 @@ function MultiPickerGroup({
|
|
|
293
289
|
color: "#6B7280"
|
|
294
290
|
})
|
|
295
291
|
] }),
|
|
296
|
-
|
|
292
|
+
/* @__PURE__ */ jsx2(
|
|
293
|
+
View2,
|
|
294
|
+
{
|
|
295
|
+
style: styles.hidden,
|
|
296
|
+
onLayout: (e) => {
|
|
297
|
+
setContentHeight(e.nativeEvent.layout.height);
|
|
298
|
+
},
|
|
299
|
+
children
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
/* @__PURE__ */ jsx2(
|
|
303
|
+
Animated.View,
|
|
304
|
+
{
|
|
305
|
+
style: {
|
|
306
|
+
height: animatedHeight,
|
|
307
|
+
overflow: "hidden"
|
|
308
|
+
},
|
|
309
|
+
children: /* @__PURE__ */ jsx2(View2, { style: styles.content, children })
|
|
310
|
+
}
|
|
311
|
+
)
|
|
297
312
|
] });
|
|
298
313
|
}
|
|
299
314
|
var styles = StyleSheet2.create({
|
|
@@ -311,6 +326,12 @@ var styles = StyleSheet2.create({
|
|
|
311
326
|
},
|
|
312
327
|
content: {
|
|
313
328
|
marginTop: 6
|
|
329
|
+
},
|
|
330
|
+
// invisible layout measurement
|
|
331
|
+
hidden: {
|
|
332
|
+
position: "absolute",
|
|
333
|
+
opacity: 0,
|
|
334
|
+
zIndex: -1
|
|
314
335
|
}
|
|
315
336
|
});
|
|
316
337
|
|
package/package.json
CHANGED