react-native-ui-lib 8.3.4-snapshot.7813 → 8.3.4-snapshot.7824
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/ReactNativeUiLib.podspec +22 -0
- package/lib/components/HighlighterOverlayView/index.d.ts +2 -2
- package/lib/components/HighlighterOverlayView/index.web.d.ts +2 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardViewBase.d.ts +1 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/index.js +1 -5
- package/lib/components/Keyboard/KeyboardAccessoryView/index.d.ts +2 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/index.js +1 -3
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.ios.js +1 -3
- package/lib/components/Keyboard/KeyboardTrackingView/index.d.ts +2 -6
- package/lib/components/Keyboard/KeyboardTrackingView/index.js +4 -5
- package/lib/components/Keyboard/index.d.ts +1 -2
- package/lib/package.json +21 -20
- package/lib/react-native.config.js +1 -1
- package/package.json +163 -161
- package/src/commons/asBaseComponent.js +1 -2
- package/src/commons/baseComponent.js +8 -0
- package/src/commons/forwardRef.js +4 -1
- package/src/commons/modifiers.d.ts +6 -0
- package/src/commons/modifiers.js +18 -0
- package/src/commons/withScrollEnabler.js +4 -0
- package/src/commons/withScrollReached.js +4 -0
- package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +7 -0
- package/src/components/KeyboardAwareScrollView/KeyboardAwareFlatList.js +6 -0
- package/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +6 -0
- package/src/components/WheelPicker/WheelPicker.driver.d.ts +2 -2
- package/src/components/WheelPicker/index.d.ts +2 -2
- package/src/components/WheelPicker/index.js +1 -1
- package/src/components/WheelPicker/usePresenter.d.ts +1 -1
- package/src/components/actionSheet/index.d.ts +1 -1
- package/src/components/animatedImage/index.d.ts +1 -1
- package/src/components/animatedScanner/index.js +37 -0
- package/src/components/avatar/index.d.ts +1 -1
- package/src/components/badge/index.d.ts +4 -4
- package/src/components/baseInput/index.d.ts +1 -0
- package/src/components/baseInput/index.js +49 -1
- package/src/components/button/index.d.ts +4 -4
- package/src/components/button/types.d.ts +2 -2
- package/src/components/carousel/index.d.ts +8 -8
- package/src/components/carousel/types.d.ts +1 -4
- package/src/components/carousel/types.js +2 -0
- package/src/components/checkbox/index.d.ts +1 -1
- package/src/components/chip/index.d.ts +1 -1
- package/src/components/colorPalette/index.d.ts +1 -1
- package/src/components/dateTimePicker/index.d.ts +2 -2
- package/src/components/dateTimePicker/index.js +2 -2
- package/src/components/dialog/types.d.ts +4 -4
- package/src/components/dialog/useDialogContent.d.ts +1 -1
- package/src/components/drawer/index.d.ts +1 -1
- package/src/components/expandableSection/index.d.ts +2 -2
- package/src/components/fadedScrollView/index.js +1 -1
- package/src/components/featureHighlight/index.js +7 -5
- package/src/components/floatingButton/floatingButton.api.json +10 -15
- package/src/components/floatingButton/index.d.ts +13 -39
- package/src/components/floatingButton/index.js +57 -167
- package/src/components/gridListItem/index.d.ts +7 -7
- package/src/components/gridView/index.d.ts +1 -1
- package/src/components/hint/HintBubble.d.ts +1 -1
- package/src/components/hint/HintOld.d.ts +10 -10
- package/src/components/hint/hooks/useHintLayout.d.ts +1 -1
- package/src/components/hint/index.d.ts +2 -2
- package/src/components/hint/types.d.ts +2 -2
- package/src/components/icon/index.js +3 -0
- package/src/components/image/index.d.ts +1 -1
- package/src/components/image/index.js +17 -20
- package/src/components/loaderScreen/index.d.ts +1 -1
- package/src/components/loaderScreen/types.d.ts +1 -1
- package/src/components/maskedInput/index.d.ts +4 -21
- package/src/components/maskedInput/index.js +16 -78
- package/src/components/maskedInput/maskedInput.api.json +1 -0
- package/src/components/maskedInput/new.d.ts +22 -0
- package/src/components/maskedInput/new.js +85 -0
- package/src/components/maskedInput/old.js +95 -0
- package/src/components/modal/index.d.ts +3 -3
- package/src/components/numberInput/index.js +2 -2
- package/src/components/overlay/index.d.ts +1 -1
- package/src/components/picker/PickerDialog.android.js +15 -0
- package/src/components/picker/PickerDialog.js +7 -0
- package/src/components/picker/helpers/useImperativePickerHandle.d.ts +1 -1
- package/src/components/picker/helpers/useImperativePickerHandle.js +1 -1
- package/src/components/picker/types.d.ts +9 -9
- package/src/components/progressBar/index.d.ts +2 -2
- package/src/components/screenFooter/index.js +10 -7
- package/src/components/screenFooter/screenFooter.api.json +9 -21
- package/src/components/screenFooter/types.d.ts +6 -1
- package/src/components/scrollBar/index.d.ts +4 -11
- package/src/components/searchInput/index.js +1 -1
- package/src/components/searchInput/types.d.ts +2 -2
- package/src/components/sectionsWheelPicker/SectionsWheelPicker.driver.d.ts +2 -2
- package/src/components/skeletonView/index.d.ts +4 -4
- package/src/components/slider/Thumb.d.ts +1 -1
- package/src/components/slider/types.d.ts +1 -1
- package/src/components/stackAggregator/index.d.ts +1 -1
- package/src/components/tabController/TabBarItem.d.ts +2 -2
- package/src/components/tabController/TabBarItem.js +1 -1
- package/src/components/tabController/TabPage.d.ts +2 -2
- package/src/components/tabController/useScrollToItem.d.ts +1 -1
- package/src/components/text/Text.driver.d.ts +1 -1
- package/src/components/textArea/index.js +6 -0
- package/src/components/textField/TextField.driver.new.js +12 -7
- package/src/components/textField/index.js +31 -9
- package/src/components/textField/types.d.ts +4 -4
- package/src/components/textField/useImperativeInputHandle.d.ts +1 -1
- package/src/components/textField/useImperativeInputHandle.js +1 -1
- package/src/components/textField/usePreset.d.ts +36 -36
- package/src/components/textFieldOld/index.d.ts +71 -0
- package/src/components/textFieldOld/index.js +807 -0
- package/src/components/timeline/index.js +1 -1
- package/src/components/toast/index.js +69 -0
- package/src/components/wizard/index.d.ts +1 -1
- package/src/components/wizard/types.d.ts +1 -1
- package/src/components/wizard/wizard.api.json +1 -1
- package/src/helpers/DocsGenerator.js +61 -0
- package/src/hooks/useCombinedRefs/index.js +2 -1
- package/src/hooks/useDebounce/index.js +1 -1
- package/src/hooks/useHiddenLocation/index.js +2 -2
- package/src/hooks/useHiddenLocation/index.web.js +2 -2
- package/src/hooks/useMeasure/index.d.ts +1 -1
- package/src/hooks/useMeasure/index.js +1 -1
- package/src/hooks/useScrollTo/index.d.ts +2 -2
- package/src/incubator/calendar/index.js +1 -1
- package/src/incubator/calendar/types.d.ts +2 -2
- package/src/incubator/expandableOverlay/index.d.ts +2 -2
- package/src/incubator/slider/Track.d.ts +1 -1
- package/src/incubator/slider/index.d.ts +1 -1
- package/src/incubator/toast/helpers/useToastTimer.js +1 -1
- package/src/incubator/toast/index.js +1 -1
- package/src/incubator/toast/types.d.ts +2 -2
- package/src/testkit/Component.driver.d.ts +1 -1
- package/src/testkit/drivers/TestingLibraryDriver.d.ts +1 -1
- package/src/typings/module.d.ts +3 -12
- package/textFieldOld.d.ts +2 -0
- package/textFieldOld.js +1 -0
|
@@ -8,6 +8,6 @@ declare const useDialogContent: (props: InternalDialogCloseButtonProps) => {
|
|
|
8
8
|
containerStyle: false | "" | import("react-native").ViewStyle | import("react-native").RegisteredStyle<import("react-native").ViewStyle> | import("react-native").RecursiveArray<import("react-native").ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").ViewStyle>> | (import("react-native").StyleProp<import("react-native").ViewStyle> | {
|
|
9
9
|
backgroundColor: string;
|
|
10
10
|
})[] | null | undefined;
|
|
11
|
-
containerProps: Omit<import("../../components/view").ViewProps, "style" | "
|
|
11
|
+
containerProps: Omit<import("../../components/view").ViewProps, "style" | "testID" | "ref" | "onLayout" | "animated" | "reanimated"> | undefined;
|
|
12
12
|
};
|
|
13
13
|
export default useDialogContent;
|
|
@@ -126,7 +126,7 @@ declare class Drawer extends PureComponent<DrawerProps> {
|
|
|
126
126
|
};
|
|
127
127
|
leftRender: SwipeableProps['renderLeftActions'];
|
|
128
128
|
rightRender: SwipeableProps['renderLeftActions'];
|
|
129
|
-
_swipeableRow: RefObject<Swipeable
|
|
129
|
+
_swipeableRow: RefObject<Swipeable>;
|
|
130
130
|
animationOptions: SwipeableProps['animationOptions'];
|
|
131
131
|
leftActionX: Animated.Value;
|
|
132
132
|
constructor(props: DrawerProps);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export type ExpandableSectionProps = {
|
|
3
3
|
/**
|
|
4
4
|
* expandableSection header element
|
|
@@ -36,5 +36,5 @@ export type ExpandableSectionProps = {
|
|
|
36
36
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ExpandableSectionScreen.tsx
|
|
37
37
|
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/ExpandableSection/ExpandableSection.gif?raw=true
|
|
38
38
|
*/
|
|
39
|
-
declare function ExpandableSection(props: ExpandableSectionProps): JSX.Element;
|
|
39
|
+
declare function ExpandableSection(props: ExpandableSectionProps): React.JSX.Element;
|
|
40
40
|
export default ExpandableSection;
|
|
@@ -20,7 +20,7 @@ const FadedScrollView = props => {
|
|
|
20
20
|
...others
|
|
21
21
|
} = props;
|
|
22
22
|
const ScrollView = useGesture ? GestureScrollView : RNScrollView;
|
|
23
|
-
const scrollViewRef = useRef(
|
|
23
|
+
const scrollViewRef = useRef();
|
|
24
24
|
const horizontal = propsHorizontal ?? false;
|
|
25
25
|
const {
|
|
26
26
|
onContentSizeChange,
|
|
@@ -200,12 +200,16 @@ class FeatureHighlight extends Component {
|
|
|
200
200
|
{title && <Text text60 style={[styles.title, {
|
|
201
201
|
color,
|
|
202
202
|
marginBottom: message ? titleBottomMargin : messageBottomMargin
|
|
203
|
-
}, titleStyle]} numberOfLines={titleNumberOfLines}
|
|
203
|
+
}, titleStyle]} numberOfLines={titleNumberOfLines}
|
|
204
|
+
// @ts-expect-error
|
|
205
|
+
pointerEvents={'none'}>
|
|
204
206
|
{title}
|
|
205
207
|
</Text>}
|
|
206
208
|
{message && <Text text70 style={[styles.message, {
|
|
207
209
|
color
|
|
208
|
-
}, messageStyle]} numberOfLines={messageNumberOfLines}
|
|
210
|
+
}, messageStyle]} numberOfLines={messageNumberOfLines}
|
|
211
|
+
// @ts-expect-error
|
|
212
|
+
pointerEvents={'none'}>
|
|
209
213
|
{message}
|
|
210
214
|
</Text>}
|
|
211
215
|
<Button label={defaultButtonLabel} size={ButtonSize.medium} labelStyle={{
|
|
@@ -240,9 +244,7 @@ class FeatureHighlight extends Component {
|
|
|
240
244
|
{pageControlProps ? <View flex bottom>
|
|
241
245
|
<PageControl {...pageControlProps} containerStyle={{
|
|
242
246
|
marginBottom: 24
|
|
243
|
-
}} ref={r =>
|
|
244
|
-
this.viewRef = r;
|
|
245
|
-
}} />
|
|
247
|
+
}} ref={r => this.viewRef = r} />
|
|
246
248
|
<View accessible accessibilityLabel={'dismiss button'} />
|
|
247
249
|
</View> : <View flex accessible accessibilityLabel={'dismiss'} accessibilityRole={'button'} />}
|
|
248
250
|
</TouchableWithoutFeedback>
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "FloatingButton",
|
|
3
3
|
"category": "overlays",
|
|
4
|
-
"description": "Hovering button with gradient background",
|
|
5
|
-
"modifiers": [
|
|
6
|
-
"margin",
|
|
7
|
-
"background",
|
|
8
|
-
"color"
|
|
9
|
-
],
|
|
4
|
+
"description": "Hovering button with gradient background, backed by ScreenFooter",
|
|
5
|
+
"modifiers": ["margin", "background", "color"],
|
|
10
6
|
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/FloatingButtonScreen.tsx",
|
|
11
7
|
"images": [
|
|
12
8
|
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/FloatingButton/FloatingButton.gif?raw=true"
|
|
@@ -58,6 +54,12 @@
|
|
|
58
54
|
"type": "boolean",
|
|
59
55
|
"description": "Whether to show background overlay"
|
|
60
56
|
},
|
|
57
|
+
{
|
|
58
|
+
"name": "hoisted",
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"description": "Whether the footer should be hoisted above the keyboard. When true, uses KeyboardAccessoryView for keyboard-aware positioning. When false, uses sticky positioning.",
|
|
61
|
+
"default": "true"
|
|
62
|
+
},
|
|
61
63
|
{
|
|
62
64
|
"name": "testID",
|
|
63
65
|
"type": "string",
|
|
@@ -96,11 +98,7 @@
|
|
|
96
98
|
},
|
|
97
99
|
{
|
|
98
100
|
"type": "table",
|
|
99
|
-
"columns": [
|
|
100
|
-
"Property",
|
|
101
|
-
"Default",
|
|
102
|
-
"Full Width"
|
|
103
|
-
],
|
|
101
|
+
"columns": ["Property", "Default", "Full Width"],
|
|
104
102
|
"items": [
|
|
105
103
|
{
|
|
106
104
|
"title": "Main button",
|
|
@@ -130,10 +128,7 @@
|
|
|
130
128
|
},
|
|
131
129
|
{
|
|
132
130
|
"type": "table",
|
|
133
|
-
"columns": [
|
|
134
|
-
"Layout",
|
|
135
|
-
"Component"
|
|
136
|
-
],
|
|
131
|
+
"columns": ["Layout", "Component"],
|
|
137
132
|
"items": [
|
|
138
133
|
{
|
|
139
134
|
"title": "Horizontal",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, { PropsWithChildren
|
|
2
|
-
import { Animated } from 'react-native';
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
3
2
|
import { ButtonProps } from '../button';
|
|
4
3
|
export declare enum FloatingButtonLayouts {
|
|
5
4
|
VERTICAL = "Vertical",
|
|
@@ -23,7 +22,7 @@ export interface FloatingButtonProps {
|
|
|
23
22
|
*/
|
|
24
23
|
bottomMargin?: number;
|
|
25
24
|
/**
|
|
26
|
-
* Whether the buttons get the container's full
|
|
25
|
+
* Whether the buttons get the container's full width (vertical layout only)
|
|
27
26
|
*/
|
|
28
27
|
fullWidth?: boolean;
|
|
29
28
|
/**
|
|
@@ -42,6 +41,12 @@ export interface FloatingButtonProps {
|
|
|
42
41
|
* Whether to show background overlay
|
|
43
42
|
*/
|
|
44
43
|
hideBackgroundOverlay?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the footer should be hoisted above the keyboard.
|
|
46
|
+
* When true (default), uses KeyboardAccessoryView for keyboard-aware positioning.
|
|
47
|
+
* When false, uses sticky positioning.
|
|
48
|
+
*/
|
|
49
|
+
hoisted?: boolean;
|
|
45
50
|
/**
|
|
46
51
|
* Used as testing identifier
|
|
47
52
|
* <TestID> - the floatingButton container
|
|
@@ -50,40 +55,9 @@ export interface FloatingButtonProps {
|
|
|
50
55
|
*/
|
|
51
56
|
testID?: string;
|
|
52
57
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*/
|
|
59
|
-
declare class FloatingButton extends PureComponent<FloatingButtonProps> {
|
|
60
|
-
static displayName: string;
|
|
61
|
-
static floatingButtonLayouts: typeof FloatingButtonLayouts;
|
|
62
|
-
static defaultProps: {
|
|
63
|
-
duration: number;
|
|
64
|
-
buttonLayout: FloatingButtonLayouts;
|
|
65
|
-
};
|
|
66
|
-
initialVisibility?: boolean;
|
|
67
|
-
firstLoad: boolean;
|
|
68
|
-
visibleAnimated: Animated.Value;
|
|
69
|
-
constructor(props: FloatingButtonProps);
|
|
70
|
-
componentDidUpdate(prevProps: FloatingButtonProps): void;
|
|
71
|
-
getAnimatedStyle: () => {
|
|
72
|
-
opacity: Animated.Value;
|
|
73
|
-
transform: {
|
|
74
|
-
translateY: Animated.AnimatedInterpolation<string | number>;
|
|
75
|
-
}[];
|
|
76
|
-
};
|
|
77
|
-
get isSecondaryOnly(): boolean;
|
|
78
|
-
get isHorizontalLayout(): boolean;
|
|
79
|
-
get isSecondaryHorizontal(): boolean | undefined;
|
|
80
|
-
get isSecondaryVertical(): boolean | undefined;
|
|
81
|
-
renderButton(): React.JSX.Element | undefined;
|
|
82
|
-
renderOverlay: () => React.JSX.Element | undefined;
|
|
83
|
-
renderSecondaryButton(): React.JSX.Element | undefined;
|
|
84
|
-
renderHorizontalLayout(): React.JSX.Element;
|
|
85
|
-
renderVerticalLayout(): React.JSX.Element;
|
|
86
|
-
render(): false | React.JSX.Element | undefined;
|
|
87
|
-
}
|
|
88
|
-
declare const _default: React.ForwardRefExoticComponent<FloatingButtonProps & React.RefAttributes<any>> & typeof FloatingButton;
|
|
58
|
+
declare const _default: React.ForwardRefExoticComponent<FloatingButtonProps & React.RefAttributes<any>> & {
|
|
59
|
+
(props: FloatingButtonProps): React.JSX.Element | null;
|
|
60
|
+
displayName: string;
|
|
61
|
+
floatingButtonLayouts: typeof FloatingButtonLayouts;
|
|
62
|
+
};
|
|
89
63
|
export default _default;
|
|
@@ -1,190 +1,80 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { StyleSheet
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import Image from "../image";
|
|
1
|
+
import React, { useEffect, useMemo } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { asBaseComponent } from "../../commons/new";
|
|
4
|
+
import { LogService } from "../../services";
|
|
5
|
+
import { Colors, Shadows } from "../../style";
|
|
7
6
|
import Button from "../button";
|
|
7
|
+
import ScreenFooter, { ScreenFooterLayouts, ScreenFooterBackgrounds, KeyboardBehavior, ItemsFit } from "../screenFooter";
|
|
8
8
|
export let FloatingButtonLayouts = /*#__PURE__*/function (FloatingButtonLayouts) {
|
|
9
9
|
FloatingButtonLayouts["VERTICAL"] = "Vertical";
|
|
10
10
|
FloatingButtonLayouts["HORIZONTAL"] = "Horizontal";
|
|
11
11
|
return FloatingButtonLayouts;
|
|
12
12
|
}({});
|
|
13
|
-
const gradientImage = () => require("./gradient.png");
|
|
14
|
-
|
|
15
13
|
/**
|
|
16
|
-
* @description: Hovering button with gradient background
|
|
14
|
+
* @description: Hovering button with gradient background, backed by ScreenFooter
|
|
17
15
|
* @modifiers: margin, background, color
|
|
18
16
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/FloatingButtonScreen.tsx
|
|
19
17
|
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/FloatingButton/FloatingButton.gif?raw=true
|
|
20
18
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
useNativeDriver: true
|
|
44
|
-
}).start();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
getAnimatedStyle = () => {
|
|
48
|
-
return {
|
|
49
|
-
opacity: this.visibleAnimated,
|
|
50
|
-
transform: [{
|
|
51
|
-
translateY: this.visibleAnimated.interpolate({
|
|
52
|
-
inputRange: [0, 1],
|
|
53
|
-
outputRange: [Constants.screenHeight / 2, 0]
|
|
54
|
-
})
|
|
55
|
-
}]
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
get isSecondaryOnly() {
|
|
59
|
-
const {
|
|
60
|
-
secondaryButton,
|
|
61
|
-
button
|
|
62
|
-
} = this.props;
|
|
63
|
-
return !!secondaryButton && !button;
|
|
64
|
-
}
|
|
65
|
-
get isHorizontalLayout() {
|
|
66
|
-
const {
|
|
67
|
-
buttonLayout
|
|
68
|
-
} = this.props;
|
|
69
|
-
return buttonLayout === FloatingButtonLayouts.HORIZONTAL || this.isSecondaryOnly;
|
|
70
|
-
}
|
|
71
|
-
get isSecondaryHorizontal() {
|
|
72
|
-
const {
|
|
73
|
-
secondaryButton
|
|
74
|
-
} = this.props;
|
|
75
|
-
return secondaryButton && this.isHorizontalLayout;
|
|
76
|
-
}
|
|
77
|
-
get isSecondaryVertical() {
|
|
78
|
-
const {
|
|
79
|
-
secondaryButton
|
|
80
|
-
} = this.props;
|
|
81
|
-
return secondaryButton && !this.isHorizontalLayout;
|
|
82
|
-
}
|
|
83
|
-
renderButton() {
|
|
84
|
-
const {
|
|
85
|
-
bottomMargin,
|
|
86
|
-
button,
|
|
87
|
-
fullWidth,
|
|
88
|
-
testID
|
|
89
|
-
} = this.props;
|
|
90
|
-
if (button) {
|
|
91
|
-
const shadowStyle = button && !button.outline && !button.link ? styles.shadow : undefined;
|
|
92
|
-
const marginStyle = {
|
|
93
|
-
marginTop: Spacings.s4,
|
|
94
|
-
marginBottom: this.isSecondaryVertical ? Spacings.s4 : bottomMargin || Spacings.s8,
|
|
95
|
-
marginLeft: this.isSecondaryHorizontal || fullWidth ? Spacings.s4 : undefined,
|
|
96
|
-
marginRight: this.isSecondaryHorizontal ? Spacings.s5 : fullWidth ? Spacings.s4 : undefined
|
|
19
|
+
const FloatingButton = props => {
|
|
20
|
+
const {
|
|
21
|
+
visible = false,
|
|
22
|
+
button,
|
|
23
|
+
secondaryButton,
|
|
24
|
+
bottomMargin,
|
|
25
|
+
fullWidth,
|
|
26
|
+
buttonLayout = FloatingButtonLayouts.VERTICAL,
|
|
27
|
+
duration = 300,
|
|
28
|
+
withoutAnimation,
|
|
29
|
+
hideBackgroundOverlay,
|
|
30
|
+
hoisted = true,
|
|
31
|
+
testID
|
|
32
|
+
} = props;
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
// eslint-disable-next-line max-len
|
|
35
|
+
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>.');
|
|
36
|
+
}, []);
|
|
37
|
+
const footerContentContainerStyle = useMemo(() => {
|
|
38
|
+
if (bottomMargin !== undefined) {
|
|
39
|
+
return {
|
|
40
|
+
paddingBottom: bottomMargin
|
|
97
41
|
};
|
|
98
|
-
const shouldFlex = this.isSecondaryHorizontal || fullWidth && this.isHorizontalLayout;
|
|
99
|
-
return <Button size={Button.sizes.large} flex={!!shouldFlex} style={[shadowStyle, marginStyle]} testID={`${testID}.button`} {...button} />;
|
|
100
42
|
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}, [bottomMargin]);
|
|
45
|
+
const isSecondaryOnly = !!secondaryButton && !button;
|
|
46
|
+
const isHorizontal = buttonLayout === FloatingButtonLayouts.HORIZONTAL || isSecondaryOnly;
|
|
47
|
+
if (!button && !secondaryButton) {
|
|
48
|
+
return null;
|
|
101
49
|
}
|
|
102
|
-
|
|
103
|
-
if (!
|
|
104
|
-
return
|
|
105
|
-
<Image style={styles.image} source={gradientImage()} resizeMode={'stretch'} tintColor={Colors.$backgroundDefault} />
|
|
106
|
-
</View>;
|
|
50
|
+
const renderPrimaryButton = () => {
|
|
51
|
+
if (!button) {
|
|
52
|
+
return null;
|
|
107
53
|
}
|
|
54
|
+
const shadowStyle = !button.outline && !button.link ? styles.shadow : undefined;
|
|
55
|
+
const shouldFlex = isHorizontal && !!secondaryButton || fullWidth && isHorizontal;
|
|
56
|
+
return <Button key="primary" size={Button.sizes.large} flex={!!shouldFlex} style={shadowStyle} testID={testID ? `${testID}.button` : undefined} {...button} />;
|
|
108
57
|
};
|
|
109
|
-
renderSecondaryButton() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
bottomMargin,
|
|
113
|
-
testID,
|
|
114
|
-
fullWidth,
|
|
115
|
-
button
|
|
116
|
-
} = this.props;
|
|
117
|
-
if (secondaryButton) {
|
|
118
|
-
const bgColor = secondaryButton.backgroundColor || Colors.$backgroundDefault;
|
|
119
|
-
const shouldFlex = this.isHorizontalLayout && !!button || fullWidth && this.isSecondaryOnly;
|
|
120
|
-
const buttonStyle = this.isHorizontalLayout ? [styles.shadow, styles.horizontalSecondaryMargin, {
|
|
121
|
-
backgroundColor: bgColor
|
|
122
|
-
}] : {
|
|
123
|
-
marginBottom: bottomMargin || Spacings.s7
|
|
124
|
-
};
|
|
125
|
-
return <Button outline={this.isHorizontalLayout} flex={shouldFlex} link={!this.isHorizontalLayout} size={Button.sizes.large} testID={`${testID}.secondaryButton`} {...secondaryButton} style={buttonStyle} enableShadow={false} />;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
renderHorizontalLayout() {
|
|
129
|
-
return <>
|
|
130
|
-
{this.renderOverlay()}
|
|
131
|
-
{this.renderSecondaryButton()}
|
|
132
|
-
{this.renderButton()}
|
|
133
|
-
</>;
|
|
134
|
-
}
|
|
135
|
-
renderVerticalLayout() {
|
|
136
|
-
return <>
|
|
137
|
-
{this.renderOverlay()}
|
|
138
|
-
{this.renderButton()}
|
|
139
|
-
{this.renderSecondaryButton()}
|
|
140
|
-
</>;
|
|
141
|
-
}
|
|
142
|
-
render() {
|
|
143
|
-
// NOTE: keep this.firstLoad as true as long as the visibility changed to true
|
|
144
|
-
const {
|
|
145
|
-
withoutAnimation,
|
|
146
|
-
visible,
|
|
147
|
-
fullWidth,
|
|
148
|
-
testID,
|
|
149
|
-
button,
|
|
150
|
-
secondaryButton
|
|
151
|
-
} = this.props;
|
|
152
|
-
this.firstLoad && !visible ? this.firstLoad = true : this.firstLoad = false;
|
|
153
|
-
|
|
154
|
-
// NOTE: On first load, don't show if it should not be visible
|
|
155
|
-
if (this.firstLoad === true && !this.initialVisibility) {
|
|
156
|
-
return false;
|
|
58
|
+
const renderSecondaryButton = () => {
|
|
59
|
+
if (!secondaryButton) {
|
|
60
|
+
return null;
|
|
157
61
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
62
|
+
const shouldFlex = isHorizontal && !!button || fullWidth && isSecondaryOnly;
|
|
63
|
+
const bgColor = secondaryButton.backgroundColor || Colors.$backgroundDefault;
|
|
64
|
+
return <Button key="secondary" outline={isHorizontal} link={!isHorizontal} flex={shouldFlex} size={Button.sizes.large} testID={testID ? `${testID}.secondaryButton` : undefined} {...secondaryButton} style={isHorizontal ? [styles.shadow, {
|
|
65
|
+
backgroundColor: bgColor
|
|
66
|
+
}] : undefined} enableShadow={false} />;
|
|
67
|
+
};
|
|
68
|
+
const children = isHorizontal ? [renderSecondaryButton(), renderPrimaryButton()] : [renderPrimaryButton(), renderSecondaryButton()];
|
|
69
|
+
return <ScreenFooter visible={visible} layout={isHorizontal ? ScreenFooterLayouts.HORIZONTAL : ScreenFooterLayouts.VERTICAL} backgroundType={hideBackgroundOverlay ? ScreenFooterBackgrounds.TRANSPARENT : ScreenFooterBackgrounds.FADING} keyboardBehavior={hoisted ? KeyboardBehavior.HOISTED : KeyboardBehavior.STICKY} animationDuration={withoutAnimation ? 0 : duration} itemsFit={fullWidth ? ItemsFit.STRETCH : undefined} contentContainerStyle={footerContentContainerStyle} testID={testID}>
|
|
70
|
+
{children}
|
|
71
|
+
</ScreenFooter>;
|
|
72
|
+
};
|
|
73
|
+
FloatingButton.displayName = 'FloatingButton';
|
|
74
|
+
FloatingButton.floatingButtonLayouts = FloatingButtonLayouts;
|
|
170
75
|
const styles = StyleSheet.create({
|
|
171
|
-
container: {
|
|
172
|
-
// ...StyleSheet.absoluteFillObject, // TODO: this is breaking scenarios where the FloatingButton is inside a KeyboardTrackingView
|
|
173
|
-
top: undefined,
|
|
174
|
-
zIndex: 99
|
|
175
|
-
},
|
|
176
|
-
image: {
|
|
177
|
-
...StyleSheet.absoluteFillObject,
|
|
178
|
-
width: '100%',
|
|
179
|
-
height: '100%'
|
|
180
|
-
},
|
|
181
76
|
shadow: {
|
|
182
77
|
...Shadows.sh20.bottom
|
|
183
|
-
},
|
|
184
|
-
horizontalSecondaryMargin: {
|
|
185
|
-
marginTop: Spacings.s4,
|
|
186
|
-
marginBottom: Spacings.s7,
|
|
187
|
-
marginLeft: Spacings.s5
|
|
188
78
|
}
|
|
189
79
|
});
|
|
190
80
|
export default asBaseComponent(FloatingButton);
|
|
@@ -21,7 +21,7 @@ export interface GridListItemProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* Custom GridListItem to be rendered in the GridView
|
|
23
23
|
*/
|
|
24
|
-
renderCustomItem?: () => React.ReactElement
|
|
24
|
+
renderCustomItem?: () => React.ReactElement;
|
|
25
25
|
/**
|
|
26
26
|
* The item size
|
|
27
27
|
*/
|
|
@@ -29,7 +29,7 @@ export interface GridListItemProps {
|
|
|
29
29
|
/**
|
|
30
30
|
* Title content text
|
|
31
31
|
*/
|
|
32
|
-
title?: string | React.ReactElement
|
|
32
|
+
title?: string | React.ReactElement;
|
|
33
33
|
/**
|
|
34
34
|
* Title content typography
|
|
35
35
|
*/
|
|
@@ -45,7 +45,7 @@ export interface GridListItemProps {
|
|
|
45
45
|
/**
|
|
46
46
|
* Subtitle content text
|
|
47
47
|
*/
|
|
48
|
-
subtitle?: string | React.ReactElement
|
|
48
|
+
subtitle?: string | React.ReactElement;
|
|
49
49
|
/**
|
|
50
50
|
* Subtitle content typography
|
|
51
51
|
*/
|
|
@@ -61,7 +61,7 @@ export interface GridListItemProps {
|
|
|
61
61
|
/**
|
|
62
62
|
* Description content text
|
|
63
63
|
*/
|
|
64
|
-
description?: string | React.ReactElement
|
|
64
|
+
description?: string | React.ReactElement;
|
|
65
65
|
/**
|
|
66
66
|
* Description content typography
|
|
67
67
|
*/
|
|
@@ -101,12 +101,12 @@ export interface GridListItemProps {
|
|
|
101
101
|
/**
|
|
102
102
|
* Renders an overlay on top of the image
|
|
103
103
|
*/
|
|
104
|
-
renderOverlay?: () => React.ReactElement
|
|
104
|
+
renderOverlay?: () => React.ReactElement;
|
|
105
105
|
/**
|
|
106
106
|
* Test ID for component
|
|
107
107
|
*/
|
|
108
108
|
testID?: string;
|
|
109
|
-
children?: React.ReactElement
|
|
109
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* @description: A single grid view/list item component
|
|
@@ -122,7 +122,7 @@ declare class GridListItem extends Component<GridListItemProps> {
|
|
|
122
122
|
onItemPress: () => void;
|
|
123
123
|
getItemSizeObj(): ImageSize;
|
|
124
124
|
getContainerHorizontalAlignment: (this: any, horizontalAlignment: any) => "center" | "flex-start" | "flex-end" | undefined;
|
|
125
|
-
renderContent(text: string | React.ReactElement
|
|
125
|
+
renderContent(text: string | React.ReactElement | undefined, textProps: Partial<TextProps>): React.JSX.Element | undefined;
|
|
126
126
|
render(): React.JSX.Element;
|
|
127
127
|
}
|
|
128
128
|
export default GridListItem;
|
|
@@ -39,7 +39,7 @@ export interface GridViewProps {
|
|
|
39
39
|
/**
|
|
40
40
|
* Pass to render a custom item
|
|
41
41
|
*/
|
|
42
|
-
renderCustomItem?: (item: GridListItemProps) => React.ReactElement
|
|
42
|
+
renderCustomItem?: (item: GridListItemProps) => React.ReactElement;
|
|
43
43
|
}
|
|
44
44
|
interface GridViewState {
|
|
45
45
|
viewWidth: number;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { View as RNView, LayoutChangeEvent } from 'react-native';
|
|
3
3
|
import { HintProps } from './types';
|
|
4
4
|
interface HintBubbleProps extends Pick<HintProps, 'testID' | 'visible' | 'message' | 'messageStyle' | 'color' | 'removePaddings' | 'enableShadow' | 'borderRadius' | 'iconStyle' | 'icon' | 'customContent'> {
|
|
5
|
-
hintRef: React.RefObject<RNView
|
|
5
|
+
hintRef: React.RefObject<RNView>;
|
|
6
6
|
setHintLayout: (layoutChangeEvent: LayoutChangeEvent) => void;
|
|
7
7
|
hintPositionStyle: {
|
|
8
8
|
left: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Component, ReactElement, ElementRef
|
|
1
|
+
import React, { Component, ReactElement, ElementRef } from 'react';
|
|
2
2
|
import { Animated, GestureResponderEvent, ImageSourcePropType, ImageStyle, StyleProp, TextStyle, ViewStyle, LayoutChangeEvent, View as RNView } from 'react-native';
|
|
3
3
|
declare enum TARGET_POSITIONS {
|
|
4
4
|
LEFT = "left",
|
|
@@ -18,7 +18,7 @@ interface HintTargetFrame {
|
|
|
18
18
|
type Position = Pick<ViewStyle, 'top' | 'bottom' | 'left' | 'right'>;
|
|
19
19
|
type HintPositionStyle = Position & Pick<ViewStyle, 'alignItems'>;
|
|
20
20
|
type Paddings = Pick<ViewStyle, 'paddingLeft' | 'paddingRight' | 'paddingVertical' | 'paddingHorizontal'>;
|
|
21
|
-
type ContentType = string | ReactElement
|
|
21
|
+
type ContentType = string | ReactElement;
|
|
22
22
|
export interface HintProps {
|
|
23
23
|
/**
|
|
24
24
|
* Control the visibility of the hint
|
|
@@ -130,7 +130,7 @@ declare class Hint extends Component<HintProps, HintState> {
|
|
|
130
130
|
};
|
|
131
131
|
static positions: typeof HintPositions;
|
|
132
132
|
targetRef: ElementRef<typeof RNView> | null;
|
|
133
|
-
hintRef: React.RefObject<RNView
|
|
133
|
+
hintRef: React.RefObject<RNView>;
|
|
134
134
|
animationDuration: number;
|
|
135
135
|
state: {
|
|
136
136
|
targetLayoutInWindow: {
|
|
@@ -183,14 +183,14 @@ declare class Hint extends Component<HintProps, HintState> {
|
|
|
183
183
|
getTipPosition(): Position;
|
|
184
184
|
getHintOffsetForShortMessage: () => number;
|
|
185
185
|
isUsingModal: () => boolean | undefined;
|
|
186
|
-
renderOverlay(): JSX.Element | undefined;
|
|
187
|
-
renderHintTip(): JSX.Element;
|
|
188
|
-
renderHint(): JSX.Element;
|
|
189
|
-
renderHintContainer(): JSX.Element | undefined;
|
|
190
|
-
renderHintAnchor(): JSX.Element;
|
|
191
|
-
renderMockChildren(): JSX.Element | undefined;
|
|
186
|
+
renderOverlay(): React.JSX.Element | undefined;
|
|
187
|
+
renderHintTip(): React.JSX.Element;
|
|
188
|
+
renderHint(): React.JSX.Element;
|
|
189
|
+
renderHintContainer(): React.JSX.Element | undefined;
|
|
190
|
+
renderHintAnchor(): React.JSX.Element;
|
|
191
|
+
renderMockChildren(): React.JSX.Element | undefined;
|
|
192
192
|
renderChildren(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
193
|
-
render(): string | number |
|
|
193
|
+
render(): string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
|
|
194
194
|
}
|
|
195
195
|
declare const _default: React.ForwardRefExoticComponent<HintProps & React.RefAttributes<any>> & typeof Hint;
|
|
196
196
|
export default _default;
|
|
@@ -6,7 +6,7 @@ export default function useHintLayout({ onBackgroundPress, targetFrame }: UseHin
|
|
|
6
6
|
targetLayoutState: LayoutRectangle | undefined;
|
|
7
7
|
targetLayoutInWindowState: LayoutRectangle | undefined;
|
|
8
8
|
hintMessageWidth: number | undefined;
|
|
9
|
-
targetRef: import("react").
|
|
9
|
+
targetRef: import("react").MutableRefObject<RNView | null>;
|
|
10
10
|
onTargetLayout: ({ nativeEvent: { layout } }: LayoutChangeEvent) => void;
|
|
11
11
|
setHintLayout: ({ nativeEvent: { layout } }: LayoutChangeEvent) => void;
|
|
12
12
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HintPositions, HintProps } from './types';
|
|
3
3
|
declare const Hint: {
|
|
4
|
-
(props: HintProps): string | number |
|
|
4
|
+
(props: HintProps): string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
|
|
5
5
|
displayName: string;
|
|
6
6
|
positions: typeof HintPositions;
|
|
7
7
|
};
|
|
8
8
|
export { HintProps, Hint };
|
|
9
9
|
declare const _default: React.ForwardRefExoticComponent<HintProps & React.RefAttributes<any>> & {
|
|
10
|
-
(props: HintProps): string | number |
|
|
10
|
+
(props: HintProps): string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
|
|
11
11
|
displayName: string;
|
|
12
12
|
positions: typeof HintPositions;
|
|
13
13
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ReactElement
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
2
|
import type { GestureResponderEvent, ImageSourcePropType, ImageStyle, LayoutRectangle, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
export type PositionStyle = Pick<ViewStyle, 'top' | 'bottom' | 'left' | 'right'>;
|
|
4
4
|
export type LayoutStyle = PositionStyle & Pick<ViewStyle, 'alignItems'>;
|
|
5
5
|
export type PaddingsStyle = Pick<ViewStyle, 'paddingLeft' | 'paddingRight' | 'paddingVertical' | 'paddingHorizontal'>;
|
|
6
|
-
export type ContentType = string | ReactElement
|
|
6
|
+
export type ContentType = string | ReactElement;
|
|
7
7
|
export declare enum TargetAlignments {
|
|
8
8
|
LEFT = "left",
|
|
9
9
|
RIGHT = "right",
|
|
@@ -50,7 +50,7 @@ export type ImageProps = Omit<RNImageProps, 'source'> & Pick<ImageBackgroundProp
|
|
|
50
50
|
/**
|
|
51
51
|
* Render an overlay with custom content
|
|
52
52
|
*/
|
|
53
|
-
customOverlayContent?: React.ReactElement
|
|
53
|
+
customOverlayContent?: React.ReactElement | React.ReactElement[];
|
|
54
54
|
/**
|
|
55
55
|
* Default image source in case of an error
|
|
56
56
|
*/
|