Skip to content

Commit

Permalink
IMPORTANT FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunhat committed Feb 21, 2019
1 parent bd4f398 commit 7a08950
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ if (Platform.OS === 'android') {
module.exports = {
get(dim) {
try {
if(!NativeModules.hasOwnProperty('ExtraDimensions')) {
if(!NativeModules.ExtraDimensions) {
throw "ExtraDimensions not defined. Try rebuilding your project. e.g. react-native run-android"
}
const result = NativeModules.ExtraDimensions[dim];

if(typeof result !== 'number') {
return result;
}
// If rounding down is ODD, round up. If rounding down is EVEN, round down.
return Math.floor(result) % 2 ? Math.ceil(result) : Math.floor(result);
} catch (e) {
console.error(e)
}
if(typeof result !== 'number') {
return result;
}
// If rounding down is ODD, round up. If rounding down is EVEN, round down.
return Math.floor(result) % 2 ? Math.ceil(result) : Math.floor(result);
}
};
} else {
Expand Down

0 comments on commit 7a08950

Please sign in to comment.