react-native-ui-lib 7.44.0-snapshot.7227 → 7.44.0-snapshot.7228
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/babel.config.js +12 -0
- package/lib/components/HighlighterOverlayView/index.js +1 -1
- package/lib/components/HighlighterOverlayView/index.web.d.ts +1 -1
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.ios.js +1 -1
- package/lib/components/SafeArea/SafeAreaInsetsManager.js +1 -4
- package/lib/components/SafeArea/SafeAreaSpacerView.d.ts +2 -2
- package/lib/components/SafeArea/SafeAreaSpacerView.js +11 -8
- package/lib/components/SafeArea/index.d.ts +10 -0
- package/lib/components/SafeArea/index.js +11 -0
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/package.json +1 -1
- package/package.json +2 -2
- package/panView.d.ts +2 -0
- package/panView.js +1 -0
- package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +5 -1
- package/src/components/actionSheet/index.d.ts +2 -12
- package/src/components/actionSheet/index.js +3 -42
- package/src/components/checkbox/index.d.ts +0 -1
- package/src/components/checkbox/index.js +2 -4
- package/src/components/colorPicker/ColorPickerDialog.d.ts +1 -1
- package/src/components/colorPicker/ColorPickerDialog.js +1 -1
- package/src/components/dateTimePicker/index.d.ts +186 -5
- package/src/components/dateTimePicker/index.js +1 -2
- package/src/components/dialog/dialog.api.json +31 -37
- package/src/{incubator → components}/dialog/dialogHeader.api.json +2 -2
- package/src/components/dialog/index.d.ts +13 -105
- package/src/components/dialog/index.js +204 -212
- package/src/{incubator → components}/dialog/types.d.ts +0 -19
- package/src/{incubator → components}/dialog/types.js +1 -3
- package/src/components/featureHighlight/index.d.ts +1 -1
- package/src/components/index.js +0 -19
- package/src/components/pageControl/index.js +6 -1
- package/src/{incubator → components}/panView/index.d.ts +3 -3
- package/src/{incubator → components}/panView/index.js +4 -4
- package/src/{incubator → components}/panView/usePanGesture.d.ts +1 -1
- package/src/components/picker/Picker.driver.new.js +1 -1
- package/src/components/picker/PickerItem.js +6 -20
- package/src/components/picker/PickerPresenter.d.ts +0 -1
- package/src/components/picker/PickerPresenter.js +1 -23
- package/src/components/picker/api/picker.api.json +0 -1
- package/src/components/picker/api/pickerItem.api.json +0 -5
- package/src/components/picker/helpers/usePickerLabel.d.ts +1 -1
- package/src/components/picker/helpers/usePickerLabel.js +2 -3
- package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -1
- package/src/components/picker/helpers/usePickerMigrationWarnings.js +0 -12
- package/src/components/picker/helpers/usePickerSearch.d.ts +1 -1
- package/src/components/picker/helpers/usePickerSearch.js +4 -8
- package/src/components/picker/helpers/usePickerSelection.d.ts +1 -1
- package/src/components/picker/helpers/usePickerSelection.js +2 -10
- package/src/components/picker/index.js +4 -22
- package/src/components/picker/types.d.ts +1 -24
- package/src/components/radioButton/index.js +6 -8
- package/src/components/stackAggregator/index.js +1 -1
- package/src/{incubator/hooks/useHiddenLocation.web.d.ts → hooks/useHiddenLocation/index.d.ts} +1 -1
- package/src/{incubator/hooks/useHiddenLocation.d.ts → hooks/useHiddenLocation/index.web.d.ts} +1 -1
- package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
- package/src/incubator/expandableOverlay/index.d.ts +42 -3
- package/src/incubator/expandableOverlay/index.js +1 -4
- package/src/incubator/index.d.ts +0 -2
- package/src/incubator/index.js +0 -2
- package/src/incubator/toast/index.js +1 -1
- package/src/index.d.ts +3 -10
- package/src/index.js +41 -160
- package/src/style/colors.d.ts +3 -5
- package/src/style/designTokens.js +7 -4
- package/src/testkit/index.d.ts +1 -1
- package/src/testkit/index.js +1 -1
- package/src/utils/styleUtils.d.ts +1 -0
- package/src/utils/styleUtils.js +3 -0
- package/lib/components/HighlighterOverlayView/HighlighterViewNativeComponent.d.ts +0 -61
- package/lib/components/HighlighterOverlayView/HighlighterViewNativeComponent.js +0 -2
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingViewNativeComponent.d.ts +0 -58
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingViewNativeComponent.js +0 -2
- package/panningViews.d.ts +0 -2
- package/panningViews.js +0 -1
- package/sharedTransition.d.ts +0 -2
- package/sharedTransition.js +0 -1
- package/src/components/dialog/DialogDismissibleView.d.ts +0 -34
- package/src/components/dialog/DialogDismissibleView.js +0 -184
- package/src/components/dialog/OverlayFadingBackground.d.ts +0 -14
- package/src/components/dialog/OverlayFadingBackground.js +0 -45
- package/src/components/panningViews/asPanViewConsumer.d.ts +0 -3
- package/src/components/panningViews/asPanViewConsumer.js +0 -16
- package/src/components/panningViews/panDismissibleView.d.ts +0 -51
- package/src/components/panningViews/panDismissibleView.js +0 -350
- package/src/components/panningViews/panGestureView.d.ts +0 -23
- package/src/components/panningViews/panGestureView.js +0 -156
- package/src/components/panningViews/panListenerView.d.ts +0 -66
- package/src/components/panningViews/panListenerView.js +0 -155
- package/src/components/panningViews/panResponderView.d.ts +0 -19
- package/src/components/panningViews/panResponderView.js +0 -79
- package/src/components/panningViews/panningContext.d.ts +0 -3
- package/src/components/panningViews/panningContext.js +0 -4
- package/src/components/panningViews/panningProvider.d.ts +0 -73
- package/src/components/panningViews/panningProvider.js +0 -101
- package/src/components/sharedTransition/ShareTransitionContext.js +0 -3
- package/src/components/sharedTransition/SharedArea.js +0 -153
- package/src/components/sharedTransition/SourceElement.js +0 -44
- package/src/components/sharedTransition/TargetElement.js +0 -38
- package/src/components/sharedTransition/index.js +0 -9
- package/src/incubator/dialog/dialog.api.json +0 -54
- package/src/incubator/dialog/index.d.ts +0 -15
- package/src/incubator/dialog/index.js +0 -218
- /package/src/{incubator → components}/dialog/Dialog.driver.new.d.ts +0 -0
- /package/src/{incubator → components}/dialog/Dialog.driver.new.js +0 -0
- /package/src/{incubator → components}/dialog/DialogHeader.d.ts +0 -0
- /package/src/{incubator → components}/dialog/DialogHeader.js +0 -0
- /package/src/{incubator → components}/dialog/useDialogContent.d.ts +0 -0
- /package/src/{incubator → components}/dialog/useDialogContent.js +0 -0
- /package/src/{incubator → components}/panView/panningUtil.d.ts +0 -0
- /package/src/{incubator → components}/panView/panningUtil.js +0 -0
- /package/src/{incubator → components}/panView/usePanGesture.js +0 -0
- /package/src/{incubator/hooks/useHiddenLocation.js → hooks/useHiddenLocation/index.js} +0 -0
- /package/src/{incubator/hooks/useHiddenLocation.web.js → hooks/useHiddenLocation/index.web.js} +0 -0
package/babel.config.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
presets: ['module:@react-native/babel-preset'],
|
|
3
|
+
env: {
|
|
4
|
+
test: {
|
|
5
|
+
presets: [
|
|
6
|
+
[
|
|
7
|
+
'module:@react-native/babel-preset',
|
|
8
|
+
{
|
|
9
|
+
disableStaticViewConfigsCodegen: true
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
3
15
|
plugins: [
|
|
4
16
|
'react-native-reanimated/plugin',
|
|
5
17
|
[
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { processColor, StyleSheet, Modal } from 'react-native';
|
|
3
3
|
// Import the Codegen specification for New Architecture
|
|
4
|
-
import HighlighterViewNativeComponent from "
|
|
4
|
+
import HighlighterViewNativeComponent from "../../specs/HighlighterViewNativeComponent";
|
|
5
5
|
const DefaultOverlayColor = 'rgba(0, 0, 0, 0.5)';
|
|
6
6
|
const HighlighterOverlayView = props => {
|
|
7
7
|
const {
|
|
@@ -19,7 +19,7 @@ export type HighlighterOverlayViewProps = {
|
|
|
19
19
|
onRequestClose?: () => void;
|
|
20
20
|
highlightFrame?: HighlightFrameType;
|
|
21
21
|
style?: ViewStyle;
|
|
22
|
-
highlightViewTag?: number
|
|
22
|
+
highlightViewTag?: number;
|
|
23
23
|
children?: JSX.Element[] | JSX.Element;
|
|
24
24
|
highlightViewTagParams?: HighlightViewTagParams;
|
|
25
25
|
minimumRectSize?: Pick<HighlightFrameType, 'width' | 'height'>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import ReactNative, { NativeModules } from 'react-native';
|
|
3
3
|
// Import the Codegen specification for New Architecture
|
|
4
|
-
import KeyboardTrackingViewNativeComponent from "
|
|
4
|
+
import KeyboardTrackingViewNativeComponent from "../../../specs/KeyboardTrackingViewNativeComponent";
|
|
5
5
|
const KeyboardTrackingViewTempManager = NativeModules.KeyboardTrackingViewTempManager;
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -2,7 +2,7 @@ import _isEqual from "lodash/isEqual";
|
|
|
2
2
|
import _remove from "lodash/remove";
|
|
3
3
|
import _forEach from "lodash/forEach";
|
|
4
4
|
/* eslint no-underscore-dangle: 0 */
|
|
5
|
-
import { NativeModules, DeviceEventEmitter
|
|
5
|
+
import { NativeModules, DeviceEventEmitter } from 'react-native';
|
|
6
6
|
let SafeAreaInsetsCache = null;
|
|
7
7
|
class SafeAreaInsetsManager {
|
|
8
8
|
_defaultInsets = {
|
|
@@ -45,9 +45,6 @@ class SafeAreaInsetsManager {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
setupEventListener() {
|
|
48
|
-
if (Platform.OS !== 'ios') {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
48
|
try {
|
|
52
49
|
// Use DeviceEventEmitter instead of NativeEventEmitter to avoid getConstants
|
|
53
50
|
DeviceEventEmitter.addListener('SafeAreaInsetsDidChangeEvent', data => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
2
|
+
import { ViewStyle, StyleProp } from 'react-native';
|
|
3
3
|
export type SafeAreaSpacerViewProps = {
|
|
4
|
-
style?: ViewStyle
|
|
4
|
+
style?: StyleProp<ViewStyle>;
|
|
5
5
|
};
|
|
6
6
|
declare const SafeAreaSpacerView: {
|
|
7
7
|
({ style }: SafeAreaSpacerViewProps): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useCallback, useEffect } from 'react';
|
|
1
|
+
import React, { useState, useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { View, Dimensions } from 'react-native';
|
|
3
3
|
import SafeAreaInsetsManager from "./SafeAreaInsetsManager";
|
|
4
4
|
const SafeAreaSpacerView = ({
|
|
@@ -10,6 +10,7 @@ const SafeAreaSpacerView = ({
|
|
|
10
10
|
bottom: 0,
|
|
11
11
|
right: 0
|
|
12
12
|
});
|
|
13
|
+
const [componentHeight, setComponentHeight] = useState(0);
|
|
13
14
|
const [spacerHeight, setSpacerHeight] = useState(0);
|
|
14
15
|
useEffect(() => {
|
|
15
16
|
const getSafeAreaInsets = async () => {
|
|
@@ -43,22 +44,24 @@ const SafeAreaSpacerView = ({
|
|
|
43
44
|
const {
|
|
44
45
|
y
|
|
45
46
|
} = event.nativeEvent.layout;
|
|
47
|
+
setComponentHeight(y);
|
|
48
|
+
}, []);
|
|
49
|
+
useEffect(() => {
|
|
46
50
|
const screenHeight = Dimensions.get('window').height;
|
|
47
51
|
let height = 0;
|
|
48
52
|
// Check if positioned within safe area bounds
|
|
49
|
-
if (
|
|
53
|
+
if (componentHeight < safeAreaInsets.top) {
|
|
50
54
|
height = safeAreaInsets.top;
|
|
51
|
-
} else if (
|
|
55
|
+
} else if (componentHeight > screenHeight - safeAreaInsets.bottom) {
|
|
52
56
|
height = safeAreaInsets.bottom;
|
|
53
57
|
}
|
|
54
58
|
if (height !== spacerHeight) {
|
|
55
59
|
setSpacerHeight(height);
|
|
56
60
|
}
|
|
57
|
-
}, [safeAreaInsets, spacerHeight]);
|
|
58
|
-
const spacerStyle = {
|
|
59
|
-
height: spacerHeight
|
|
60
|
-
|
|
61
|
-
};
|
|
61
|
+
}, [componentHeight, safeAreaInsets, spacerHeight]);
|
|
62
|
+
const spacerStyle = useMemo(() => [{
|
|
63
|
+
height: spacerHeight
|
|
64
|
+
}, style], [spacerHeight, style]);
|
|
62
65
|
return <View style={spacerStyle} onLayout={handleLayout} />;
|
|
63
66
|
};
|
|
64
67
|
SafeAreaSpacerView.displayName = 'SafeAreaSpacerView';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
export type SafeAreaSpacerViewProps = {
|
|
4
|
+
style?: StyleProp<ViewStyle>;
|
|
5
|
+
};
|
|
6
|
+
declare const SafeAreaSpacerView: {
|
|
7
|
+
({ style }: SafeAreaSpacerViewProps): React.JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export default SafeAreaSpacerView;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Platform } from 'react-native';
|
|
3
|
+
import SafeAreaSpacerViewIos from "./SafeAreaSpacerView";
|
|
4
|
+
const isIOS = Platform.OS === 'ios';
|
|
5
|
+
const SafeAreaSpacerView = ({
|
|
6
|
+
style
|
|
7
|
+
}) => {
|
|
8
|
+
return isIOS ? <SafeAreaSpacerViewIos style={style} /> : <View style={style} />;
|
|
9
|
+
};
|
|
10
|
+
SafeAreaSpacerView.displayName = 'SafeAreaSpacerView';
|
|
11
|
+
export default SafeAreaSpacerView;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DynamicFonts, { FontExtension } from './DynamicFonts';
|
|
2
2
|
import HighlighterOverlayView from './HighlighterOverlayView';
|
|
3
|
-
import SafeAreaSpacerView from './SafeArea
|
|
3
|
+
import SafeAreaSpacerView from './SafeArea';
|
|
4
4
|
import SafeAreaInsetsManager from './SafeArea/SafeAreaInsetsManager';
|
|
5
5
|
import Keyboard, { KeyboardTrackingViewProps, KeyboardAccessoryViewProps } from './Keyboard';
|
|
6
6
|
export { DynamicFonts, FontExtension, HighlighterOverlayView, SafeAreaSpacerView, SafeAreaInsetsManager, Keyboard, KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
|
package/lib/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DynamicFonts, { FontExtension } from "./DynamicFonts";
|
|
2
2
|
import HighlighterOverlayView from "./HighlighterOverlayView";
|
|
3
|
-
import SafeAreaSpacerView from "./SafeArea
|
|
3
|
+
import SafeAreaSpacerView from "./SafeArea";
|
|
4
4
|
import SafeAreaInsetsManager from "./SafeArea/SafeAreaInsetsManager";
|
|
5
5
|
import Keyboard, { KeyboardTrackingViewProps, KeyboardAccessoryViewProps } from "./Keyboard";
|
|
6
6
|
export { DynamicFonts, FontExtension, HighlighterOverlayView, SafeAreaSpacerView, SafeAreaInsetsManager, Keyboard, KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
|
package/lib/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ui-lib",
|
|
3
|
-
"version": "7.44.0-snapshot.
|
|
3
|
+
"version": "7.44.0-snapshot.7228",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"author": "Ethan Sharabi <ethan.shar@gmail.com>",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"react-native-redash": "^12.0.3",
|
|
57
57
|
"semver": "^5.5.0",
|
|
58
58
|
"tinycolor2": "^1.4.2",
|
|
59
|
-
"uilib-native": "
|
|
59
|
+
"uilib-native": "5.0.0-snapshot.7216",
|
|
60
60
|
"url-parse": "^1.2.0",
|
|
61
61
|
"wix-react-native-text-size": "1.0.9"
|
|
62
62
|
},
|
package/panView.d.ts
ADDED
package/panView.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./src/components/panView').default;
|
|
@@ -107,7 +107,7 @@ export default class KeyboardAwareBase extends Component {
|
|
|
107
107
|
setTimeout(() => {
|
|
108
108
|
this._keyboardAwareView
|
|
109
109
|
.getScrollResponder()
|
|
110
|
-
.scrollResponderScrollNativeHandleToKeyboard(
|
|
110
|
+
.scrollResponderScrollNativeHandleToKeyboard(this.findNodeHandle(textInputRef),
|
|
111
111
|
this.props.scrollToInputAdditionalOffset,
|
|
112
112
|
true);
|
|
113
113
|
}, 0);
|
|
@@ -117,6 +117,10 @@ export default class KeyboardAwareBase extends Component {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
findNodeHandle(ref) {
|
|
121
|
+
return ref.current?.getNodeHandle?.() || ref?.getNodeHandle?.() || ReactNative.findNodeHandle(ref.current || ref);
|
|
122
|
+
}
|
|
123
|
+
|
|
120
124
|
_onKeyboardWillShow(event) {
|
|
121
125
|
this._scrollToFocusedTextInput();
|
|
122
126
|
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { DialogProps } from '../dialog';
|
|
4
3
|
import { ButtonProps } from '../button';
|
|
5
|
-
import { DialogProps
|
|
4
|
+
import { type DialogProps } from '../dialog';
|
|
6
5
|
type ActionSheetOnOptionPress = (index: number) => void;
|
|
7
6
|
type ActionSheetProps = {
|
|
8
|
-
/**
|
|
9
|
-
* Migrate to the Incubator.Dialog component
|
|
10
|
-
*/
|
|
11
|
-
migrateDialog?: boolean;
|
|
12
7
|
/**
|
|
13
8
|
* Whether to show the action sheet or not
|
|
14
9
|
*/
|
|
@@ -68,11 +63,6 @@ type ActionSheetProps = {
|
|
|
68
63
|
* Note: you will need to call onOptionPress so the option's onPress will be called
|
|
69
64
|
*/
|
|
70
65
|
renderAction?: (option: ButtonProps, index: number, onOptionPress: ActionSheetOnOptionPress) => JSX.Element;
|
|
71
|
-
/**
|
|
72
|
-
* @deprecated
|
|
73
|
-
* Called once the modal has been dismissed completely
|
|
74
|
-
*/
|
|
75
|
-
onModalDismissed?: DialogProps['onDialogDismissed'];
|
|
76
66
|
/**
|
|
77
67
|
* Whether or not to handle SafeArea
|
|
78
68
|
*/
|
|
@@ -80,7 +70,7 @@ type ActionSheetProps = {
|
|
|
80
70
|
/**
|
|
81
71
|
* Additional props to send to the Dialog
|
|
82
72
|
*/
|
|
83
|
-
dialogProps?: Omit<DialogProps, 'useSafeArea' | 'testID' | 'containerStyle' | 'visible' | 'onDismiss' | 'onDialogDismissed'> |
|
|
73
|
+
dialogProps?: Omit<DialogProps, 'useSafeArea' | 'testID' | 'containerStyle' | 'visible' | 'onDismiss' | 'onDialogDismissed'> | DialogProps;
|
|
84
74
|
/**
|
|
85
75
|
* testID for e2e tests
|
|
86
76
|
*/
|
|
@@ -6,15 +6,12 @@ import React, { Component } from 'react';
|
|
|
6
6
|
import { ActionSheetIOS, StyleSheet } from 'react-native';
|
|
7
7
|
import { Colors } from "../../style";
|
|
8
8
|
import { asBaseComponent, Constants } from "../../commons/new";
|
|
9
|
-
import Dialog from "../dialog";
|
|
10
9
|
import View from "../view";
|
|
11
10
|
import Text from "../text";
|
|
12
11
|
import Image from "../image";
|
|
13
12
|
//@ts-ignore
|
|
14
13
|
import ListItem from "../listItem";
|
|
15
|
-
import
|
|
16
|
-
import { Dialog as IncubatorDialog } from "../../incubator";
|
|
17
|
-
import { LogService } from "../../services";
|
|
14
|
+
import Dialog from "../dialog";
|
|
18
15
|
const VERTICAL_PADDING = 8;
|
|
19
16
|
/**
|
|
20
17
|
* @description: Cross platform Action Sheet, with a support for native iOS solution
|
|
@@ -130,55 +127,19 @@ class ActionSheet extends Component {
|
|
|
130
127
|
{this.renderActions()}
|
|
131
128
|
</View>;
|
|
132
129
|
}
|
|
133
|
-
|
|
130
|
+
render() {
|
|
134
131
|
const {
|
|
135
|
-
useNativeIOS,
|
|
136
132
|
visible,
|
|
137
133
|
onDismiss,
|
|
138
134
|
dialogStyle,
|
|
139
|
-
onModalDismissed,
|
|
140
135
|
testID,
|
|
141
136
|
useSafeArea,
|
|
142
137
|
dialogProps
|
|
143
138
|
} = this.props;
|
|
144
|
-
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
return <Dialog bottom centerH width="100%" panDirection={PanningProvider.Directions.DOWN} {...dialogProps} useSafeArea={useSafeArea} testID={testID} containerStyle={[styles.dialog, dialogStyle]} visible={visible} onDismiss={onDismiss} onDialogDismissed={onModalDismissed}>
|
|
139
|
+
return <Dialog bottom centerH width="100%" direction={Dialog.directions.DOWN} {...dialogProps} useSafeArea={useSafeArea} testID={testID} containerStyle={[styles.incubatorDialog, dialogStyle]} visible={visible} onDismiss={onDismiss}>
|
|
148
140
|
{this.renderSheet()}
|
|
149
141
|
</Dialog>;
|
|
150
142
|
}
|
|
151
|
-
renderNewDialog() {
|
|
152
|
-
const {
|
|
153
|
-
visible,
|
|
154
|
-
onDismiss,
|
|
155
|
-
dialogStyle,
|
|
156
|
-
onModalDismissed,
|
|
157
|
-
testID,
|
|
158
|
-
useSafeArea,
|
|
159
|
-
dialogProps
|
|
160
|
-
} = this.props;
|
|
161
|
-
if (onModalDismissed) {
|
|
162
|
-
LogService.deprecationWarn({
|
|
163
|
-
component: 'ActionSheet',
|
|
164
|
-
oldProp: 'onModalDismissed',
|
|
165
|
-
newProp: 'onDismiss'
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
return <IncubatorDialog bottom centerH width="100%" direction={PanningProvider.Directions.DOWN} {...dialogProps} useSafeArea={useSafeArea} testID={testID} containerStyle={[styles.incubatorDialog, dialogStyle]} visible={visible} onDismiss={onDismiss}>
|
|
169
|
-
{this.renderSheet()}
|
|
170
|
-
</IncubatorDialog>;
|
|
171
|
-
}
|
|
172
|
-
render() {
|
|
173
|
-
const {
|
|
174
|
-
migrateDialog
|
|
175
|
-
} = this.props;
|
|
176
|
-
if (migrateDialog) {
|
|
177
|
-
return this.renderNewDialog();
|
|
178
|
-
} else {
|
|
179
|
-
return this.renderOldDialog();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
143
|
}
|
|
183
144
|
export default asBaseComponent(ActionSheet);
|
|
184
145
|
const styles = StyleSheet.create({
|
|
@@ -120,7 +120,6 @@ declare class Checkbox extends Component<CheckboxProps, CheckboxState> {
|
|
|
120
120
|
getLabelStyle: () => {
|
|
121
121
|
color: string;
|
|
122
122
|
};
|
|
123
|
-
getAccessibleHitSlop(size: number): number;
|
|
124
123
|
renderCheckbox(): React.JSX.Element;
|
|
125
124
|
render(): React.JSX.Element;
|
|
126
125
|
validate: () => boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Animated, Easing, StyleSheet } from 'react-native';
|
|
3
3
|
import { Colors, Spacings } from "../../style";
|
|
4
|
+
import { StyleUtils } from "../../utils";
|
|
4
5
|
//@ts-ignore
|
|
5
6
|
import Assets from "../../assets";
|
|
6
7
|
import { asBaseComponent } from "../../commons/new";
|
|
@@ -146,9 +147,6 @@ class Checkbox extends Component {
|
|
|
146
147
|
color: this.props.disabled ? Colors.$textDisabled : this.state.showError ? Colors.$textDangerLight : Colors.$textDefault
|
|
147
148
|
};
|
|
148
149
|
};
|
|
149
|
-
getAccessibleHitSlop(size) {
|
|
150
|
-
return Math.max(0, (48 - size) / 2);
|
|
151
|
-
}
|
|
152
150
|
renderCheckbox() {
|
|
153
151
|
const {
|
|
154
152
|
selectedIcon,
|
|
@@ -161,7 +159,7 @@ class Checkbox extends Component {
|
|
|
161
159
|
} = this.props;
|
|
162
160
|
return (
|
|
163
161
|
//@ts-ignore
|
|
164
|
-
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress} hitSlop={
|
|
162
|
+
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress} hitSlop={StyleUtils.getAccessibleHitSlop(this.props.size || DEFAULT_SIZE)}>
|
|
165
163
|
{<Animated.View style={[this.styles.container, {
|
|
166
164
|
opacity: this.animationStyle.opacity
|
|
167
165
|
}, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { DialogProps } from '
|
|
3
|
+
import { DialogProps } from '../dialog';
|
|
4
4
|
export interface ColorPickerDialogProps extends DialogProps {
|
|
5
5
|
/**
|
|
6
6
|
* The initial color to pass the picker dialog
|
|
@@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useState } from 'react';
|
|
|
3
3
|
import { LayoutAnimation, StyleSheet, Keyboard } from 'react-native';
|
|
4
4
|
import { Constants, asBaseComponent } from "../../commons/new";
|
|
5
5
|
import { Colors } from "../../style";
|
|
6
|
-
import Dialog from "
|
|
6
|
+
import Dialog from "../dialog";
|
|
7
7
|
import { getColorValue, getValidColorString, getTextColor, BORDER_RADIUS } from "./ColorPickerPresenter";
|
|
8
8
|
import ColorPickerDialogHeader from "./ColorPickerDialogHeader";
|
|
9
9
|
import ColorPickerPreview from "./ColorPickerPreview";
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import { BaseComponentInjectedProps } from '../../commons/new';
|
|
4
4
|
import { TextFieldProps } from '../textField';
|
|
5
|
-
import type {
|
|
5
|
+
import type { DialogProps } from '../dialog';
|
|
6
6
|
import { ButtonProps } from '../button';
|
|
7
7
|
import { OldApiProps } from './useOldApi';
|
|
8
8
|
export type DateTimePickerMode = 'date' | 'time';
|
|
9
|
-
export type DateTimePickerProps = OldApiProps & Omit<TextFieldProps, 'value' | 'onChange'> &
|
|
9
|
+
export type DateTimePickerProps = OldApiProps & Omit<TextFieldProps, 'value' | 'onChange'> & {
|
|
10
10
|
/**
|
|
11
11
|
* The type of picker to display ('date' or 'time')
|
|
12
12
|
*/
|
|
@@ -15,6 +15,10 @@ export type DateTimePickerProps = OldApiProps & Omit<TextFieldProps, 'value' | '
|
|
|
15
15
|
* The initial value to set the picker to. Defaults to device's date / time
|
|
16
16
|
*/
|
|
17
17
|
value?: Date;
|
|
18
|
+
/**
|
|
19
|
+
* The props to pass to the dialog expandable container
|
|
20
|
+
*/
|
|
21
|
+
dialogProps?: DialogProps;
|
|
18
22
|
/**
|
|
19
23
|
* The onChange callback
|
|
20
24
|
*/
|
|
@@ -92,7 +96,6 @@ export type DateTimePickerProps = OldApiProps & Omit<TextFieldProps, 'value' | '
|
|
|
92
96
|
*/
|
|
93
97
|
cancelButtonProps?: ButtonProps;
|
|
94
98
|
};
|
|
95
|
-
type DateTimePickerPropsInternal = DateTimePickerProps & BaseComponentInjectedProps;
|
|
96
99
|
/**
|
|
97
100
|
* @description: Date and Time Picker Component that wraps RNDateTimePicker for date and time modes.
|
|
98
101
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/DateTimePickerScreen.tsx
|
|
@@ -101,7 +104,185 @@ type DateTimePickerPropsInternal = DateTimePickerProps & BaseComponentInjectedPr
|
|
|
101
104
|
* @extendsLink: https://github.com/react-native-community/react-native-datetimepicker#react-native-datetimepicker
|
|
102
105
|
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/DateTimePicker/DateTimePicker_iOS.gif?raw=true, https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/DateTimePicker/DateTimePicker_Android.gif?raw=true
|
|
103
106
|
*/
|
|
104
|
-
declare const DateTimePicker: React.ForwardRefExoticComponent<
|
|
107
|
+
declare const DateTimePicker: React.ForwardRefExoticComponent<OldApiProps & Omit<TextFieldProps, "value" | "onChange"> & {
|
|
108
|
+
/**
|
|
109
|
+
* The type of picker to display ('date' or 'time')
|
|
110
|
+
*/
|
|
111
|
+
mode?: DateTimePickerMode | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The initial value to set the picker to. Defaults to device's date / time
|
|
114
|
+
*/
|
|
115
|
+
value?: Date | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* The props to pass to the dialog expandable container
|
|
118
|
+
*/
|
|
119
|
+
dialogProps?: DialogProps | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* The onChange callback
|
|
122
|
+
*/
|
|
123
|
+
onChange?: ((date: Date) => void) | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Should this input be editable or disabled
|
|
126
|
+
*/
|
|
127
|
+
editable?: boolean | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* The minimum date or time value to use
|
|
130
|
+
*/
|
|
131
|
+
minimumDate?: Date | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* The maximum date or time value to use
|
|
134
|
+
*/
|
|
135
|
+
maximumDate?: Date | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* A callback function to format the time or date
|
|
138
|
+
* @param mode the type of the picker ('date' or 'time')
|
|
139
|
+
* @returns the formatted string to display
|
|
140
|
+
*/
|
|
141
|
+
dateTimeFormatter?: ((value: Date, mode: DateTimePickerMode) => string) | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Allows changing of the locale of the component (iOS only)
|
|
144
|
+
*/
|
|
145
|
+
locale?: string | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Allows changing of the time picker to a 24 hour format (Android only)
|
|
148
|
+
*/
|
|
149
|
+
is24Hour?: boolean | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* The interval at which minutes can be selected. Possible values are: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 (iOS only)
|
|
152
|
+
*/
|
|
153
|
+
minuteInterval?: number | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Allows changing of the timeZone of the date picker. By default it uses the device's time zone (iOS only)
|
|
156
|
+
*/
|
|
157
|
+
timeZoneOffsetInMinutes?: number | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* style to apply to the iOS dialog header
|
|
160
|
+
*/
|
|
161
|
+
headerStyle?: StyleProp<ViewStyle>;
|
|
162
|
+
/**
|
|
163
|
+
* Render custom input
|
|
164
|
+
*/
|
|
165
|
+
renderInput?: ((props: Omit<DateTimePickerProps, 'value'> & {
|
|
166
|
+
value?: string;
|
|
167
|
+
}) => React.ReactElement) | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Override system theme variant (dark or light mode) used by the date picker.
|
|
170
|
+
*/
|
|
171
|
+
themeVariant?: "light" | "dark" | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* The component testID
|
|
174
|
+
*/
|
|
175
|
+
testID?: string | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Allows changing the visual display of the picker
|
|
178
|
+
*/
|
|
179
|
+
display?: string | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Text color of the wheel picker items
|
|
182
|
+
*/
|
|
183
|
+
textColor?: string | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Background color of the wheel picker
|
|
186
|
+
*/
|
|
187
|
+
backgroundColor?: string | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Confirm button props
|
|
190
|
+
*/
|
|
191
|
+
confirmButtonProps?: ButtonProps | undefined;
|
|
192
|
+
/**
|
|
193
|
+
* Cancel button props
|
|
194
|
+
*/
|
|
195
|
+
cancelButtonProps?: ButtonProps | undefined;
|
|
196
|
+
} & BaseComponentInjectedProps & React.RefAttributes<any>>;
|
|
105
197
|
export { DateTimePicker };
|
|
106
|
-
declare const _default: React.ForwardRefExoticComponent<
|
|
198
|
+
declare const _default: React.ForwardRefExoticComponent<OldApiProps & Omit<TextFieldProps, "value" | "onChange"> & {
|
|
199
|
+
/**
|
|
200
|
+
* The type of picker to display ('date' or 'time')
|
|
201
|
+
*/
|
|
202
|
+
mode?: DateTimePickerMode | undefined;
|
|
203
|
+
/**
|
|
204
|
+
* The initial value to set the picker to. Defaults to device's date / time
|
|
205
|
+
*/
|
|
206
|
+
value?: Date | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* The props to pass to the dialog expandable container
|
|
209
|
+
*/
|
|
210
|
+
dialogProps?: DialogProps | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* The onChange callback
|
|
213
|
+
*/
|
|
214
|
+
onChange?: ((date: Date) => void) | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* Should this input be editable or disabled
|
|
217
|
+
*/
|
|
218
|
+
editable?: boolean | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* The minimum date or time value to use
|
|
221
|
+
*/
|
|
222
|
+
minimumDate?: Date | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* The maximum date or time value to use
|
|
225
|
+
*/
|
|
226
|
+
maximumDate?: Date | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* A callback function to format the time or date
|
|
229
|
+
* @param mode the type of the picker ('date' or 'time')
|
|
230
|
+
* @returns the formatted string to display
|
|
231
|
+
*/
|
|
232
|
+
dateTimeFormatter?: ((value: Date, mode: DateTimePickerMode) => string) | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* Allows changing of the locale of the component (iOS only)
|
|
235
|
+
*/
|
|
236
|
+
locale?: string | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* Allows changing of the time picker to a 24 hour format (Android only)
|
|
239
|
+
*/
|
|
240
|
+
is24Hour?: boolean | undefined;
|
|
241
|
+
/**
|
|
242
|
+
* The interval at which minutes can be selected. Possible values are: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 (iOS only)
|
|
243
|
+
*/
|
|
244
|
+
minuteInterval?: number | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Allows changing of the timeZone of the date picker. By default it uses the device's time zone (iOS only)
|
|
247
|
+
*/
|
|
248
|
+
timeZoneOffsetInMinutes?: number | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* style to apply to the iOS dialog header
|
|
251
|
+
*/
|
|
252
|
+
headerStyle?: StyleProp<ViewStyle>;
|
|
253
|
+
/**
|
|
254
|
+
* Render custom input
|
|
255
|
+
*/
|
|
256
|
+
renderInput?: ((props: Omit<DateTimePickerProps, "value"> & {
|
|
257
|
+
value?: string | undefined;
|
|
258
|
+
}) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) | undefined;
|
|
259
|
+
/**
|
|
260
|
+
* Override system theme variant (dark or light mode) used by the date picker.
|
|
261
|
+
*/
|
|
262
|
+
themeVariant?: "light" | "dark" | undefined;
|
|
263
|
+
/**
|
|
264
|
+
* The component testID
|
|
265
|
+
*/
|
|
266
|
+
testID?: string | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* Allows changing the visual display of the picker
|
|
269
|
+
*/
|
|
270
|
+
display?: string | undefined;
|
|
271
|
+
/**
|
|
272
|
+
* Text color of the wheel picker items
|
|
273
|
+
*/
|
|
274
|
+
textColor?: string | undefined;
|
|
275
|
+
/**
|
|
276
|
+
* Background color of the wheel picker
|
|
277
|
+
*/
|
|
278
|
+
backgroundColor?: string | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* Confirm button props
|
|
281
|
+
*/
|
|
282
|
+
confirmButtonProps?: ButtonProps | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* Cancel button props
|
|
285
|
+
*/
|
|
286
|
+
cancelButtonProps?: ButtonProps | undefined;
|
|
287
|
+
} & React.RefAttributes<any>>;
|
|
107
288
|
export default _default;
|
|
@@ -42,7 +42,6 @@ const DateTimePicker = forwardRef((props, ref) => {
|
|
|
42
42
|
themeVariant = Colors.getScheme(),
|
|
43
43
|
onChange,
|
|
44
44
|
dialogProps,
|
|
45
|
-
migrateDialog,
|
|
46
45
|
textColor = Colors.$textDefault,
|
|
47
46
|
backgroundColor = Colors.$backgroundDefault,
|
|
48
47
|
headerStyle,
|
|
@@ -165,7 +164,7 @@ const DateTimePicker = forwardRef((props, ref) => {
|
|
|
165
164
|
return <>
|
|
166
165
|
<ExpandableOverlay
|
|
167
166
|
// @ts-expect-error
|
|
168
|
-
ref={expandable} expandableContent={Constants.isIOS ? renderIOSExpandableOverlay() : undefined} useDialog dialogProps={_dialogProps}
|
|
167
|
+
ref={expandable} expandableContent={Constants.isIOS ? renderIOSExpandableOverlay() : undefined} useDialog dialogProps={_dialogProps} disabled={editable === false}
|
|
169
168
|
// NOTE: Android picker comes with its own overlay built-in therefor we're not using ExpandableOverlay for it
|
|
170
169
|
renderCustomOverlay={Constants.isAndroid ? renderAndroidDateTimePicker : undefined} testID={`${testID}.overlay`}>
|
|
171
170
|
{renderInput ? renderInput({
|