From bd2274c63dd1c23c8bb509949a44ab6e72d7e75f Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Thu, 19 Oct 2023 16:20:14 +0200 Subject: [PATCH 1/7] WIP --- src/components/FullscreenLoadingIndicator.js | 33 ------------------- src/components/FullscreenLoadingIndicator.tsx | 22 +++++++++++++ 2 files changed, 22 insertions(+), 33 deletions(-) delete mode 100644 src/components/FullscreenLoadingIndicator.js create mode 100644 src/components/FullscreenLoadingIndicator.tsx diff --git a/src/components/FullscreenLoadingIndicator.js b/src/components/FullscreenLoadingIndicator.js deleted file mode 100644 index 5c212b6dc29e..000000000000 --- a/src/components/FullscreenLoadingIndicator.js +++ /dev/null @@ -1,33 +0,0 @@ -import _ from 'underscore'; -import React from 'react'; -import {ActivityIndicator, StyleSheet, View} from 'react-native'; -import styles from '../styles/styles'; -import themeColors from '../styles/themes/default'; -import stylePropTypes from '../styles/stylePropTypes'; - -const propTypes = { - /** Additional style props */ - style: stylePropTypes, -}; - -const defaultProps = { - style: [], -}; - -function FullScreenLoadingIndicator(props) { - const additionalStyles = _.isArray(props.style) ? props.style : [props.style]; - return ( - - - - ); -} - -FullScreenLoadingIndicator.propTypes = propTypes; -FullScreenLoadingIndicator.defaultProps = defaultProps; -FullScreenLoadingIndicator.displayName = 'FullScreenLoadingIndicator'; - -export default FullScreenLoadingIndicator; diff --git a/src/components/FullscreenLoadingIndicator.tsx b/src/components/FullscreenLoadingIndicator.tsx new file mode 100644 index 000000000000..3f5f62f533d7 --- /dev/null +++ b/src/components/FullscreenLoadingIndicator.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import {ActivityIndicator, StyleSheet, View} from 'react-native'; +import styles from '../styles/styles'; +import themeColors from '../styles/themes/default'; + +type FullScreenLoadingIndicatorProps = { + style: Record | Array> | (() => void); +}; + +function FullScreenLoadingIndicator({style = []}: FullScreenLoadingIndicatorProps) { + const additionalStyles = Array.isArray(style) ? style : [style]; + return ( + + + + ); +} + +export default FullScreenLoadingIndicator; From 8d4678fa56bb60d5c5cf9e4371ffe56f1e2d924b Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Thu, 19 Oct 2023 16:37:39 +0200 Subject: [PATCH 2/7] Drop func from possible types --- src/components/FullscreenLoadingIndicator.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FullscreenLoadingIndicator.tsx b/src/components/FullscreenLoadingIndicator.tsx index 3f5f62f533d7..92e59d0e2d1c 100644 --- a/src/components/FullscreenLoadingIndicator.tsx +++ b/src/components/FullscreenLoadingIndicator.tsx @@ -4,7 +4,7 @@ import styles from '../styles/styles'; import themeColors from '../styles/themes/default'; type FullScreenLoadingIndicatorProps = { - style: Record | Array> | (() => void); + style: Record | Array>; }; function FullScreenLoadingIndicator({style = []}: FullScreenLoadingIndicatorProps) { From 512c4d5b97d6689074000c42a80794c0b25611a8 Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Mon, 23 Oct 2023 19:49:21 +0200 Subject: [PATCH 3/7] Restore displayName --- src/components/FullscreenLoadingIndicator.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/FullscreenLoadingIndicator.tsx b/src/components/FullscreenLoadingIndicator.tsx index 92e59d0e2d1c..4cd8002cf2c7 100644 --- a/src/components/FullscreenLoadingIndicator.tsx +++ b/src/components/FullscreenLoadingIndicator.tsx @@ -19,4 +19,6 @@ function FullScreenLoadingIndicator({style = []}: FullScreenLoadingIndicatorProp ); } +FullScreenLoadingIndicator.displayName = 'FullScreenLoadingIndicator'; + export default FullScreenLoadingIndicator; From 7044bbb83da3685e1eb19a4fc4b2ba4c9f2841de Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Mon, 23 Oct 2023 19:54:07 +0200 Subject: [PATCH 4/7] Use ViewStyle --- src/components/FullscreenLoadingIndicator.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/FullscreenLoadingIndicator.tsx b/src/components/FullscreenLoadingIndicator.tsx index 4cd8002cf2c7..43a7c4180284 100644 --- a/src/components/FullscreenLoadingIndicator.tsx +++ b/src/components/FullscreenLoadingIndicator.tsx @@ -1,10 +1,10 @@ import React from 'react'; -import {ActivityIndicator, StyleSheet, View} from 'react-native'; +import {ActivityIndicator, StyleProp, StyleSheet, View, ViewStyle} from 'react-native'; import styles from '../styles/styles'; import themeColors from '../styles/themes/default'; type FullScreenLoadingIndicatorProps = { - style: Record | Array>; + style: StyleProp; }; function FullScreenLoadingIndicator({style = []}: FullScreenLoadingIndicatorProps) { From 1088ada601544648d36bbdbbce33b409d8d1a6d2 Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Mon, 23 Oct 2023 21:45:59 +0200 Subject: [PATCH 5/7] Drop not needed casting --- src/components/FullscreenLoadingIndicator.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/FullscreenLoadingIndicator.tsx b/src/components/FullscreenLoadingIndicator.tsx index 43a7c4180284..dc2a08e3ac5e 100644 --- a/src/components/FullscreenLoadingIndicator.tsx +++ b/src/components/FullscreenLoadingIndicator.tsx @@ -8,9 +8,8 @@ type FullScreenLoadingIndicatorProps = { }; function FullScreenLoadingIndicator({style = []}: FullScreenLoadingIndicatorProps) { - const additionalStyles = Array.isArray(style) ? style : [style]; return ( - + Date: Wed, 25 Oct 2023 21:28:07 +0200 Subject: [PATCH 6/7] Make style prop optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fábio Henriques --- src/components/FullscreenLoadingIndicator.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FullscreenLoadingIndicator.tsx b/src/components/FullscreenLoadingIndicator.tsx index dc2a08e3ac5e..693de98d9ec9 100644 --- a/src/components/FullscreenLoadingIndicator.tsx +++ b/src/components/FullscreenLoadingIndicator.tsx @@ -4,7 +4,7 @@ import styles from '../styles/styles'; import themeColors from '../styles/themes/default'; type FullScreenLoadingIndicatorProps = { - style: StyleProp; + style?: StyleProp; }; function FullScreenLoadingIndicator({style = []}: FullScreenLoadingIndicatorProps) { From 0a8911c3924a8a51d593b6bd2fb5bac24581dd81 Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Thu, 26 Oct 2023 13:12:02 +0200 Subject: [PATCH 7/7] Drop default value - undefined works too --- src/components/FullscreenLoadingIndicator.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FullscreenLoadingIndicator.tsx b/src/components/FullscreenLoadingIndicator.tsx index 693de98d9ec9..292fe4805bc2 100644 --- a/src/components/FullscreenLoadingIndicator.tsx +++ b/src/components/FullscreenLoadingIndicator.tsx @@ -7,7 +7,7 @@ type FullScreenLoadingIndicatorProps = { style?: StyleProp; }; -function FullScreenLoadingIndicator({style = []}: FullScreenLoadingIndicatorProps) { +function FullScreenLoadingIndicator({style}: FullScreenLoadingIndicatorProps) { return (