@shoutem/ui 8.2.4-rc.0 → 8.3.0-rc.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/babel.config.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Children, PureComponent } from 'react';
|
|
1
|
+
import React, { Children, createContext, PureComponent } from 'react';
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { DriverShape, ScrollDriver } from '@shoutem/animation';
|
|
5
5
|
|
|
6
|
+
export const ScrollDriverContext = createContext({});
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* Use this component if you want to share animation driver between unreachable siblings.
|
|
8
10
|
* Just wrap their parent component with it. We use it to share an instance of ScrollDriver
|
|
@@ -10,28 +12,12 @@ import { DriverShape, ScrollDriver } from '@shoutem/animation';
|
|
|
10
12
|
* register its driver.
|
|
11
13
|
*/
|
|
12
14
|
export class ScrollDriverProvider extends PureComponent {
|
|
13
|
-
static childContextTypes = {
|
|
14
|
-
driverProvider: PropTypes.object,
|
|
15
|
-
animationDriver: DriverShape,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
static contextTypes = {
|
|
19
|
-
animationDriver: DriverShape,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
15
|
constructor(props, context) {
|
|
23
16
|
super(props, context);
|
|
24
17
|
|
|
25
18
|
this.setupAnimationDriver(props, context);
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
getChildContext() {
|
|
29
|
-
return {
|
|
30
|
-
driverProvider: this,
|
|
31
|
-
animationDriver: this.animationDriver,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
21
|
setupAnimationDriver(props, context) {
|
|
36
22
|
const { onAnimationDriverChange } = this.props;
|
|
37
23
|
|
|
@@ -70,10 +56,21 @@ export class ScrollDriverProvider extends PureComponent {
|
|
|
70
56
|
render() {
|
|
71
57
|
const { children } = this.props;
|
|
72
58
|
|
|
73
|
-
return
|
|
59
|
+
return (
|
|
60
|
+
<ScrollDriverContext.Provider
|
|
61
|
+
value={{
|
|
62
|
+
driverProvider: this,
|
|
63
|
+
animationDriver: this.animationDriver,
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
{children && Children.only(children)}
|
|
67
|
+
</ScrollDriverContext.Provider>
|
|
68
|
+
);
|
|
74
69
|
}
|
|
75
70
|
}
|
|
76
71
|
|
|
72
|
+
ScrollDriverProvider.contextType = ScrollDriverContext;
|
|
73
|
+
|
|
77
74
|
// We disable this eslint rule because the props are being utilized indirectly
|
|
78
75
|
// through componentDidUpdate's usage of setupAnimationDriver
|
|
79
76
|
/* eslint-disable react/no-unused-prop-types */
|
|
@@ -3,22 +3,18 @@ import { Animated } from 'react-native';
|
|
|
3
3
|
import autoBindReact from 'auto-bind/react';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
6
|
+
import { ScrollDriver } from '@shoutem/animation';
|
|
7
7
|
import { connectStyle } from '@shoutem/theme';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ScrollDriverContext,
|
|
10
|
+
ScrollDriverProvider,
|
|
11
|
+
} from './ScrollDriverProvider.js';
|
|
9
12
|
|
|
10
13
|
class ScrollView extends PureComponent {
|
|
11
|
-
static contextTypes = {
|
|
12
|
-
animationDriver: DriverShape,
|
|
13
|
-
driverProvider: PropTypes.object,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
static childContextTypes = {
|
|
17
|
-
animationDriver: DriverShape,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
14
|
static DriverProvider = ScrollDriverProvider;
|
|
21
15
|
|
|
16
|
+
static DriverContext = ScrollDriverContext;
|
|
17
|
+
|
|
22
18
|
constructor(props, context) {
|
|
23
19
|
super(props, context);
|
|
24
20
|
|
|
@@ -32,12 +28,6 @@ class ScrollView extends PureComponent {
|
|
|
32
28
|
);
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
getChildContext() {
|
|
36
|
-
return {
|
|
37
|
-
animationDriver: this.animationDriver,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
31
|
componentDidMount() {
|
|
42
32
|
const { driverProvider } = this.context;
|
|
43
33
|
const { primary } = this.props;
|
|
@@ -61,21 +51,31 @@ class ScrollView extends PureComponent {
|
|
|
61
51
|
|
|
62
52
|
render() {
|
|
63
53
|
const { style, ...otherProps } = this.props;
|
|
54
|
+
const { driverProvider } = this.context;
|
|
64
55
|
const { scrollViewProps } = this.animationDriver;
|
|
65
56
|
const { contentContainerStyle, ...otherStyle } = style;
|
|
66
57
|
|
|
67
58
|
return (
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
<ScrollDriverContext.Provider
|
|
60
|
+
value={{
|
|
61
|
+
driverProvider,
|
|
62
|
+
animationDriver: this.animationDriver,
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<Animated.ScrollView
|
|
66
|
+
ref={this.setWrappedInstance}
|
|
67
|
+
contentContainerStyle={contentContainerStyle}
|
|
68
|
+
{...scrollViewProps}
|
|
69
|
+
{..._.omit(otherProps, 'onScroll')}
|
|
70
|
+
style={otherStyle}
|
|
71
|
+
/>
|
|
72
|
+
</ScrollDriverContext.Provider>
|
|
75
73
|
);
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
76
|
|
|
77
|
+
ScrollView.contextType = ScrollDriverContext;
|
|
78
|
+
|
|
79
79
|
ScrollView.propTypes = {
|
|
80
80
|
...Animated.ScrollView.propTypes,
|
|
81
81
|
primary: PropTypes.bool,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shoutem/ui",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0-rc.0",
|
|
4
4
|
"description": "Styleable set of components for React Native applications",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint .",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@react-native-community/datetimepicker": "6.2.0",
|
|
18
18
|
"@shoutem/animation": "0.17.0",
|
|
19
19
|
"@shoutem/eslint-config-react": "~1.0.6",
|
|
20
|
-
"@shoutem/theme": "
|
|
20
|
+
"@shoutem/theme": "0.15.0-rc.0",
|
|
21
21
|
"auto-bind": "4.0.0",
|
|
22
22
|
"babel-plugin-transform-decorators-legacy": "1.3.5",
|
|
23
23
|
"buffer": "5.6.0",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"tinycolor2": "1.4.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"react": ">=
|
|
52
|
-
"react-native": ">=0.
|
|
51
|
+
"react": ">=19.0.0",
|
|
52
|
+
"react-native": ">=0.78.0",
|
|
53
53
|
"react-native-gesture-handler": "*",
|
|
54
54
|
"react-native-safe-area-context": "*"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@babel/core": "7.
|
|
58
|
-
"@babel/plugin-proposal-decorators": "7.
|
|
57
|
+
"@babel/core": "^7.25.2",
|
|
58
|
+
"@babel/plugin-proposal-decorators": "7.20.13",
|
|
59
59
|
"@babel/register": "7.9.0",
|
|
60
60
|
"@shoutem/eslint-config-react-native": "~1.0.2",
|
|
61
61
|
"babel-eslint": "10.1.0",
|
|
@@ -67,14 +67,13 @@
|
|
|
67
67
|
"eslint-plugin-react-hooks": "4.2.0",
|
|
68
68
|
"eslint-plugin-react-native": "3.11.0",
|
|
69
69
|
"eslint-plugin-simple-import-sort": "7.0.0",
|
|
70
|
-
"jest": "
|
|
71
|
-
"
|
|
70
|
+
"jest": "^29.6.3",
|
|
71
|
+
"@react-native/babel-preset": "0.78.0",
|
|
72
72
|
"path": "0.12.7",
|
|
73
73
|
"prettier": "1.19.1",
|
|
74
|
-
"react": "
|
|
75
|
-
"react-
|
|
76
|
-
"react-
|
|
77
|
-
"react-test-renderer": "17.0.2"
|
|
74
|
+
"react": "19.0.0",
|
|
75
|
+
"react-native": "0.78.0",
|
|
76
|
+
"react-test-renderer": "19.0.0"
|
|
78
77
|
},
|
|
79
78
|
"nativeDependencies": [
|
|
80
79
|
"@react-native-community/datetimepicker",
|