File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -68,9 +68,13 @@ var testing = React.createClass({
68
68
return (
69
69
// Landscape Phone View...
70
70
);
71
- } else {
71
+ } else if ( Display . isTablet () && Display . isPortrait ()) {
72
72
return (
73
- // Non-Phone / Tablet View...
73
+ // Portrait Tablet View...
74
+ );
75
+ } else if (Display .isTablet () && Display .isLandscape ()) {
76
+ return (
77
+ // Landscape Tablet View...
74
78
);
75
79
}
76
80
}
@@ -83,12 +87,19 @@ With Event Listener...
83
87
``` javascript
84
88
var Display = require (' react-native-device-display' );
85
89
90
+ var listener;
91
+
86
92
var testing = React .createClass ({
87
93
88
94
componentDidMount : function () {
89
- Display .onOrientationDidChange (function () {
95
+ listener = Display .onOrientationDidChange (function () {
90
96
// Change States, Perform Magic, etc...
91
97
});
98
+ },
99
+
100
+ componentWillUnmount : function () {
101
+ // Unlisten the onOrientationChange...
102
+ listener = null ;
92
103
}
93
104
94
105
});
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-native-device-display" ,
3
- "version" : " 1.0.0 " ,
3
+ "version" : " 1.0.1 " ,
4
4
"private" : false ,
5
5
"scripts" : {
6
6
"start" : " node_modules/react-native/packager/packager.sh"
7
7
},
8
- "dependencies " : {
8
+ "peerDependencies " : {
9
9
"react-native" : " ^0.6.0"
10
10
},
11
11
"description" : " A simple way to create dynamic views through device and display detection, allowing the creation of adaptable and universal apps." ,
You can’t perform that action at this time.
0 commit comments