@codeleap/mobile 2.3.22 → 2.3.24
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.
|
@@ -133,7 +133,7 @@ export declare const Badge: React.ForwardRefExoticComponent<Pick<BadgeProps, "te
|
|
|
133
133
|
debBlue: (theme: import("@codeleap/common").ThemeColorScheme<import("@codeleap/common").AppTheme>, variant?: string) => Partial<Record<"wrapper", any>>;
|
|
134
134
|
debYellow: (theme: import("@codeleap/common").ThemeColorScheme<import("@codeleap/common").AppTheme>, variant?: string) => Partial<Record<"wrapper", any>>;
|
|
135
135
|
}>> | "keyboardAware" | "position" | "textProps"> & React.RefAttributes<unknown>>;
|
|
136
|
-
export declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "onPress" | "style" | "disabled" | "key" | "children" | "text" | "removeClippedSubviews" | "hitSlop" | "onLayout" | "pointerEvents" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "icon" | "styles" | "onPressIn" | "onPressOut" | "onLongPress" | "onBlur" | "onFocus" | "cancelable" | "delayLongPress" | "pressRetentionOffset" | "android_disableSound" | "android_ripple" | "testOnly_pressed" | "component" | "debugName" | "activeOpacity" | "debugComponent" | "noFeedback" | "debounce" | keyof import("@codeleap/common").BaseViewProps | "rightIcon" | keyof ComponentVariants<{
|
|
136
|
+
export declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "onPress" | "style" | "disabled" | "key" | "children" | "text" | "removeClippedSubviews" | "hitSlop" | "onLayout" | "pointerEvents" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "icon" | "styles" | "onPressIn" | "onPressOut" | "onLongPress" | "onBlur" | "onFocus" | "cancelable" | "delayLongPress" | "pressRetentionOffset" | "android_disableSound" | "android_ripple" | "testOnly_pressed" | "component" | "debugName" | "activeOpacity" | "debugComponent" | "noFeedback" | "debounce" | "leadingDebounce" | keyof import("@codeleap/common").BaseViewProps | "rightIcon" | keyof ComponentVariants<{
|
|
137
137
|
default: (theme: import("@codeleap/common").ThemeColorScheme<import("@codeleap/common").AppTheme>, variant?: string) => import("./styles").ButtonStylesGen<any>;
|
|
138
138
|
negative: (theme: import("@codeleap/common").ThemeColorScheme<import("@codeleap/common").AppTheme>, variant?: string) => import("./styles").ButtonStylesGen<any>;
|
|
139
139
|
circle: (theme: import("@codeleap/common").ThemeColorScheme<import("@codeleap/common").AppTheme>, variant?: string) => import("./styles").ButtonStylesGen<any>;
|
|
@@ -14,6 +14,7 @@ export declare type TouchableProps = Omit<ComponentPropsWithoutRef<typeof Pressa
|
|
|
14
14
|
onPress?: AnyFunction;
|
|
15
15
|
noFeedback?: boolean;
|
|
16
16
|
debounce?: number;
|
|
17
|
+
leadingDebounce?: boolean;
|
|
17
18
|
styles?: StylesOf<TouchableComposition>;
|
|
18
19
|
} & BaseViewProps;
|
|
19
20
|
export * from './styles';
|
|
@@ -47,8 +47,15 @@ var View_1 = require("../View");
|
|
|
47
47
|
var utils_1 = require("../../utils");
|
|
48
48
|
__exportStar(require("./styles"), exports);
|
|
49
49
|
exports.Touchable = (0, react_1.forwardRef)(function (touchableProps, ref) {
|
|
50
|
-
var _a = touchableProps.variants, variants = _a === void 0 ? [] : _a, children = touchableProps.children, onPress = touchableProps.onPress, style = touchableProps.style, debugName = touchableProps.debugName, debugComponent = touchableProps.debugComponent, _b = touchableProps.debounce, debounce = _b === void 0 ? 500 : _b, _c = touchableProps.noFeedback, noFeedback = _c === void 0 ? false : _c, styles = touchableProps.styles, props = __rest(touchableProps, ["variants", "children", "onPress", "style", "debugName", "debugComponent", "debounce", "noFeedback", "styles"]);
|
|
51
|
-
var pressed = React.useRef(
|
|
50
|
+
var _a = touchableProps.variants, variants = _a === void 0 ? [] : _a, children = touchableProps.children, onPress = touchableProps.onPress, style = touchableProps.style, debugName = touchableProps.debugName, debugComponent = touchableProps.debugComponent, _b = touchableProps.debounce, debounce = _b === void 0 ? 500 : _b, leadingDebounce = touchableProps.leadingDebounce, _c = touchableProps.noFeedback, noFeedback = _c === void 0 ? false : _c, styles = touchableProps.styles, props = __rest(touchableProps, ["variants", "children", "onPress", "style", "debugName", "debugComponent", "debounce", "leadingDebounce", "noFeedback", "styles"]);
|
|
51
|
+
var pressed = React.useRef(!!leadingDebounce);
|
|
52
|
+
(0, common_1.onMount)(function () {
|
|
53
|
+
if (!!leadingDebounce && !!debounce) {
|
|
54
|
+
setTimeout(function () {
|
|
55
|
+
pressed.current = false;
|
|
56
|
+
}, debounce);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
52
59
|
var variantStyles = (0, common_1.useDefaultComponentStyle)('u:Touchable', {
|
|
53
60
|
variants: variants,
|
|
54
61
|
transform: react_native_1.StyleSheet.flatten,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Touchable/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA8B;AAC9B,+BAA4D;AAC5D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Touchable/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA8B;AAC9B,+BAA4D;AAC5D,2CASyB;AACzB,6CAAoE;AAEpE,mEAAmE;AAGnE,gCAA8B;AAC9B,qCAAkD;AAiBlD,2CAAwB;AAEX,QAAA,SAAS,GAA6B,IAAA,kBAAU,EAG3D,UAAC,cAAc,EAAE,GAAG;IAElB,IAAA,KAWE,cAAc,SAXH,EAAb,QAAQ,mBAAG,EAAE,KAAA,EACb,QAAQ,GAUN,cAAc,SAVR,EACR,OAAO,GASL,cAAc,QATT,EACP,KAAK,GAQH,cAAc,MARX,EACL,SAAS,GAOP,cAAc,UAPP,EACT,cAAc,GAMZ,cAAc,eANF,EACd,KAKE,cAAc,SALF,EAAd,QAAQ,mBAAG,GAAG,KAAA,EAC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gBACd,2CAA2C;gBAC3C,gBAAgB,CAAC,OAAO,CAAC;gBACzB,aAAa,CAAC,SAAS;aACxB,CAAC;QAPiD,CAOjD,CAAC,CAAC,cAAc,CAAC,CAAC,YAAY,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CACpD;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,wBAAS,CACb;IAAA,EAAE,OAAO,CAAC,CACX,CAAA;AACH,CAAC,CAAC,CAAA;AAEW,QAAA,iBAAiB,GAAG,IAAA,mDAAyB,EAAC,iBAAS,CAAgC,CAAA"}
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useCodeleapContext,
|
|
9
9
|
AnyFunction,
|
|
10
10
|
TypeGuards,
|
|
11
|
+
onMount,
|
|
11
12
|
} from '@codeleap/common'
|
|
12
13
|
import { Pressable, StyleSheet, View as RNView } from 'react-native'
|
|
13
14
|
|
|
@@ -29,6 +30,7 @@ export type TouchableProps = Omit<
|
|
|
29
30
|
onPress?: AnyFunction
|
|
30
31
|
noFeedback?: boolean
|
|
31
32
|
debounce?: number
|
|
33
|
+
leadingDebounce?: boolean
|
|
32
34
|
styles?: StylesOf<TouchableComposition>
|
|
33
35
|
} & BaseViewProps
|
|
34
36
|
export * from './styles'
|
|
@@ -45,11 +47,23 @@ export const Touchable: React.FC<TouchableProps> = forwardRef<
|
|
|
45
47
|
debugName,
|
|
46
48
|
debugComponent,
|
|
47
49
|
debounce = 500,
|
|
50
|
+
leadingDebounce,
|
|
48
51
|
noFeedback = false,
|
|
49
52
|
styles,
|
|
50
53
|
...props
|
|
51
54
|
} = touchableProps
|
|
52
|
-
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
const pressed = React.useRef(!!leadingDebounce)
|
|
58
|
+
|
|
59
|
+
onMount(() => {
|
|
60
|
+
if(!!leadingDebounce && !!debounce){
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
pressed.current = false
|
|
63
|
+
}, debounce)
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
|
|
53
67
|
const variantStyles = useDefaultComponentStyle<'u:Touchable', typeof TouchableStyles>('u:Touchable', {
|
|
54
68
|
variants,
|
|
55
69
|
transform: StyleSheet.flatten,
|