@@ -66,23 +66,42 @@ export default class Login extends Component {
6666| condition | boolean | Abritrary boolean value that must be true for the media query to pass. |
6767
6868
69- ### ResponsiveComponent
69+ ### Responsive Annotation
7070
71- ` ResponsiveComponents ` extends ` React.Component ` and add the window dimensions to the state of the component.
71+ You can use es7 annotation in order to listen for dimension changes in a React component.
7272
7373``` jsx
7474import React from " react" ;
75- import {ResponsiveComponent } from " react-native-responsive-ui" ;
75+ import {responsive } from " react-native-responsive-ui" ;
7676
77- export default class Debug extends ResponsiveComponent {
77+ @responsive
78+ export default class Debug extends React .Component {
79+ render () {
80+ const {width , height } = this .state .window ;
81+ console .log (` New window dimensions: ${ width} x${ height} ` );
82+ return null ;
83+ }
84+ }
85+ ```
86+
87+ Or without the decorator syntax:
88+
89+ ``` jsx
90+ import React from " react" ;
91+ import {responsive } from " react-native-responsive-ui" ;
92+
93+ class Debug extends React .Component {
7894 render () {
7995 const {width , height } = this .state .window ;
8096 console .log (` New window dimensions: ${ width} x${ height} ` );
8197 return null ;
8298 }
8399}
100+
101+ export default responsive (Debug);
84102```
85103
104+
86105### ResponsiveStyleSheet
87106
88107` ResponsiveStyleSheet ` returns a stylesheet given multiple media queries.
@@ -143,3 +162,21 @@ import {Device, MediaQuerySelector} from "react-native-responsive-ui";
143162const {width , height } = Device .dimensions .window ;
144163MediaQuerySelector .query ({ orientation: " portrait" , minHeight: 450 }, width, height)
145164```
165+
166+
167+ ### ResponsiveComponent
168+
169+ ` ResponsiveComponents ` extends ` React.Component ` and add the window dimensions to the state of the component.
170+
171+ ``` jsx
172+ import React from " react" ;
173+ import {ResponsiveComponent } from " react-native-responsive-ui" ;
174+
175+ export default class Debug extends ResponsiveComponent {
176+ render () {
177+ const {width , height } = this .state .window ;
178+ console .log (` New window dimensions: ${ width} x${ height} ` );
179+ return null ;
180+ }
181+ }
182+ ```
0 commit comments