How to use dimensions - 10 common examples

To help you get started, we’ve selected a few dimensions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stanleycyang / react_native_animation_tutorial / components / PlayGround.js View on Github external
const Dimensions = require('Dimensions')

const {
  Component,
  StyleSheet,
  Animated,
  Text,
  Easing,
  TouchableOpacity,
  View
} = React;

const {
  width,
  height
} = Dimensions.get('window')

const CIRCLE_DIMENSIONS = 40
const SPRING_CONFIG = {
  tension: 2,
  friction: 3 // Soft spring
}

const TIMING_CONFIG = {
  duration: 300,
  delay: 0,
  easing: Easing.in(Easing.ease)
}

class Playground extends Component {
  constructor (props) {
    super(props)
github stanleycyang / react_native_animation_tutorial / index.ios.js View on Github external
const React = require('react-native')
const Dimensions = require('Dimensions')

// Bring in components
const PageOne = require('./components/PageOne')
const PageTwo = require('./components/PageTwo')
const PageThree = require('./components/PageThree')

// Get the width and height of the window
const {
  width,
  height
} = Dimensions.get('window')

// Destructured components
const {
  AppRegistry,
  StyleSheet,
  Component,
  Text,
  View,
  Navigator,
  TouchableHighlight
} = React;

// Navigator configuration
const BaseConfig = Navigator.SceneConfigs.FloatFromRight

const CustomLeftToRightGesture = Object.assign({}, BaseConfig.gestures.pop, {
github microsoft / react-native-windows / js / RNTesterApp.android.js View on Github external
render() {
    if (!this.state) {
      return null;
    }
    return (
       {
          /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
           * found when making Flow check .android.js files. */
          this._overrideBackPressForDrawerLayout = true;
        }}
        onDrawerClose={() => {
          /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
           * found when making Flow check .android.js files. */
          this._overrideBackPressForDrawerLayout = false;
        }}
        ref={drawer => {
          /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
           * found when making Flow check .android.js files. */
          this.drawer = drawer;
        }}
github facebook / react-native / Libraries / ReactIOS / WarningBox.js View on Github external
var AsyncStorage = require('AsyncStorage');
var EventEmitter = require('EventEmitter');
var Map = require('Map');
var PanResponder = require('PanResponder');
var React = require('React');
var StyleSheet = require('StyleSheet');
var Text = require('Text');
var TouchableOpacity = require('TouchableOpacity');
var View = require('View');

var invariant = require('invariant');
var rebound = require('rebound');
var stringifySafe = require('stringifySafe');

var SCREEN_WIDTH = require('Dimensions').get('window').width;
var IGNORED_WARNINGS_KEY = '__DEV_WARNINGS_IGNORED';

var consoleWarn = console.warn.bind(console);

var warningCounts = new Map();
var ignoredWarnings: Array = [];
var totalWarningCount = 0;
var warningCountEvents = new EventEmitter();

/**
 * WarningBox renders warnings on top of the app being developed. Warnings help
 * guard against subtle yet significant issues that can impact the quality of
 * your application, such as accessibility and memory leaks. This "in your
 * face" style of warning allows developers to notice and correct these issues
 * as quickly as possible.
 *
github GertjanReynaert / react-native-universal / app / Device.js View on Github external
_height() {
    return Dimensions.get("window").height;
  }
}
github GertjanReynaert / react-native-universal / app / Device.js View on Github external
_width() {
    return Dimensions.get("window").width;
  }
github nosovsh / fifteen / src / Modal.js View on Github external
var React = require('react-native');
var Dimensions = require('Dimensions');

var screen = Dimensions.get('window');

var {
  StyleSheet,
  View,
  Animated,
  } = React;


var Modal = React.createClass({
  propTypes: {
    children: React.PropTypes.node.isRequired,
    isOpen: React.PropTypes.bool.isRequired,
  },

  getInitialState: function() {
    return {
github shevawen / react-native-weather-app / index.ios.js View on Github external
getInitialState: function() {
        var windowSize = Dimensions.get('window');
        var flexItemHeight = windowSize.height / WeatherApp.flex.reduce(function(a, b){return a+b;});
        return {
            current: {
                city: "",
                weather: "",
                temp: "",
                date: "",
                icon: ""
            },
            weekViewData: [],
            chartWidth: windowSize.width,
            chartHeight: flexItemHeight * 2,
            chartTop: flexItemHeight * 11,
            //chartData: [[],[]], TODO: can not fire binding,why?
            chartData: null,
            chartLineColors : ["#d35400","#a0dcdc"],
github khanghoang / RNSideMenu / SideMenu.js View on Github external
'use strict';

var React = require('react-native');
var Dimensions = require('Dimensions');
var window = Dimensions.get('window');

var {
  AppRegistry,
  StyleSheet,
  PanResponder,
  LayoutAnimation,
  Text,
  View,
} = React;

var SideMenu = React.createClass({

  _panResponder: {},
  _previousLeft: 0,
  _previousTop: 0,
  _sideViewStyles: {},
github soliury / noder-react-native / app / util / window.js View on Github external
exports.get = function () {
    return Dimensions.get('window')
}

dimensions

Get the width and height of any image on the Internet. Supports BMP, GIF, JPEG, PNG, PSD.

WTFPL
Latest version published 10 years ago

Package Health Score

42 / 100
Full package analysis

Popular dimensions functions