question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support get size info by context

See original GitHub issue

Just a idea, a decorators function: (just like react-redux connect)

import React, { Component, PropTypes } from 'react';
import { getLayoutSize } from 'react-native-layout-tester';

@getLayoutSize(layout => ({
  deviceName: layout.label,
  deviceWidth: layout.width,
  deviceHeight: layout.height,
}))
class Comp extends Component {
  static propTypes = {
    deviceName: PropTypes.string,
    deviceWidth: PropTypes.number,
    deviceHeight: PropTypes.number,
  };

  render() { ... }
}

Also, we can have a default config, it can get Dimensions info and no test wrapper. It can be used for production, and keep the same code.

@machadogj what do you think?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
machadogjcommented, Jun 14, 2016

Tested the PR and works like a charm. Added a minor, updated docs and published to npm. Thanks for your help!

0reactions
machadogjcommented, Jun 10, 2016

@jhen0409 Done. Updated repo and npm!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get canvas size from its context - javascript - Stack Overflow
I'm building a few libraries for canvas graphing in javascript, and I was wondering if there was any way to get the size...
Read more >
CSS Container Queries - CSS: Cascading Style Sheets | MDN
To use container queries, you need to declare a containment context on an element so that the browser knows you might want to...
Read more >
Context - React
Context provides a way to pass data through the component tree without having to pass props down manually at every level. In a...
Read more >
Context | Android Developers
Note that using Application or Service context for UI-related queries may result in layout or continuity issues on devices with variable screen sizes...
Read more >
API Reference: ApolloServer - Apollo GraphQL Docs
Check out our Getting Started guide for an example of setting up Apollo Server! ... Supported fields of this object are described below....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found