@shoutem/ui 7.1.0-beta.5 → 7.1.0-beta.7
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.
|
@@ -12,6 +12,7 @@ const ActionSheet = ({
|
|
|
12
12
|
confirmOptions = undefined,
|
|
13
13
|
style,
|
|
14
14
|
onDismiss = undefined,
|
|
15
|
+
...otherProps
|
|
15
16
|
}) => {
|
|
16
17
|
const actionSheetRef = useRef(null);
|
|
17
18
|
|
|
@@ -31,7 +32,13 @@ const ActionSheet = ({
|
|
|
31
32
|
}, [active]);
|
|
32
33
|
|
|
33
34
|
return (
|
|
34
|
-
<ActionSheetNative
|
|
35
|
+
<ActionSheetNative
|
|
36
|
+
gestureEnabled
|
|
37
|
+
ref={actionSheetRef}
|
|
38
|
+
onClose={onDismiss}
|
|
39
|
+
containerStyle={style.container}
|
|
40
|
+
{...otherProps}
|
|
41
|
+
>
|
|
35
42
|
<View style={style.contentContainer}>
|
|
36
43
|
{hasConfirmOptions && (
|
|
37
44
|
<View style={style.segmentContainer}>
|
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.7",
|
|
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",
|
|
@@ -39,9 +39,10 @@
|
|
|
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
|
-
"react-native-actions-sheet": "0.9.
|
|
45
|
+
"react-native-actions-sheet": "0.9.3",
|
|
45
46
|
"stream": "0.0.2",
|
|
46
47
|
"tinycolor2": "1.4.1"
|
|
47
48
|
},
|
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
|
+
};
|
package/theme.js
CHANGED
|
@@ -2714,13 +2714,7 @@ export default () => {
|
|
|
2714
2714
|
|
|
2715
2715
|
'shoutem.ui.ActionSheet': {
|
|
2716
2716
|
container: {
|
|
2717
|
-
|
|
2718
|
-
top: 0,
|
|
2719
|
-
bottom: 0,
|
|
2720
|
-
left: 0,
|
|
2721
|
-
right: 0,
|
|
2722
|
-
flexDirection: 'column',
|
|
2723
|
-
justifyContent: 'flex-end',
|
|
2717
|
+
backgroundColor: 'transparent',
|
|
2724
2718
|
},
|
|
2725
2719
|
contentContainer: {
|
|
2726
2720
|
marginHorizontal: 8,
|
|
@@ -2744,10 +2738,11 @@ export default () => {
|
|
|
2744
2738
|
text: {
|
|
2745
2739
|
fontSize: 15,
|
|
2746
2740
|
letterSpacing: 0.38,
|
|
2747
|
-
color: '
|
|
2741
|
+
color: resolveVariable('primaryButtonText.color'),
|
|
2748
2742
|
lineHeight: 24,
|
|
2749
2743
|
},
|
|
2750
2744
|
cancelText: {
|
|
2745
|
+
color: resolveVariable('errorText.color'),
|
|
2751
2746
|
textAlign: 'center',
|
|
2752
2747
|
fontWeight: resolveFontWeight('700'),
|
|
2753
2748
|
},
|