@shoutem/ui 7.1.0-beta.6 → 7.1.0-beta.8
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/components/ListView.js +30 -7
- package/components/ShareButton.js +2 -1
- package/components/Video/Video.js +1 -1
- package/package.json +4 -3
- package/services/index.js +3 -2
- package/services/unavailableInWeb.js +29 -0
- package/theme.js +1 -2
package/components/ListView.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
StatusBar,
|
|
8
8
|
View,
|
|
9
9
|
} from 'react-native';
|
|
10
|
+
import { RefreshControl as WebRefreshControl } from 'react-native-web-refresh-control';
|
|
10
11
|
import autoBindReact from 'auto-bind/react';
|
|
11
12
|
import _ from 'lodash';
|
|
12
13
|
import PropTypes from 'prop-types';
|
|
@@ -37,15 +38,18 @@ class ListView extends PureComponent {
|
|
|
37
38
|
static getDerivedStateFromProps(props, state) {
|
|
38
39
|
const isLoading = props.loading;
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// We are already in a loading status
|
|
43
|
-
return state;
|
|
44
|
-
}
|
|
45
|
-
|
|
41
|
+
// If data is loading but no status updates were triggered, set status to loading.
|
|
42
|
+
if (isLoading && state.status === Status.IDLE) {
|
|
46
43
|
return { status: Status.LOADING };
|
|
47
44
|
}
|
|
48
|
-
|
|
45
|
+
|
|
46
|
+
// If loading is done, set status back to idle.
|
|
47
|
+
if (!isLoading && state.status === Status.LOADING) {
|
|
48
|
+
return { status: Status.IDLE}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Return all other statuses as they are.
|
|
52
|
+
return { status: state.status ?? Status.IDLE };
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
constructor(props, context) {
|
|
@@ -78,6 +82,14 @@ class ListView extends PureComponent {
|
|
|
78
82
|
|
|
79
83
|
if (onRefresh) {
|
|
80
84
|
onRefresh();
|
|
85
|
+
|
|
86
|
+
// Adding timeout, until onRefresh becomes async function. Then, we'll be able to know when
|
|
87
|
+
// refresh is done and set status back to idle.
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
this.setState({
|
|
90
|
+
status: Status.IDLE,
|
|
91
|
+
});
|
|
92
|
+
}, 500);
|
|
81
93
|
}
|
|
82
94
|
}
|
|
83
95
|
|
|
@@ -302,6 +314,17 @@ class ListView extends PureComponent {
|
|
|
302
314
|
};
|
|
303
315
|
delete refreshControlStyle.tintColor;
|
|
304
316
|
|
|
317
|
+
if (Platform.OS === 'web') {
|
|
318
|
+
return (
|
|
319
|
+
<WebRefreshControl
|
|
320
|
+
onRefresh={this.onRefresh}
|
|
321
|
+
refreshing={status === Status.REFRESHING}
|
|
322
|
+
tintColor={style.refreshControl.tintColor}
|
|
323
|
+
style={refreshControlStyle}
|
|
324
|
+
/>
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
305
328
|
return (
|
|
306
329
|
<RefreshControl
|
|
307
330
|
onRefresh={this.onRefresh}
|
|
@@ -3,6 +3,7 @@ import { Platform, Share } from 'react-native';
|
|
|
3
3
|
import autoBindReact from 'auto-bind/react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { connectStyle } from '@shoutem/theme';
|
|
6
|
+
import { unavailableInWeb } from '../services';
|
|
6
7
|
import { Button } from './Button';
|
|
7
8
|
import { Icon } from './Icon';
|
|
8
9
|
|
|
@@ -41,7 +42,7 @@ class ShareButton extends PureComponent {
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
return (
|
|
44
|
-
<Button onPress={this.onShare} {...otherProps}>
|
|
45
|
+
<Button onPress={unavailableInWeb(this.onShare)} {...otherProps}>
|
|
45
46
|
<Icon
|
|
46
47
|
name={Platform.OS === 'ios' ? 'share' : 'share-android'}
|
|
47
48
|
animationName={animationName}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shoutem/ui",
|
|
3
|
-
"version": "7.1.0-beta.
|
|
3
|
+
"version": "7.1.0-beta.8",
|
|
4
4
|
"description": "Styleable set of components for React Native applications",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint .",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@native-html/table-plugin": "5.3.1",
|
|
16
16
|
"@openspacelabs/react-native-zoomable-view": "2.0.4",
|
|
17
17
|
"@react-native-community/datetimepicker": "6.2.0",
|
|
18
|
-
"@shoutem/animation": "
|
|
18
|
+
"@shoutem/animation": "0.17.0-beta.0",
|
|
19
19
|
"@shoutem/eslint-config-react": "~1.0.6",
|
|
20
20
|
"@shoutem/theme": "~0.13.2",
|
|
21
21
|
"auto-bind": "4.0.0",
|
|
@@ -35,10 +35,11 @@
|
|
|
35
35
|
"react-native-linear-gradient": "2.8.3",
|
|
36
36
|
"react-native-modal": "13.0.1",
|
|
37
37
|
"react-native-render-html": "6.3.4",
|
|
38
|
-
"react-native-svg": "
|
|
38
|
+
"react-native-svg": "15.4.0",
|
|
39
39
|
"react-native-svg-transformer": "1.3.0",
|
|
40
40
|
"react-native-toast-message": "2.1.5",
|
|
41
41
|
"react-native-vimeo-iframe": "^1.2.1",
|
|
42
|
+
"react-native-web-refresh-control": "1.1.2",
|
|
42
43
|
"react-native-webview": "11.23.0",
|
|
43
44
|
"react-native-youtube-iframe": "2.2.2",
|
|
44
45
|
"react-native-actions-sheet": "0.9.3",
|
package/services/index.js
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { Toast } from '@shoutem/ui';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
|
|
5
|
+
const isWeb = Platform.OS === 'web';
|
|
6
|
+
|
|
7
|
+
export const unavailableInWeb = callback => {
|
|
8
|
+
if (!isWeb) {
|
|
9
|
+
return callback;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// If callback is undefined, show toast immediatelly.
|
|
13
|
+
if (_.isUndefined(callback)) {
|
|
14
|
+
Toast.showInfo({
|
|
15
|
+
title: 'Feature currently unavailable',
|
|
16
|
+
message:
|
|
17
|
+
'This feature is currently unavailable in Web Preview. For better preview experience download Disclose app.',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Otherwise, return callback to be executed on user action.
|
|
22
|
+
|
|
23
|
+
return () =>
|
|
24
|
+
Toast.showInfo({
|
|
25
|
+
title: 'Feature currently unavailable',
|
|
26
|
+
message:
|
|
27
|
+
'This feature is currently unavailable in Web Preview. For better preview experience download Disclose app.',
|
|
28
|
+
});
|
|
29
|
+
};
|