@widergy/mobile-ui 1.13.5 → 1.14.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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.14.0](https://github.com/widergy/mobile-ui/compare/v1.13.5...v1.14.0) (2024-07-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add background gradient to UTRoundView ([#301](https://github.com/widergy/mobile-ui/issues/301)) ([b56dc81](https://github.com/widergy/mobile-ui/commit/b56dc81bfec89696048e7e7bf8e5458c08300203))
|
|
7
|
+
|
|
1
8
|
## [1.13.5](https://github.com/widergy/mobile-ui/compare/v1.13.4...v1.13.5) (2024-07-17)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,25 +1,38 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
2
|
import { View, Animated } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import merge from 'lodash/merge';
|
|
4
4
|
|
|
5
5
|
import { useTheme } from '../../theming';
|
|
6
6
|
import Surface from '../Surface';
|
|
7
7
|
|
|
8
8
|
import propTypes from './propTypes';
|
|
9
9
|
import ownStyles from './styles';
|
|
10
|
+
import { generateBackgroundGradient } from './utils';
|
|
10
11
|
|
|
11
|
-
const UTRoundView = ({ children, styles, withShadow = false }) => {
|
|
12
|
+
const UTRoundView = ({ children, styles, withShadow = false, startColor, endColor }) => {
|
|
12
13
|
const theme = useTheme();
|
|
13
|
-
const themedStyles =
|
|
14
|
+
const themedStyles = merge({}, theme?.roundView, styles);
|
|
15
|
+
const withBackgroundGradient = !!startColor && !!endColor;
|
|
14
16
|
|
|
15
17
|
const ChildrenContainer = withShadow ? Surface : View;
|
|
16
18
|
|
|
17
19
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
<Fragment>
|
|
21
|
+
{withBackgroundGradient && (
|
|
22
|
+
<View style={ownStyles.backgroundGradient}>{generateBackgroundGradient(startColor, endColor)}</View>
|
|
23
|
+
)}
|
|
24
|
+
<Animated.View
|
|
25
|
+
style={[
|
|
26
|
+
ownStyles.container,
|
|
27
|
+
themedStyles?.outerContainer,
|
|
28
|
+
withBackgroundGradient && ownStyles?.outerWithBackground
|
|
29
|
+
]}
|
|
30
|
+
>
|
|
31
|
+
<ChildrenContainer position="top" style={[ownStyles.innerContainer, themedStyles?.innerContainer]}>
|
|
32
|
+
{children}
|
|
33
|
+
</ChildrenContainer>
|
|
34
|
+
</Animated.View>
|
|
35
|
+
</Fragment>
|
|
23
36
|
);
|
|
24
37
|
};
|
|
25
38
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
2
|
-
import { shape } from 'prop-types';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
styles: shape({
|
|
6
6
|
outerContainer: ViewPropTypes.style,
|
|
7
7
|
innerContainer: ViewPropTypes.style
|
|
8
|
-
})
|
|
8
|
+
}),
|
|
9
|
+
startColor: string,
|
|
10
|
+
endColor: string
|
|
9
11
|
};
|
|
@@ -3,6 +3,11 @@ import { StyleSheet } from 'react-native';
|
|
|
3
3
|
export const ROUND_VIEW_BORDER_RADIUS = 25;
|
|
4
4
|
|
|
5
5
|
const styles = StyleSheet.create({
|
|
6
|
+
backgroundGradient: {
|
|
7
|
+
height: '100%',
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
width: '100%'
|
|
10
|
+
},
|
|
6
11
|
container: {
|
|
7
12
|
flex: 1
|
|
8
13
|
},
|
|
@@ -13,6 +18,9 @@ const styles = StyleSheet.create({
|
|
|
13
18
|
borderTopLeftRadius: ROUND_VIEW_BORDER_RADIUS,
|
|
14
19
|
borderTopRightRadius: ROUND_VIEW_BORDER_RADIUS,
|
|
15
20
|
paddingTop: ROUND_VIEW_BORDER_RADIUS
|
|
21
|
+
},
|
|
22
|
+
outerWithBackground: {
|
|
23
|
+
backgroundColor: 'transparent'
|
|
16
24
|
}
|
|
17
25
|
});
|
|
18
26
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Svg, { Rect, LinearGradient, Defs, Stop } from 'react-native-svg';
|
|
3
|
+
|
|
4
|
+
export const generateBackgroundGradient = (startColor, endColor) => (
|
|
5
|
+
<Svg height="100%" width="100%">
|
|
6
|
+
<Defs>
|
|
7
|
+
<LinearGradient id="gradient1" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
8
|
+
<Stop offset="0%" stopColor={startColor} stopOpacity="1" />
|
|
9
|
+
<Stop offset="100%" stopColor={endColor} stopOpacity="1" />
|
|
10
|
+
</LinearGradient>
|
|
11
|
+
</Defs>
|
|
12
|
+
<Rect x="0" y="0" width="100%" height="100%" fill="url(#gradient1)" />
|
|
13
|
+
</Svg>
|
|
14
|
+
);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@widergy/mobile-ui",
|
|
3
3
|
"description": "Widergy Mobile Components",
|
|
4
4
|
"author": "widergy",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.14.0",
|
|
6
6
|
"repository": "https://github.com/widergy/mobile-ui.git",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"files": [
|
|
@@ -45,8 +45,9 @@
|
|
|
45
45
|
"react-native-collapsible": "^1.6.1",
|
|
46
46
|
"react-native-markdown-display": "^7.0.0-alpha.2",
|
|
47
47
|
"react-native-modal": "^13.0.1",
|
|
48
|
-
"react-native-
|
|
49
|
-
"react-native-
|
|
48
|
+
"react-native-pager-view": "^6.2.1",
|
|
49
|
+
"react-native-svg": "^13.13.0",
|
|
50
|
+
"react-native-safe-area-context": "^4.5.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@babel/cli": "^7.22.10",
|