Snippet

Élément central React Native

3 réponses de la communauté

   
var styles = StyleSheet.create({
    content:{
        flex:1,
        flexDirection:'row',
        alignItems:'center',
        justifyContent:'center'
    },});
var styles = StyleSheet.create({
    content:{
        flex:1,
        flexDirection:'row',
        alignItems:'center',
        justifyContent:'center'
    },});
// Add these styles to a parent element (could be a view)
   
const styles = StyleSheet.create({
    parent:{
        flex:1, // Covers the available space
        justifyContent:"center", // aligns through main axis
        alignItems:"center" // aligns though secondary axis
    }
});