@mrmeg/expo-ui 0.7.1 → 0.7.3
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/components/BottomSheet.d.ts +92 -16
- package/dist/components/BottomSheet.js +205 -411
- package/dist/components/Dialog.js +16 -8
- package/dist/components/SegmentedControl.d.ts +52 -0
- package/dist/components/SegmentedControl.js +25 -0
- package/dist/components/Slider.d.ts +23 -3
- package/dist/components/Slider.js +26 -147
- package/dist/components/Tabs.d.ts +1 -1
- package/dist/components/Tabs.js +10 -2
- package/dist/components/TextInput.d.ts +1 -1
- package/dist/components/TextInput.js +121 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/package.json +4 -2
- package/dist/components/BottomSheetKeyboard.d.ts +0 -7
- package/dist/components/BottomSheetKeyboard.js +0 -35
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
2
|
-
import { Animated, Keyboard, Platform } from "react-native";
|
|
3
|
-
function animateKeyboardOffset(value, toValue, duration = 180) {
|
|
4
|
-
Animated.timing(value, {
|
|
5
|
-
toValue,
|
|
6
|
-
duration,
|
|
7
|
-
useNativeDriver: true,
|
|
8
|
-
}).start();
|
|
9
|
-
}
|
|
10
|
-
export function useBottomSheetKeyboardAnimation() {
|
|
11
|
-
const keyboardHeight = useRef(new Animated.Value(0)).current;
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (Platform.OS === "web") {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const showEvent = Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
|
|
17
|
-
const hideEvent = Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
|
|
18
|
-
const showSubscription = Keyboard.addListener(showEvent, (event) => {
|
|
19
|
-
animateKeyboardOffset(keyboardHeight, -event.endCoordinates.height, event.duration || 180);
|
|
20
|
-
});
|
|
21
|
-
const hideSubscription = Keyboard.addListener(hideEvent, (event) => {
|
|
22
|
-
animateKeyboardOffset(keyboardHeight, 0, event.duration || 160);
|
|
23
|
-
});
|
|
24
|
-
return () => {
|
|
25
|
-
showSubscription.remove();
|
|
26
|
-
hideSubscription.remove();
|
|
27
|
-
};
|
|
28
|
-
}, [keyboardHeight]);
|
|
29
|
-
return { height: keyboardHeight };
|
|
30
|
-
}
|
|
31
|
-
export const BottomSheetKeyboardController = {
|
|
32
|
-
dismiss() {
|
|
33
|
-
Keyboard.dismiss();
|
|
34
|
-
},
|
|
35
|
-
};
|