Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

percentage width react native

// Firstly, import Dimensions, and save the window's width and height 
import {Dimensions} from "react-native";

var width = Dimensions.get("window").width; 
var height = Dimensions.get("window").height; 

// Then inside your stylesheet you can use something like this:
width: width * 0.9, // Sets width to 90%
Comment

Percentage Height And Width React Native

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

const PercentageDimensionsBasics = () => {
  // Try removing the `height: '100%'` on the parent View.
  // The parent will not have dimensions, so the children can't expand.
  return (
    <View style={{ height: '100%' }}>
      <View style={{
        height: '33%', backgroundColor: 'red'
      }} />
      <View style={{
        width: '66%', height: '35%', backgroundColor: 'blue'
      }} />
      <View style={{
        width: '20%', height: '50%', backgroundColor: 'yellow'
      }} />
    </View>
  );
};

export default PercentageDimensionsBasics;
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript for...in with Strings 
Javascript :: trigger key jquery 
Javascript :: postman check for null or undefined 
Javascript :: Sort an array using setTimeout function 
Javascript :: @react-navigation/native unmount inactive 
Javascript :: state wheteher true or false The charioteer sprinkled sacred water on the king. 
Javascript :: vs code prevent auto grml closing in js files 
Javascript :: onclick not getting called from dynamic generated data 
Javascript :: discord.js reliablehandler 
Javascript :: javascript get a random number with 6 digits 
Javascript :: jquery add inline style 
Javascript :: javascript get n random elements from array 
Javascript :: react material modal custom backdrop 
Javascript :: javascript loop with delay 
Javascript :: loopback order by limit 
Javascript :: js find key by value in object 
Javascript :: sentido etimología 
Javascript :: js class method called when page loads 
Javascript :: how to send post request js fetch 
Javascript :: angular find value in json array 
Javascript :: vanilla javascript set display 
Javascript :: get array length in jquery 
Javascript :: how to redirect in ionic react 
Javascript :: play store rejected app due non-certified ads SDK 
Javascript :: js check if date object is invalid 
Javascript :: inline style vue 
Javascript :: javascript change data attribute value 
Javascript :: jetbrains mono 
Javascript :: node exec child_process ssh command password 
Javascript :: how to clamp a value 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =