Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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,
},
Comment

width 100% react native

import { Dimensions } from 'react-native';

width: ${(Dimensions.get('window').width)}px;
Comment

Get React Native View width and height

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>
  )
}
Comment

how to take 100% width in react native

header : {
	height : 100,
  	backgroundColor: "favorite color",
    alignSelf: "stretch",
}
Comment

React Native Setting Height And Width

import React from 'react';
import { View } from 'react-native';

const Dimensions = () => {
  return (
 <View>
      <View style={{
        width: 50, height: 50, backgroundColor: 'powderblue'
      }} />
      <View style={{
        width: 100, height: 100, backgroundColor: 'skyblue'
      }} />
      <View style={{
        width: 150, height: 150, backgroundColor: 'steelblue'
      }} />
    </View>
   );
  };
export default Dimensions; 
      
Comment

how to set width 100 react native

line1:{
alignSelf: 'stretch',
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: this.$set 
Javascript :: push elements to an object 
Javascript :: js loop through object 
Javascript :: js regex remove html tags 
Javascript :: react-router-dom v6 redirect 
Javascript :: truthy or falsy value javascript 
Javascript :: array chunk javascript 
Javascript :: onclick change text color javascript 
Javascript :: checkbox is checked jquery 
Javascript :: how map on object in javascrtipt 
Javascript :: windows 10 toast notifications nodejs 
Javascript :: convert date time in reactjs 
Javascript :: react-native array.filter by index arrow function 
Javascript :: javascript go to page 
Javascript :: how remove child in jquery 
Javascript :: Codewars Square(n) Sum 
Javascript :: javascript check if number is even or odd 
Javascript :: set cookie javascript 
Javascript :: how to insert html in javascript 
Javascript :: hello is not defined javascript 
Javascript :: jquery add disabled to id 
Javascript :: dummy json 
Javascript :: js compare lists 
Javascript :: jquery trigger 
Javascript :: colors.xml" already exists! 
Javascript :: js date difference in seconds 
Javascript :: Set node environment through package.json script 
Javascript :: error placement jquery validation 
Javascript :: combinantion of single array in node js 
Javascript :: angular how to check previous route 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =