react-native-ui-lib 8.4.3 → 8.5.0
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/lib/package.json +1 -1
- package/package.json +4 -4
- package/src/components/WheelPicker/usePresenter.d.ts +0 -1
- package/src/components/chipsInput/index.d.ts +2 -0
- package/src/components/colorPicker/ColorPickerPresenter.d.ts +1 -1
- package/src/components/floatingButton/index.d.ts +1 -1
- package/src/components/floatingButton/index.js +10 -6
- package/src/components/screenFooter/index.d.ts +2 -2
- package/src/components/screenFooter/index.js +32 -63
- package/src/components/screenFooter/screenFooter.api.json +13 -2
- package/src/components/screenFooter/types.d.ts +23 -6
- package/src/components/screenFooter/types.js +6 -0
- package/src/components/screenFooter/useAnimatedFooterStyle.d.ts +14 -0
- package/src/components/screenFooter/useAnimatedFooterStyle.js +72 -0
- package/src/helpers/AvatarHelper.d.ts +1 -1
- package/src/incubator/slider/Thumb.js +1 -1
- package/src/index.d.ts +2 -2
- package/src/index.js +21 -0
- package/src/testkit/Component.driver.d.ts +0 -1
- package/src/testkit/drivers/TestingLibraryDriver.d.ts +0 -1
package/lib/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ui-lib",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"author": "Ethan Sharabi <ethan.shar@gmail.com>",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"date-fns": "^2.29.3",
|
|
35
35
|
"deprecated-react-native-prop-types": "^2.3.0",
|
|
36
36
|
"hoist-non-react-statics": "^3.0.0",
|
|
37
|
-
"lodash": "
|
|
37
|
+
"lodash": "4.18.1",
|
|
38
38
|
"memoize-one": "^5.0.5",
|
|
39
39
|
"prop-types": "^15.5.10",
|
|
40
40
|
"react-freeze": "^1.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@react-native/metro-config": "0.77.3",
|
|
67
67
|
"@react-native/typescript-config": "0.77.3",
|
|
68
68
|
"@shopify/flash-list": "1.7.6",
|
|
69
|
-
"@testing-library/react-native": "
|
|
69
|
+
"@testing-library/react-native": "12.9.0",
|
|
70
70
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
71
71
|
"@types/jest": "^29.5.13",
|
|
72
72
|
"@types/lodash": "^4.0.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"light-date": "^1.2.0",
|
|
83
83
|
"moment": "^2.24.0",
|
|
84
84
|
"object-hash": "^3.0.0",
|
|
85
|
-
"postcss": "^8.
|
|
85
|
+
"postcss": "^8.5.8",
|
|
86
86
|
"postcss-js": "^4.0.0",
|
|
87
87
|
"prettier": "^3.2.5",
|
|
88
88
|
"react": "18.3.1",
|
|
@@ -5,6 +5,8 @@ export declare enum ChipsInputChangeReason {
|
|
|
5
5
|
Added = "added",
|
|
6
6
|
Removed = "removed"
|
|
7
7
|
}
|
|
8
|
+
type ChipsInputChangeReasonUnion = `${ChipsInputChangeReason}`;
|
|
9
|
+
export type ChipsInputChangeReasonProps = ChipsInputChangeReasonUnion | ChipsInputChangeReason;
|
|
8
10
|
export type ChipsInputChipProps = ChipProps & {
|
|
9
11
|
invalid?: boolean;
|
|
10
12
|
};
|
|
@@ -12,5 +12,5 @@ export declare function getValidColorString(text?: string): {
|
|
|
12
12
|
valid: boolean;
|
|
13
13
|
hex?: undefined;
|
|
14
14
|
};
|
|
15
|
-
export declare function getHexString(color: HSLColor): string
|
|
15
|
+
export declare function getHexString(color: HSLColor): Uppercase<string>;
|
|
16
16
|
export declare function getTextColor(color: string): string;
|
|
@@ -5,7 +5,7 @@ export declare enum FloatingButtonLayouts {
|
|
|
5
5
|
VERTICAL = "Vertical",
|
|
6
6
|
HORIZONTAL = "Horizontal"
|
|
7
7
|
}
|
|
8
|
-
export interface FloatingButtonProps extends Pick<ScreenFooterProps, 'isAndroidEdgeToEdge'> {
|
|
8
|
+
export interface FloatingButtonProps extends Pick<ScreenFooterProps, 'isAndroidEdgeToEdge' | 'animationType'> {
|
|
9
9
|
/**
|
|
10
10
|
* Whether the button is visible
|
|
11
11
|
*/
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
import { asBaseComponent, Constants } from "../../commons/new";
|
|
4
4
|
import { LogService } from "../../services";
|
|
5
|
-
import { Colors, Shadows } from "../../style";
|
|
5
|
+
import { Colors, Shadows, Spacings } from "../../style";
|
|
6
6
|
import Button from "../button";
|
|
7
7
|
import ScreenFooter, { ScreenFooterLayouts, ScreenFooterBackgrounds, KeyboardBehavior, ItemsFit } from "../screenFooter";
|
|
8
8
|
export let FloatingButtonLayouts = /*#__PURE__*/function (FloatingButtonLayouts) {
|
|
@@ -29,22 +29,26 @@ const FloatingButton = props => {
|
|
|
29
29
|
hideBackgroundOverlay,
|
|
30
30
|
hoisted = Constants.isAndroid,
|
|
31
31
|
isAndroidEdgeToEdge,
|
|
32
|
+
animationType,
|
|
32
33
|
testID
|
|
33
34
|
} = props;
|
|
34
35
|
useEffect(() => {
|
|
35
36
|
// eslint-disable-next-line max-len
|
|
36
37
|
LogService.warn('RNUILib FloatingButton now uses ScreenFooter internally, which requires a SafeAreaProvider. If you experience safe area issues, please wrap your app (or the relevant screen) with <SafeAreaProvider>.');
|
|
37
38
|
}, []);
|
|
39
|
+
const isSecondaryOnly = !!secondaryButton && !button;
|
|
40
|
+
const isHorizontal = buttonLayout === FloatingButtonLayouts.HORIZONTAL || isSecondaryOnly;
|
|
38
41
|
const footerContentContainerStyle = useMemo(() => {
|
|
39
42
|
if (bottomMargin !== undefined) {
|
|
40
43
|
return {
|
|
41
44
|
paddingBottom: bottomMargin
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
const isSecondaryAtBottom = !!secondaryButton && (isSecondaryOnly || !isHorizontal);
|
|
48
|
+
return {
|
|
49
|
+
paddingBottom: isSecondaryAtBottom ? Spacings.s7 : Spacings.s8
|
|
50
|
+
};
|
|
51
|
+
}, [bottomMargin, secondaryButton, isSecondaryOnly, isHorizontal]);
|
|
48
52
|
if (!button && !secondaryButton) {
|
|
49
53
|
return null;
|
|
50
54
|
}
|
|
@@ -67,7 +71,7 @@ const FloatingButton = props => {
|
|
|
67
71
|
}] : undefined} enableShadow={false} />;
|
|
68
72
|
};
|
|
69
73
|
const children = isHorizontal ? [renderSecondaryButton(), renderPrimaryButton()] : [renderPrimaryButton(), renderSecondaryButton()];
|
|
70
|
-
return <ScreenFooter visible={visible} layout={isHorizontal ? ScreenFooterLayouts.HORIZONTAL : ScreenFooterLayouts.VERTICAL} backgroundType={hideBackgroundOverlay ? ScreenFooterBackgrounds.TRANSPARENT : ScreenFooterBackgrounds.FADING} keyboardBehavior={hoisted ? KeyboardBehavior.HOISTED : KeyboardBehavior.STICKY} isAndroidEdgeToEdge={isAndroidEdgeToEdge} animationDuration={withoutAnimation ? 0 : duration} itemsFit={fullWidth ? ItemsFit.STRETCH : undefined} contentContainerStyle={footerContentContainerStyle} testID={testID}>
|
|
74
|
+
return <ScreenFooter visible={visible} layout={isHorizontal ? ScreenFooterLayouts.HORIZONTAL : ScreenFooterLayouts.VERTICAL} backgroundType={hideBackgroundOverlay ? ScreenFooterBackgrounds.TRANSPARENT : ScreenFooterBackgrounds.FADING} keyboardBehavior={hoisted ? KeyboardBehavior.HOISTED : KeyboardBehavior.STICKY} isAndroidEdgeToEdge={isAndroidEdgeToEdge} animationDuration={withoutAnimation ? 0 : duration} animationType={animationType} itemsFit={fullWidth ? ItemsFit.STRETCH : undefined} contentContainerStyle={footerContentContainerStyle} testID={testID}>
|
|
71
75
|
{children}
|
|
72
76
|
</ScreenFooter>;
|
|
73
77
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterShadow } from './types';
|
|
3
|
-
export { ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterShadow };
|
|
2
|
+
import { ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterAnimationTypeProp, ScreenFooterShadow } from './types';
|
|
3
|
+
export { ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterAnimationTypeProp, ScreenFooterShadow };
|
|
4
4
|
declare const _default: React.ForwardRefExoticComponent<ScreenFooterProps & React.RefAttributes<any>> & {
|
|
5
5
|
(props: ScreenFooterProps): React.JSX.Element;
|
|
6
6
|
displayName: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
|
-
import Animated
|
|
3
|
+
import Animated from 'react-native-reanimated';
|
|
4
4
|
import { Keyboard } from 'uilib-native';
|
|
5
5
|
import { SafeAreaContextPackage } from "../../optionalDependencies";
|
|
6
6
|
import View from "../view";
|
|
@@ -9,9 +9,9 @@ import Assets from "../../assets";
|
|
|
9
9
|
import { Colors, Shadows, Spacings } from "../../style";
|
|
10
10
|
import { asBaseComponent, Constants } from "../../commons/new";
|
|
11
11
|
import { useKeyboardHeight } from "../../hooks";
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
import useAnimatedFooterStyle from "./useAnimatedFooterStyle";
|
|
13
|
+
import { ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterAnimationTypeProp, ScreenFooterShadow } from "./types";
|
|
14
|
+
export { ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterAnimationTypeProp, ScreenFooterShadow };
|
|
15
15
|
const ScreenFooter = props => {
|
|
16
16
|
const {
|
|
17
17
|
testID,
|
|
@@ -25,44 +25,24 @@ const ScreenFooter = props => {
|
|
|
25
25
|
itemWidth,
|
|
26
26
|
horizontalItemsDistribution: distribution,
|
|
27
27
|
visible = true,
|
|
28
|
-
animationDuration
|
|
28
|
+
animationDuration,
|
|
29
|
+
animationType,
|
|
29
30
|
shadow = ScreenFooterShadow.SH20,
|
|
30
31
|
hideDivider = false,
|
|
31
|
-
isAndroidEdgeToEdge
|
|
32
|
+
isAndroidEdgeToEdge,
|
|
33
|
+
containerStyle: containerStyleOverride,
|
|
32
34
|
contentContainerStyle: contentContainerStyleOverride
|
|
33
35
|
} = props;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
visibilityTranslateY.value = withTiming(visible ? 0 : height, {
|
|
45
|
-
duration: animationDuration
|
|
46
|
-
});
|
|
47
|
-
}, [visible, height, animationDuration, visibilityTranslateY]);
|
|
48
|
-
|
|
49
|
-
// Animated style for STICKY behavior (counters Android system offset + visibility)
|
|
50
|
-
const stickyAnimatedStyle = useAnimatedStyle(() => {
|
|
51
|
-
const counterSystemOffset = Constants.isAndroid ? keyboard.height.value : 0;
|
|
52
|
-
return {
|
|
53
|
-
transform: [{
|
|
54
|
-
translateY: counterSystemOffset + visibilityTranslateY.value
|
|
55
|
-
}]
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Animated style for HOISTED behavior (visibility only, keyboard handled by KeyboardAccessoryView)
|
|
60
|
-
const hoistedAnimatedStyle = useAnimatedStyle(() => {
|
|
61
|
-
return {
|
|
62
|
-
transform: [{
|
|
63
|
-
translateY: visibilityTranslateY.value
|
|
64
|
-
}]
|
|
65
|
-
};
|
|
36
|
+
const {
|
|
37
|
+
containerStyle,
|
|
38
|
+
setHeight
|
|
39
|
+
} = useAnimatedFooterStyle({
|
|
40
|
+
animationDuration,
|
|
41
|
+
animationType,
|
|
42
|
+
keyboardBehavior,
|
|
43
|
+
visible,
|
|
44
|
+
isAndroidEdgeToEdge,
|
|
45
|
+
containerStyle: containerStyleOverride
|
|
66
46
|
});
|
|
67
47
|
const onLayout = useCallback(event => {
|
|
68
48
|
setHeight(event.nativeEvent.layout.height);
|
|
@@ -163,13 +143,13 @@ const ScreenFooter = props => {
|
|
|
163
143
|
maxWidth: '100%'
|
|
164
144
|
};
|
|
165
145
|
return <View key={index} style={fixedStyle}>
|
|
166
|
-
|
|
167
|
-
|
|
146
|
+
{child}
|
|
147
|
+
</View>;
|
|
168
148
|
}
|
|
169
149
|
if (isHorizontal && React.isValidElement(child) && itemsFit === ItemsFit.STRETCH) {
|
|
170
150
|
return <View flex row centerH key={index}>
|
|
171
|
-
|
|
172
|
-
|
|
151
|
+
{child}
|
|
152
|
+
</View>;
|
|
173
153
|
}
|
|
174
154
|
return child;
|
|
175
155
|
}, [itemsFit, itemWidth, isHorizontal]);
|
|
@@ -182,30 +162,19 @@ const ScreenFooter = props => {
|
|
|
182
162
|
</View>
|
|
183
163
|
</>;
|
|
184
164
|
}, [renderBackground, testID, contentContainerStyle, childrenArray]);
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}, [
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
<Keyboard.KeyboardAccessoryView renderContent={renderFooterContent} kbInputRef={undefined} scrollBehavior={Keyboard.KeyboardAccessoryView.scrollBehaviors.FIXED_OFFSET} useSafeArea={false} manageScrollView={false} revealKeyboardInteractive onHeightChanged={setHeight} />
|
|
195
|
-
</Container>;
|
|
196
|
-
}
|
|
197
|
-
return <Animated.View testID={testID} onLayout={onLayout} style={[styles.container, stickyAnimatedStyle]}>
|
|
198
|
-
{renderFooterContent()}
|
|
165
|
+
const renderKeyboardAwareFooter = useCallback(() => {
|
|
166
|
+
if (keyboardBehavior === 'hoisted') {
|
|
167
|
+
return <Keyboard.KeyboardAccessoryView renderContent={renderFooterContent} kbInputRef={undefined} scrollBehavior={Keyboard.KeyboardAccessoryView.scrollBehaviors.FIXED_OFFSET} useSafeArea={false} manageScrollView={false} revealKeyboardInteractive onHeightChanged={setHeight} />;
|
|
168
|
+
} else {
|
|
169
|
+
return renderFooterContent();
|
|
170
|
+
}
|
|
171
|
+
}, [keyboardBehavior, renderFooterContent]);
|
|
172
|
+
return <Animated.View testID={testID} style={containerStyle} onLayout={keyboardBehavior === 'hoisted' ? undefined : onLayout} pointerEvents={!visible ? 'none' : keyboardBehavior === 'hoisted' ? 'box-none' : 'auto'}>
|
|
173
|
+
{renderKeyboardAwareFooter()}
|
|
199
174
|
</Animated.View>;
|
|
200
175
|
};
|
|
201
176
|
ScreenFooter.displayName = 'ScreenFooter';
|
|
202
177
|
const styles = StyleSheet.create({
|
|
203
|
-
container: {
|
|
204
|
-
position: 'absolute',
|
|
205
|
-
bottom: 0,
|
|
206
|
-
left: 0,
|
|
207
|
-
right: 0
|
|
208
|
-
},
|
|
209
178
|
contentContainer: {
|
|
210
179
|
paddingTop: Spacings.s4,
|
|
211
180
|
paddingHorizontal: Spacings.s5,
|
|
@@ -55,13 +55,19 @@
|
|
|
55
55
|
{
|
|
56
56
|
"name": "visible",
|
|
57
57
|
"type": "boolean",
|
|
58
|
-
"description": "If true, the footer is visible. If false,
|
|
58
|
+
"description": "If true, the footer is visible. If false, the footer is hidden using the configured animation type",
|
|
59
59
|
"default": "true"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"name": "animationType",
|
|
63
|
+
"type": "ScreenFooterAnimationTypeProp",
|
|
64
|
+
"description": "The animation type for showing/hiding the footer [slide, fade, none]",
|
|
65
|
+
"default": "'slide'"
|
|
66
|
+
},
|
|
61
67
|
{
|
|
62
68
|
"name": "animationDuration",
|
|
63
69
|
"type": "number",
|
|
64
|
-
"description": "Duration of the show/hide animation in ms",
|
|
70
|
+
"description": "Duration of the show/hide animation in ms (sending 0 will disable the animation)",
|
|
65
71
|
"default": "200"
|
|
66
72
|
},
|
|
67
73
|
{
|
|
@@ -87,6 +93,11 @@
|
|
|
87
93
|
"type": "boolean",
|
|
88
94
|
"description": "Indicates if the device is an Android device that supports edge-to-edge. Defaults to true for Android with version 35 and above, undefined for others."
|
|
89
95
|
},
|
|
96
|
+
{
|
|
97
|
+
"name": "containerStyle",
|
|
98
|
+
"type": "StyleProp<ViewStyle>",
|
|
99
|
+
"description": "Custom style for the outer container of the footer. Can be used to override zIndex or other container-level properties."
|
|
100
|
+
},
|
|
90
101
|
{
|
|
91
102
|
"name": "contentContainerStyle",
|
|
92
103
|
"type": "StyleProp<ViewStyle>",
|
|
@@ -32,7 +32,25 @@ export declare enum ScreenFooterShadow {
|
|
|
32
32
|
SH20 = "sh20",
|
|
33
33
|
SH30 = "sh30"
|
|
34
34
|
}
|
|
35
|
-
export
|
|
35
|
+
export declare enum ScreenFooterAnimation {
|
|
36
|
+
NONE = "none",
|
|
37
|
+
SLIDE = "slide",
|
|
38
|
+
FADE = "fade"
|
|
39
|
+
}
|
|
40
|
+
export type ScreenFooterAnimationTypeProp = ScreenFooterAnimation | `${ScreenFooterAnimation}`;
|
|
41
|
+
export interface AnimatedFooterStyleProps {
|
|
42
|
+
/**
|
|
43
|
+
* The type of animation to use when showing or hiding the footer.
|
|
44
|
+
* @default 'slide'
|
|
45
|
+
*/
|
|
46
|
+
animationType?: ScreenFooterAnimationTypeProp;
|
|
47
|
+
/**
|
|
48
|
+
* Duration of the show/hide animation in ms (sending 0 will disable the animation).
|
|
49
|
+
* @default 200
|
|
50
|
+
*/
|
|
51
|
+
animationDuration?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface ScreenFooterProps extends AnimatedFooterStyleProps, PropsWithChildren<{}> {
|
|
36
54
|
/**
|
|
37
55
|
* Used as testing identifier
|
|
38
56
|
*/
|
|
@@ -78,11 +96,6 @@ export interface ScreenFooterProps extends PropsWithChildren<{}> {
|
|
|
78
96
|
* If true, the footer is visible. If false, it slides down.
|
|
79
97
|
*/
|
|
80
98
|
visible?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Duration of the show/hide animation in ms.
|
|
83
|
-
* @default 200
|
|
84
|
-
*/
|
|
85
|
-
animationDuration?: number;
|
|
86
99
|
/**
|
|
87
100
|
* If true, the footer will respect the safe area (add bottom padding)
|
|
88
101
|
*/
|
|
@@ -97,6 +110,10 @@ export interface ScreenFooterProps extends PropsWithChildren<{}> {
|
|
|
97
110
|
* Only applies when backgroundType is 'solid'
|
|
98
111
|
*/
|
|
99
112
|
hideDivider?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Custom style for the outer container of the footer.
|
|
115
|
+
*/
|
|
116
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
100
117
|
/**
|
|
101
118
|
* Custom style for the content container that wraps the footer's children.
|
|
102
119
|
* Can be used to override default padding, gap, or other layout properties.
|
|
@@ -36,4 +36,10 @@ export let ScreenFooterShadow = /*#__PURE__*/function (ScreenFooterShadow) {
|
|
|
36
36
|
ScreenFooterShadow["SH20"] = "sh20";
|
|
37
37
|
ScreenFooterShadow["SH30"] = "sh30";
|
|
38
38
|
return ScreenFooterShadow;
|
|
39
|
+
}({});
|
|
40
|
+
export let ScreenFooterAnimation = /*#__PURE__*/function (ScreenFooterAnimation) {
|
|
41
|
+
ScreenFooterAnimation["NONE"] = "none";
|
|
42
|
+
ScreenFooterAnimation["SLIDE"] = "slide";
|
|
43
|
+
ScreenFooterAnimation["FADE"] = "fade";
|
|
44
|
+
return ScreenFooterAnimation;
|
|
39
45
|
}({});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
import { AnimatedFooterStyleProps, ScreenFooterProps } from './types';
|
|
4
|
+
declare const useAnimatedFooterStyle: (props: AnimatedFooterStyleProps & Pick<ScreenFooterProps, 'keyboardBehavior' | 'visible' | 'isAndroidEdgeToEdge' | 'containerStyle'>) => {
|
|
5
|
+
containerStyle: (import("react-native").StyleProp<ViewStyle> | {
|
|
6
|
+
position: "absolute";
|
|
7
|
+
bottom: number;
|
|
8
|
+
left: number;
|
|
9
|
+
right: number;
|
|
10
|
+
zIndex: number;
|
|
11
|
+
})[];
|
|
12
|
+
setHeight: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
13
|
+
};
|
|
14
|
+
export default useAnimatedFooterStyle;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useAnimatedKeyboard, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { Constants } from "../../commons/new";
|
|
4
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
5
|
+
const androidVersion = Constants.getAndroidVersion();
|
|
6
|
+
const useAnimatedFooterStyle = props => {
|
|
7
|
+
const {
|
|
8
|
+
animationType: animationTypeProp = 'slide',
|
|
9
|
+
animationDuration: animationDurationProp = 200,
|
|
10
|
+
keyboardBehavior,
|
|
11
|
+
visible,
|
|
12
|
+
isAndroidEdgeToEdge = !!androidVersion && androidVersion >= 35 ? true : undefined,
|
|
13
|
+
containerStyle: containerStyleOverride
|
|
14
|
+
} = props;
|
|
15
|
+
const animationType = animationDurationProp === 0 ? 'none' : animationTypeProp;
|
|
16
|
+
const animationDuration = animationType === 'none' ? 0 : animationDurationProp;
|
|
17
|
+
const keyboard = useAnimatedKeyboard({
|
|
18
|
+
isNavigationBarTranslucentAndroid: isAndroidEdgeToEdge,
|
|
19
|
+
isStatusBarTranslucentAndroid: isAndroidEdgeToEdge
|
|
20
|
+
});
|
|
21
|
+
const [height, setHeight] = useState(0);
|
|
22
|
+
const animatedValue = useSharedValue(animationType === 'fade' && visible ? 1 : 0);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (animationType === 'slide') {
|
|
25
|
+
animatedValue.value = withTiming(visible ? 0 : height, {
|
|
26
|
+
duration: animationDuration
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
animatedValue.value = withTiming(visible ? 1 : 0, {
|
|
30
|
+
duration: animationDuration
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}, [visible, height, animationDuration, animatedValue, animationType]);
|
|
34
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
35
|
+
let style = {};
|
|
36
|
+
let translateY = 0;
|
|
37
|
+
if (animationType === 'slide') {
|
|
38
|
+
translateY = animatedValue.value;
|
|
39
|
+
} else {
|
|
40
|
+
style = {
|
|
41
|
+
opacity: animatedValue.value
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (keyboardBehavior === 'sticky' && Constants.isAndroid) {
|
|
45
|
+
translateY += keyboard.height.value;
|
|
46
|
+
}
|
|
47
|
+
if (animationType === 'slide' || translateY !== 0) {
|
|
48
|
+
style.transform = [{
|
|
49
|
+
translateY
|
|
50
|
+
}];
|
|
51
|
+
}
|
|
52
|
+
return style;
|
|
53
|
+
});
|
|
54
|
+
const containerStyle = useMemo(() => {
|
|
55
|
+
return [styles.container, animatedStyle, containerStyleOverride];
|
|
56
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
|
+
}, [containerStyleOverride]);
|
|
58
|
+
return {
|
|
59
|
+
containerStyle,
|
|
60
|
+
setHeight
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export default useAnimatedFooterStyle;
|
|
64
|
+
const styles = StyleSheet.create({
|
|
65
|
+
container: {
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
bottom: 0,
|
|
68
|
+
left: 0,
|
|
69
|
+
right: 0,
|
|
70
|
+
zIndex: 50
|
|
71
|
+
}
|
|
72
|
+
});
|
|
@@ -2,7 +2,7 @@ export declare function getInitialsTypography(size: number): import("react-nativ
|
|
|
2
2
|
export declare function hashStringToNumber(str?: string): number;
|
|
3
3
|
export declare function getAvatarColors(): string[];
|
|
4
4
|
export declare function getColorById(id: string, avatarColors?: string[]): string;
|
|
5
|
-
export declare function getInitials(name?: string, limit?: number): string
|
|
5
|
+
export declare function getInitials(name?: string, limit?: number): Uppercase<string>;
|
|
6
6
|
export declare function getBackgroundColor(name?: string, avatarColors?: string[], hashFunction?: (name?: string) => number, defaultColor?: string): string | undefined;
|
|
7
7
|
export declare function isGravatarUrl(url: string): boolean;
|
|
8
8
|
export declare function isBlankGravatarUrl(url: string): boolean;
|
|
@@ -40,7 +40,7 @@ const Thumb = props => {
|
|
|
40
40
|
height: THUMB_SIZE
|
|
41
41
|
});
|
|
42
42
|
const lastOffset = useSharedValue(0);
|
|
43
|
-
const gesture = Gesture.Pan().onBegin(() => {
|
|
43
|
+
const gesture = Gesture.Pan().hitSlop(hitSlop).onBegin(() => {
|
|
44
44
|
onSeekStart?.();
|
|
45
45
|
isPressed.value = true;
|
|
46
46
|
lastOffset.value = offset.value;
|
package/src/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export { default as Button, ButtonProps, ButtonSize, ButtonAnimationDirection }
|
|
|
23
23
|
export { default as Card, CardProps, CardSectionProps, CardSelectionOptions } from './components/card';
|
|
24
24
|
export { default as Carousel, CarouselProps, PageControlPosition } from './components/carousel';
|
|
25
25
|
export { default as Checkbox, CheckboxProps, CheckboxRef } from './components/checkbox';
|
|
26
|
-
export { default as ChipsInput, ChipsInputProps, ChipsInputChipProps } from './components/chipsInput';
|
|
26
|
+
export { default as ChipsInput, ChipsInputProps, ChipsInputChipProps, ChipsInputChangeReason, ChipsInputChangeReasonProps } from './components/chipsInput';
|
|
27
27
|
export { default as Chip, ChipProps } from './components/chip';
|
|
28
28
|
export { default as ColorPicker, ColorPickerProps } from './components/colorPicker';
|
|
29
29
|
export { default as ColorPalette, ColorPaletteProps } from './components/colorPalette';
|
|
@@ -38,7 +38,7 @@ export { default as ExpandableSection, ExpandableSectionProps } from './componen
|
|
|
38
38
|
export { default as Fader, FaderProps, FaderPosition } from './components/fader';
|
|
39
39
|
export { default as FeatureHighlight, FeatureHighlightProps } from './components/featureHighlight';
|
|
40
40
|
export { default as FloatingButton, FloatingButtonProps, FloatingButtonLayouts } from './components/floatingButton';
|
|
41
|
-
export { default as ScreenFooter, ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterShadow } from './components/screenFooter';
|
|
41
|
+
export { default as ScreenFooter, ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterAnimationTypeProp, ScreenFooterShadow } from './components/screenFooter';
|
|
42
42
|
export { default as Gradient, GradientProps, GradientTypes } from './components/gradient';
|
|
43
43
|
export { default as Slider } from './components/slider';
|
|
44
44
|
export { default as GradientSlider } from './components/slider/GradientSlider';
|
package/src/index.js
CHANGED
|
@@ -61,6 +61,8 @@ var _exportNames = {
|
|
|
61
61
|
ChipsInput: true,
|
|
62
62
|
ChipsInputProps: true,
|
|
63
63
|
ChipsInputChipProps: true,
|
|
64
|
+
ChipsInputChangeReason: true,
|
|
65
|
+
ChipsInputChangeReasonProps: true,
|
|
64
66
|
Chip: true,
|
|
65
67
|
ChipProps: true,
|
|
66
68
|
ColorPicker: true,
|
|
@@ -107,6 +109,7 @@ var _exportNames = {
|
|
|
107
109
|
HorizontalItemsDistribution: true,
|
|
108
110
|
ItemsFit: true,
|
|
109
111
|
KeyboardBehavior: true,
|
|
112
|
+
ScreenFooterAnimationTypeProp: true,
|
|
110
113
|
ScreenFooterShadow: true,
|
|
111
114
|
Gradient: true,
|
|
112
115
|
GradientProps: true,
|
|
@@ -432,6 +435,18 @@ Object.defineProperty(exports, "ChipsInput", {
|
|
|
432
435
|
return _chipsInput().default;
|
|
433
436
|
}
|
|
434
437
|
});
|
|
438
|
+
Object.defineProperty(exports, "ChipsInputChangeReason", {
|
|
439
|
+
enumerable: true,
|
|
440
|
+
get: function () {
|
|
441
|
+
return _chipsInput().ChipsInputChangeReason;
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
Object.defineProperty(exports, "ChipsInputChangeReasonProps", {
|
|
445
|
+
enumerable: true,
|
|
446
|
+
get: function () {
|
|
447
|
+
return _chipsInput().ChipsInputChangeReasonProps;
|
|
448
|
+
}
|
|
449
|
+
});
|
|
435
450
|
Object.defineProperty(exports, "ChipsInputChipProps", {
|
|
436
451
|
enumerable: true,
|
|
437
452
|
get: function () {
|
|
@@ -1185,6 +1200,12 @@ Object.defineProperty(exports, "ScreenFooter", {
|
|
|
1185
1200
|
return _screenFooter().default;
|
|
1186
1201
|
}
|
|
1187
1202
|
});
|
|
1203
|
+
Object.defineProperty(exports, "ScreenFooterAnimationTypeProp", {
|
|
1204
|
+
enumerable: true,
|
|
1205
|
+
get: function () {
|
|
1206
|
+
return _screenFooter().ScreenFooterAnimationTypeProp;
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1188
1209
|
Object.defineProperty(exports, "ScreenFooterBackgrounds", {
|
|
1189
1210
|
enumerable: true,
|
|
1190
1211
|
get: function () {
|