I want to create transparent loader like facebook login, so the loader can stacked the view,
like this one:
I have a file called Loader.js
:
class Loader extends React.Component {
render() {
return (
<View style={styles.container}>
<View style={styles.nyoba}>
<Text style={[global.global.HeaderText, {color:'white', justifyContent:'center'}]}>Loading...</Text>
<Text style={[global.global.HeaderText, {color:'white', justifyContent:'center', marginBottom:150}]}>Please Wait...</Text>
<Spinner
isVisible={true}
size={100}
type={'ThreeBounce'}
color={'#ffffff'}
/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
indicator: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
height: 80
},
container: {flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: 'rgba(0,0,0, 0.3)'},
nyoba: {justifyContent: 'center', alignItems: 'center', backgroundColor: '#8B0000'},
});
And i want to called Loader.js
in every screen while calling an API, but the Loader take’s all the screen,
like this :
How can I makes the Loader.js
work like I want? Is there’s some way to makes my loader like facebook loader?
3
Answers
React Native’s Modal component allows to present a view in an enclosing view. What you are trying to achieve can be done using Modal component.
Please have a look into Modal Component Docs.
Try Applying
StyleSheet.absoluteFillObject
andzIndex: 5
to your most parent ViewAdd this to
Value
>styles
Add this to the
AndroidManifest
fileYou can adjust transparency by setting the transparency of this color in the style
Examples :