I'm creating a basic login using React Native
with a logo and 2 inputs:
//import liraries
import React, { Component } from 'react';
import { View, Text, StyleSheet, Image } from 'react-native';
// create a component
class Login extends Component {
render() {
const imageURL = require('./images/CircleLogo.png');
return (
<View style={styles.container}>
<View style={styles.loginContainer}>
<Image resizeMode="contain" style={styles.logo} source={imageURL} />
</View>
<View style={styles.formContainer}>
<LoginForm />
</View>
</View>
);
}
}
// define your styles
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'aliceblue',
},
loginContainer:{
alignItems: 'center',
flexGrow: 1,
justifyContent: 'center'
},
logo: {
position: 'absolute',
width: '70vw',
height: '70vw',
maxWidth: 300
}
});
//make this component available to the app
export default Login;
As you can see i am using vw
and vh
css measurements.
This works on the web, but not on iOS or Android.
Does anyone have a good suggestion for handling vw
and vh
measurements?
Side Note: It appears react accepts percentages as seen here, which I may revert to. But my question pertains to specifically the vw
and vh
measurements.