Support get size info by context
See original GitHub issueJust 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:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Tested the PR and works like a charm. Added a minor, updated docs and published to npm. Thanks for your help!
@jhen0409 Done. Updated repo and npm!