import { Dimensions } from 'react-native';
const width = Dimensions.get('window').width;
const height = Dimensions.get('window').height;
//publisher - Bathila Sanvidu Jayasundara - FullStack Developer
First, define Dimensions.
import { Dimensions } from "react-native";
var width = Dimensions.get('window').width; //full width
var height = Dimensions.get('window').height; //full height
then, change line1 style like below:
line1: {
backgroundColor: '#FDD7E4',
width: width,
},
import { Dimensions } from 'react-native';
width: ${(Dimensions.get('window').width)}px;
import React from 'react'
import { View } from 'react-native'
export default function index() {
const onLayout=(event)=> {
const {x, y, height, width} = event.nativeEvent.layout;
}
return (
<View onLayout={onLayout}>
<OtherComponent />
</View>
)
}
header : {
height : 100,
backgroundColor: "favorite color",
alignSelf: "stretch",
}
line1:{
alignSelf: 'stretch',
}