react-native-ui-lib 7.38.1-snapshot.6294 → 7.38.1-snapshot.6300
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/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @description: Image component that fades-in the image with animation once it's loaded
|
|
4
|
+
* @extends: Animated.Image
|
|
5
|
+
*/
|
|
6
|
+
declare const AnimatedImage: {
|
|
7
|
+
(props: any): React.JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export default AnimatedImage;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { StyleSheet, Animated } from 'react-native';
|
|
3
|
+
import View from "../../components/view";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description: Image component that fades-in the image with animation once it's loaded
|
|
7
|
+
* @extends: Animated.Image
|
|
8
|
+
*/
|
|
9
|
+
const AnimatedImage = props => {
|
|
10
|
+
const {
|
|
11
|
+
containerStyle,
|
|
12
|
+
source,
|
|
13
|
+
loader,
|
|
14
|
+
style,
|
|
15
|
+
onLoad: propsOnLoad,
|
|
16
|
+
animationDuration = 300,
|
|
17
|
+
testID,
|
|
18
|
+
...others
|
|
19
|
+
} = props;
|
|
20
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
21
|
+
const opacity = new Animated.Value(0);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
// Fade in the image once it's loaded
|
|
24
|
+
if (!isLoading) {
|
|
25
|
+
Animated.timing(opacity, {
|
|
26
|
+
toValue: 1,
|
|
27
|
+
duration: animationDuration,
|
|
28
|
+
useNativeDriver: true // Note: native driver may not work for opacity on the web
|
|
29
|
+
}).start();
|
|
30
|
+
}
|
|
31
|
+
}, [isLoading, opacity, animationDuration]);
|
|
32
|
+
const onLoad = useCallback(event => {
|
|
33
|
+
setIsLoading(false);
|
|
34
|
+
propsOnLoad?.(event);
|
|
35
|
+
}, [propsOnLoad]);
|
|
36
|
+
return <View style={containerStyle}>
|
|
37
|
+
<Animated.Image {...others} source={source} style={[style, {
|
|
38
|
+
opacity
|
|
39
|
+
}]} // Apply the animated opacity
|
|
40
|
+
onLoad={onLoad} // Handle the onLoad event
|
|
41
|
+
testID={testID} />
|
|
42
|
+
{isLoading && loader && <View style={styles.loader}>{loader}</View>}
|
|
43
|
+
</View>;
|
|
44
|
+
};
|
|
45
|
+
AnimatedImage.displayName = 'AnimatedImage';
|
|
46
|
+
export default AnimatedImage;
|
|
47
|
+
const styles = StyleSheet.create({
|
|
48
|
+
loader: {
|
|
49
|
+
...StyleSheet.absoluteFillObject,
|
|
50
|
+
justifyContent: 'center'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
@@ -374,7 +374,6 @@ class Button extends PureComponent {
|
|
|
374
374
|
animateLayout,
|
|
375
375
|
modifiers,
|
|
376
376
|
forwardedRef,
|
|
377
|
-
hitSlop: hitSlopProp,
|
|
378
377
|
...others
|
|
379
378
|
} = this.props;
|
|
380
379
|
const shadowStyle = this.getShadowStyle();
|
|
@@ -388,7 +387,7 @@ class Button extends PureComponent {
|
|
|
388
387
|
const borderRadiusStyle = this.getBorderRadiusStyle();
|
|
389
388
|
return <TouchableOpacity row centerV style={[this.styles.container, animateLayout && this.getAnimationDirectionStyle(), containerSizeStyle, this.isLink && this.styles.innerContainerLink, shadowStyle, margins, paddings, {
|
|
390
389
|
backgroundColor
|
|
391
|
-
}, borderRadiusStyle, outlineStyle, style]} activeOpacity={0.6} activeBackgroundColor={this.getActiveBackgroundColor()} onLayout={this.onLayout} onPress={onPress} disabled={disabled} testID={testID} hitSlop={
|
|
390
|
+
}, borderRadiusStyle, outlineStyle, style]} activeOpacity={0.6} activeBackgroundColor={this.getActiveBackgroundColor()} onLayout={this.onLayout} onPress={onPress} disabled={disabled} testID={testID} hitSlop={this.getAccessibleHitSlop()} {...others} ref={forwardedRef}>
|
|
392
391
|
{this.props.children}
|
|
393
392
|
{this.props.iconOnRight ? this.renderLabel() : this.renderIcon()}
|
|
394
393
|
{this.props.iconOnRight ? this.renderIcon() : this.renderLabel()}
|
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import _isEqual from "lodash/isEqual";
|
|
2
|
-
import { useState, useCallback, useRef } from 'react';
|
|
2
|
+
import { useState, useCallback, useRef, useEffect } from 'react';
|
|
3
|
+
import { SafeAreaInsetsManager } from 'uilib-native';
|
|
4
|
+
import { Constants } from "../../../commons/new";
|
|
3
5
|
export default function useHintLayout({
|
|
4
6
|
onBackgroundPress,
|
|
5
7
|
targetFrame
|
|
6
8
|
}) {
|
|
7
9
|
const [targetLayoutState, setTargetLayout] = useState(targetFrame);
|
|
8
|
-
const [targetLayoutInWindowState, setTargetLayoutInWindow] = useState(
|
|
10
|
+
const [targetLayoutInWindowState, setTargetLayoutInWindow] = useState();
|
|
9
11
|
const [hintMessageWidth, setHintMessageWidth] = useState();
|
|
10
12
|
const targetRef = useRef(null);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (targetFrame) {
|
|
15
|
+
if (!onBackgroundPress) {
|
|
16
|
+
setTargetLayoutInWindow(targetFrame);
|
|
17
|
+
} else {
|
|
18
|
+
SafeAreaInsetsManager.getSafeAreaInsets().then(insets => {
|
|
19
|
+
setTargetLayoutInWindow({
|
|
20
|
+
...targetFrame,
|
|
21
|
+
y: targetFrame.y + (insets?.top ?? 0) + Constants.getSafeAreaInsets().top
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
11
27
|
const onTargetLayout = useCallback(({
|
|
12
28
|
nativeEvent: {
|
|
13
29
|
layout
|