[ad_1]
I am attempting to indicate an icon when my app makes a request to the backend. However generally the icon doesn’t disappear.
I’ve the next code:
const [spinner, setSpinner] = useState(false);
useEffect(() => {
_fetchForm();
}, []);
async perform _fetchForm () {
strive {
setSpinner(true);
const kind = await api.fetchCreateForm();
dispatch(swotsActions.setSwotsForm(kind));
setSpinner(false);
} catch {
setSpinner(true);
}
}
if (!spinner) {
return <Kind/>;
} else {
return <Spinner/>;
}
The Spinner part:
import React from 'react';
import { ActivityIndicator, Modal, StyleSheet, View } from 'react-native';
import { colours } from 'utilities/kinds';
export default perform Spinner () {
return (
<Modal
onRequestClose={() => {}}
clear={true}
seen={true}
>
<View type={kinds.wrapper}>
<ActivityIndicator
animating={true}
shade={colours.black}
dimension="massive"
/>
</View>
</Modal>
);
}
And solely on ios gadgets generally each parts seem
I utilizing expo sdk 44, the identical code works on skd 42 (which can be deprecated quickly)
[ad_2]
