achery-ui 0.16.0 → 0.17.1
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/native/index.cjs +40 -10
- package/dist/native/index.cjs.map +1 -1
- package/dist/native/index.d.cts +13 -3
- package/dist/native/index.d.ts +13 -3
- package/dist/native/index.js +41 -11
- package/dist/native/index.js.map +1 -1
- package/package.json +1 -1
- package/src/native/components/BottomSheet.tsx +65 -15
- package/src/native/components/ScreenNav.tsx +10 -3
package/dist/native/index.cjs
CHANGED
|
@@ -5432,7 +5432,7 @@ var SegmentedControl = ({
|
|
|
5432
5432
|
};
|
|
5433
5433
|
var ScreenNav = ({
|
|
5434
5434
|
onBack,
|
|
5435
|
-
backLabel = "
|
|
5435
|
+
backLabel = "Back",
|
|
5436
5436
|
title,
|
|
5437
5437
|
onAction,
|
|
5438
5438
|
actionLabel,
|
|
@@ -5478,7 +5478,13 @@ var ScreenNav = ({
|
|
|
5478
5478
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5479
5479
|
reactNative.Text,
|
|
5480
5480
|
{
|
|
5481
|
+
numberOfLines: 1,
|
|
5481
5482
|
style: {
|
|
5483
|
+
// Flex + single line so a long title truncates instead of pushing the
|
|
5484
|
+
// trailing action button off-screen.
|
|
5485
|
+
flex: 1,
|
|
5486
|
+
textAlign: "center",
|
|
5487
|
+
marginHorizontal: tokens.spacing.sp3,
|
|
5482
5488
|
color: tokens$1.fgMute,
|
|
5483
5489
|
fontSize: 11,
|
|
5484
5490
|
fontWeight: tokens.fontWeights.semibold.toString(),
|
|
@@ -5637,12 +5643,29 @@ var BottomSheet = ({
|
|
|
5637
5643
|
showClose = false,
|
|
5638
5644
|
children,
|
|
5639
5645
|
maxContentHeight,
|
|
5646
|
+
avoidKeyboard = true,
|
|
5640
5647
|
style
|
|
5641
5648
|
}) => {
|
|
5642
5649
|
const { tokens: tokens$1 } = useTheme();
|
|
5643
5650
|
const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
5651
|
+
const { height: windowHeight } = reactNative.useWindowDimensions();
|
|
5644
5652
|
const slideAnim = react.useRef(new reactNative.Animated.Value(0)).current;
|
|
5645
5653
|
const scrimAnim = react.useRef(new reactNative.Animated.Value(0)).current;
|
|
5654
|
+
const [keyboardOffset, setKeyboardOffset] = react.useState(0);
|
|
5655
|
+
react.useEffect(() => {
|
|
5656
|
+
if (!avoidKeyboard) return;
|
|
5657
|
+
const showEvt = reactNative.Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
|
|
5658
|
+
const hideEvt = reactNative.Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
|
|
5659
|
+
const show = reactNative.Keyboard.addListener(
|
|
5660
|
+
showEvt,
|
|
5661
|
+
(e) => setKeyboardOffset(Math.max(0, e.endCoordinates.height - insets.bottom))
|
|
5662
|
+
);
|
|
5663
|
+
const hide = reactNative.Keyboard.addListener(hideEvt, () => setKeyboardOffset(0));
|
|
5664
|
+
return () => {
|
|
5665
|
+
show.remove();
|
|
5666
|
+
hide.remove();
|
|
5667
|
+
};
|
|
5668
|
+
}, [avoidKeyboard, insets.bottom]);
|
|
5646
5669
|
react.useEffect(() => {
|
|
5647
5670
|
if (open) {
|
|
5648
5671
|
reactNative.Animated.parallel([
|
|
@@ -5720,6 +5743,8 @@ var BottomSheet = ({
|
|
|
5720
5743
|
// Clear the home indicator so the last row is never cut off / hard
|
|
5721
5744
|
// to tap on devices with a bottom safe area.
|
|
5722
5745
|
paddingBottom: Math.max(insets.bottom, tokens.spacing.sp4),
|
|
5746
|
+
// Lift above the keyboard when a field inside is focused.
|
|
5747
|
+
marginBottom: keyboardOffset,
|
|
5723
5748
|
transform: [{ translateY }]
|
|
5724
5749
|
},
|
|
5725
5750
|
style
|
|
@@ -5777,15 +5802,20 @@ var BottomSheet = ({
|
|
|
5777
5802
|
]
|
|
5778
5803
|
}
|
|
5779
5804
|
),
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5805
|
+
(() => {
|
|
5806
|
+
const keyboardCap = keyboardOffset > 0 ? Math.max(160, windowHeight - keyboardOffset - insets.bottom - 140) : void 0;
|
|
5807
|
+
const effectiveMax = maxContentHeight != null && keyboardCap != null ? Math.min(maxContentHeight, keyboardCap) : maxContentHeight ?? keyboardCap;
|
|
5808
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5809
|
+
reactNative.ScrollView,
|
|
5810
|
+
{
|
|
5811
|
+
style: { maxHeight: effectiveMax },
|
|
5812
|
+
showsVerticalScrollIndicator: false,
|
|
5813
|
+
bounces: false,
|
|
5814
|
+
keyboardShouldPersistTaps: "handled",
|
|
5815
|
+
children
|
|
5816
|
+
}
|
|
5817
|
+
);
|
|
5818
|
+
})()
|
|
5789
5819
|
]
|
|
5790
5820
|
}
|
|
5791
5821
|
)
|