@shoutem/ui 4.6.7 → 4.7.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.
|
@@ -22,6 +22,11 @@ export class ScrollDriverProvider extends PureComponent {
|
|
|
22
22
|
static propTypes = {
|
|
23
23
|
children: PropTypes.node,
|
|
24
24
|
driver: DriverShape,
|
|
25
|
+
// Used to propagate animation driver changes to components who aren't
|
|
26
|
+
// children of ScrollDriver, recieves driver as argument.
|
|
27
|
+
// TODO: Rewrite for new context API.
|
|
28
|
+
onAnimationDriverChange: PropTypes.func,
|
|
29
|
+
onScroll: PropTypes.func,
|
|
25
30
|
};
|
|
26
31
|
|
|
27
32
|
constructor(props, context) {
|
|
@@ -42,19 +47,34 @@ export class ScrollDriverProvider extends PureComponent {
|
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
setupAnimationDriver(props, context) {
|
|
50
|
+
const { onAnimationDriverChange } = this.props;
|
|
51
|
+
|
|
45
52
|
if (props.driver) {
|
|
46
53
|
this.animationDriver = props.driver;
|
|
47
54
|
} else if (context.driverProvider) {
|
|
48
55
|
this.animationDriver = context.animationDriver;
|
|
49
56
|
} else if (!this.animationDriver) {
|
|
50
|
-
this.animationDriver = new ScrollDriver(
|
|
57
|
+
this.animationDriver = new ScrollDriver(
|
|
58
|
+
{ useNativeDriver: true, nativeScrollEventThrottle: 20 },
|
|
59
|
+
props.onScroll,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (onAnimationDriverChange) {
|
|
64
|
+
onAnimationDriverChange(this.animationDriver);
|
|
51
65
|
}
|
|
52
66
|
}
|
|
53
67
|
|
|
54
68
|
setAnimationDriver(driver, primaryScrollView) {
|
|
55
69
|
if (driver || !this.animationDriver || primaryScrollView) {
|
|
56
|
-
|
|
70
|
+
const { onAnimationDriverChange } = this.props;
|
|
57
71
|
const { driverProvider } = this.context;
|
|
72
|
+
|
|
73
|
+
_.assign(this.animationDriver, driver);
|
|
74
|
+
if (onAnimationDriverChange) {
|
|
75
|
+
onAnimationDriverChange(driver);
|
|
76
|
+
}
|
|
77
|
+
|
|
58
78
|
if (driverProvider) {
|
|
59
79
|
driverProvider.setAnimationDriver(driver, primaryScrollView);
|
|
60
80
|
}
|
|
@@ -14,6 +14,7 @@ const IPHONE_X_HOME_INDICATOR_PADDING = isTabBarOnScreen ? 0 : 34;
|
|
|
14
14
|
class ScrollView extends PureComponent {
|
|
15
15
|
static propTypes = {
|
|
16
16
|
...Animated.ScrollView.propTypes,
|
|
17
|
+
primary: PropTypes.bool,
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
static contextTypes = {
|
|
@@ -33,7 +34,11 @@ class ScrollView extends PureComponent {
|
|
|
33
34
|
autoBindReact(this);
|
|
34
35
|
|
|
35
36
|
this.animationDriver =
|
|
36
|
-
props.driver ||
|
|
37
|
+
props.driver ||
|
|
38
|
+
new ScrollDriver(
|
|
39
|
+
{ useNativeDriver: true, nativeScrollEventThrottle: 20 },
|
|
40
|
+
props.onScroll,
|
|
41
|
+
);
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
getChildContext() {
|
|
@@ -53,12 +58,9 @@ class ScrollView extends PureComponent {
|
|
|
53
58
|
|
|
54
59
|
componentDidUpdate() {
|
|
55
60
|
const { driver } = this.props;
|
|
56
|
-
const { animationDriver } = this.context;
|
|
57
61
|
|
|
58
62
|
if (driver && this.animationDriver !== driver) {
|
|
59
63
|
this.animationDriver = driver;
|
|
60
|
-
} else if (animationDriver && this.animationDriver !== animationDriver) {
|
|
61
|
-
this.animationDriver = animationDriver;
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -92,7 +94,7 @@ class ScrollView extends PureComponent {
|
|
|
92
94
|
ref={this.setWrappedInstance}
|
|
93
95
|
contentContainerStyle={this.addIphoneXPadding(contentContainerStyle)}
|
|
94
96
|
{...animationDriver.scrollViewProps}
|
|
95
|
-
{...props}
|
|
97
|
+
{..._.omit(props, 'onScroll')}
|
|
96
98
|
/>
|
|
97
99
|
);
|
|
98
100
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Platform, Dimensions } from 'react-native';
|
|
2
|
+
import { hasNotch } from 'react-native-device-info';
|
|
2
3
|
import _ from 'lodash';
|
|
3
4
|
import {
|
|
4
5
|
IPHONE_X_LONG_SIDE,
|
|
@@ -30,6 +31,8 @@ const isIphoneXR =
|
|
|
30
31
|
!isTVOS &&
|
|
31
32
|
(xrDimensionsMatch || twelveDimensionsMatch || twelveMaxDimensionsMatch);
|
|
32
33
|
|
|
34
|
+
const isNotchedAndroid = OS === 'android' && hasNotch();
|
|
35
|
+
|
|
33
36
|
/**
|
|
34
37
|
* Receives settings for different devices
|
|
35
38
|
* If the device is recognized, it returns only settings for that device
|
|
@@ -48,11 +51,16 @@ function select(settings) {
|
|
|
48
51
|
return settings.iPhoneXR;
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
if (settings.notchedAndroid && isNotchedAndroid) {
|
|
55
|
+
return settings.notchedAndroid;
|
|
56
|
+
}
|
|
57
|
+
|
|
51
58
|
return _.get(settings, 'default');
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
export const Device = {
|
|
55
62
|
isIphoneX,
|
|
56
63
|
isIphoneXR,
|
|
64
|
+
isNotchedAndroid,
|
|
57
65
|
select,
|
|
58
66
|
};
|
package/helpers/keyboard.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
|
-
import { getStatusBarHeight } from 'react-native-status-bar-height';
|
|
1
|
+
import { Platform, StatusBar } from 'react-native';
|
|
3
2
|
import { NAVIGATION_BAR_HEIGHT } from '../theme';
|
|
4
3
|
|
|
5
4
|
export function calculateKeyboardOffset(extraOffset = 0) {
|
|
@@ -9,7 +8,7 @@ export function calculateKeyboardOffset(extraOffset = 0) {
|
|
|
9
8
|
return resolvedOffset;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
return
|
|
11
|
+
return StatusBar.currentHeight + resolvedOffset;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
export default { calculateKeyboardOffset };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shoutem/ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "Styleable set of components for React Native applications",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint .",
|
|
@@ -9,33 +9,33 @@
|
|
|
9
9
|
"test": "mocha '_tests_/*.js' --require react-native-mock-render/mock --require @babel/register"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@react-native-community/datetimepicker": "
|
|
13
|
-
"@shoutem/animation": "
|
|
14
|
-
"@shoutem/eslint-config-react": "
|
|
15
|
-
"@shoutem/theme": "
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"babel-plugin-transform-decorators-legacy": "~1.3.4",
|
|
12
|
+
"@react-native-community/datetimepicker": "3.5.2",
|
|
13
|
+
"@shoutem/animation": "shoutem/animation#649a9e7",
|
|
14
|
+
"@shoutem/eslint-config-react": "~1.0.6",
|
|
15
|
+
"@shoutem/theme": "shoutem/theme#ac4754a",
|
|
16
|
+
"auto-bind": "4.0.0",
|
|
17
|
+
"babel-plugin-transform-decorators-legacy": "1.3.5",
|
|
19
18
|
"buffer": "5.6.0",
|
|
20
19
|
"events": "1.1.0",
|
|
21
|
-
"fs-extra": "
|
|
20
|
+
"fs-extra": "7.0.1",
|
|
22
21
|
"html-entities": "1.3.1",
|
|
23
22
|
"htmlparser2": "3.10.1",
|
|
24
23
|
"lodash": "4.17.21",
|
|
25
|
-
"prop-types": "
|
|
24
|
+
"prop-types": "15.8.1",
|
|
26
25
|
"qs": "6.9.3",
|
|
26
|
+
"react-native-device-info": "8.4.8",
|
|
27
27
|
"react-native-lightbox": "shoutem/react-native-lightbox#v0.7.2",
|
|
28
|
-
"react-native-linear-gradient": "
|
|
28
|
+
"react-native-linear-gradient": "2.5.6",
|
|
29
29
|
"react-native-modal": "11.7.0",
|
|
30
30
|
"react-native-photo-view": "shoutem/react-native-photo-view#0ffa1481f6b6cb8663cb291b7db1d6644440584d",
|
|
31
|
-
"react-native-render-html": "
|
|
32
|
-
"react-native-
|
|
33
|
-
"react-native-svg": "
|
|
34
|
-
"react-native-svg-transformer": "
|
|
31
|
+
"react-native-render-html": "4.2.5",
|
|
32
|
+
"react-native-render-html-table-bridge": "0.6.0",
|
|
33
|
+
"react-native-svg": "12.1.1",
|
|
34
|
+
"react-native-svg-transformer": "0.14.3",
|
|
35
35
|
"react-native-transformable-image": "shoutem/react-native-transformable-image#v0.0.20",
|
|
36
|
-
"react-native-vector-icons": "
|
|
37
|
-
"react-native-webview": "
|
|
38
|
-
"react-native-youtube-iframe": "
|
|
36
|
+
"react-native-vector-icons": "6.6.0",
|
|
37
|
+
"react-native-webview": "11.0.3",
|
|
38
|
+
"react-native-youtube-iframe": "2.1.2",
|
|
39
39
|
"stream": "0.0.2",
|
|
40
40
|
"tinycolor2": "1.4.1"
|
|
41
41
|
},
|
|
@@ -44,27 +44,28 @@
|
|
|
44
44
|
"react-native": ">=0.61.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/core": "
|
|
47
|
+
"@babel/core": "7.16.7",
|
|
48
48
|
"@babel/register": "7.9.0",
|
|
49
|
-
"@babel/plugin-proposal-decorators": "
|
|
50
|
-
"babel-eslint": "
|
|
49
|
+
"@babel/plugin-proposal-decorators": "7.16.7",
|
|
50
|
+
"babel-eslint": "9.0.0",
|
|
51
51
|
"chai": "4.2.0",
|
|
52
52
|
"deep-freeze": "0.0.1",
|
|
53
|
-
"eslint": "
|
|
54
|
-
"eslint-plugin-import": "
|
|
55
|
-
"eslint-plugin-jsx-a11y": "
|
|
53
|
+
"eslint": "6.8.0",
|
|
54
|
+
"eslint-plugin-import": "2.25.4",
|
|
55
|
+
"eslint-plugin-jsx-a11y": "1.5.5",
|
|
56
56
|
"eslint-plugin-prettier": "3.1.3",
|
|
57
|
-
"eslint-plugin-react": "
|
|
58
|
-
"eslint-plugin-react-native": "
|
|
59
|
-
"metro-react-native-babel-preset": "
|
|
57
|
+
"eslint-plugin-react": "5.2.2",
|
|
58
|
+
"eslint-plugin-react-native": "3.6.0",
|
|
59
|
+
"metro-react-native-babel-preset": "0.56.4",
|
|
60
60
|
"mocha": "7.1.2",
|
|
61
61
|
"prettier": "1.19.1",
|
|
62
|
-
"react-addons-test-utils": "
|
|
63
|
-
"react-dom": "
|
|
62
|
+
"react-addons-test-utils": "15.6.2",
|
|
63
|
+
"react-dom": "16.14.0",
|
|
64
64
|
"react-native-mock-render": "0.1.9"
|
|
65
65
|
},
|
|
66
66
|
"nativeDependencies": [
|
|
67
67
|
"@react-native-community/datetimepicker",
|
|
68
|
+
"react-native-device-info",
|
|
68
69
|
"react-native-linear-gradient",
|
|
69
70
|
"react-native-photo-view",
|
|
70
71
|
"react-native-svg",
|
package/theme.js
CHANGED
|
@@ -22,6 +22,7 @@ const STATUS_BAR_OFFSET =
|
|
|
22
22
|
export const NAVIGATION_BAR_HEIGHT = Device.select({
|
|
23
23
|
iPhoneX: NAVIGATION_HEADER_HEIGHT + IPHONE_X_NOTCH_PADDING,
|
|
24
24
|
iPhoneXR: NAVIGATION_HEADER_HEIGHT + IPHONE_XR_NOTCH_PADDING,
|
|
25
|
+
notchedAndroid: NAVIGATION_HEADER_HEIGHT + StatusBar.currentHeight,
|
|
25
26
|
default: NAVIGATION_HEADER_HEIGHT,
|
|
26
27
|
});
|
|
27
28
|
|
|
@@ -1751,17 +1752,14 @@ export default (variables = defaultThemeVariables) => ({
|
|
|
1751
1752
|
statusBar: {
|
|
1752
1753
|
backgroundColor: variables.statusBarColor,
|
|
1753
1754
|
statusBarStyle: variables.statusBarStyle,
|
|
1754
|
-
height:
|
|
1755
|
-
iPhoneX: IPHONE_X_NOTCH_PADDING,
|
|
1756
|
-
iPhoneXR: IPHONE_XR_NOTCH_PADDING,
|
|
1757
|
-
default: 0,
|
|
1758
|
-
}),
|
|
1755
|
+
height: StatusBar.currentHeight,
|
|
1759
1756
|
},
|
|
1760
1757
|
screenBackground: variables.backgroundColor,
|
|
1761
1758
|
navigationBarImage: {
|
|
1762
1759
|
marginTop: Device.select({
|
|
1763
1760
|
iPhoneX: IPHONE_X_NOTCH_PADDING,
|
|
1764
1761
|
iPhoneXR: IPHONE_XR_NOTCH_PADDING,
|
|
1762
|
+
notchedAndroid: StatusBar.currentHeight,
|
|
1765
1763
|
default: 0,
|
|
1766
1764
|
}),
|
|
1767
1765
|
flex: 1,
|