Answers for "get width react native"

9

dimensions react native

import { Dimensions } from 'react-native';

console.log({
	width: Dimensions.get('window').width,
	height: Dimensions.get('window').height
})
Posted by: Guest on June-11-2020
3

width 100% react native

import { Dimensions } from 'react-native';

width: ${(Dimensions.get('window').width)}px;
Posted by: Guest on November-24-2020
0

width 100% react-native

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,
},
Posted by: Guest on September-06-2021
1

how to take 100% width in react native

header : {
	height : 100,
  	backgroundColor: "favorite color",
    alignSelf: "stretch",
}
Posted by: Guest on December-13-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language