React-native-swiper: Unable to resolve module Dimensions from

Created on 29 Jul 2015  Â·  15Comments  Â·  Source: leecade/react-native-swiper

Hello,

I get the following warning in the packager:

Unable to resolve module Dimensions from .... dist.js

Any idea how to fix that? Everything is working correctly, just the message in the packager.

Regards

Most helpful comment

Hi,

you can fix it by changing the following in dist/index.js:

from:

var _Dimensions = require('Dimensions');

var _Dimensions2 = _interopRequireDefault(_Dimensions);

var _Dimensions$get = _Dimensions2['default'].get('window');

to

var React = require('react-native');
var {
  Dimensions
} = React;
var {width, height} = Dimensions.get('window');

Regards
Philipp

All 15 comments

Upvote! :+1:

Sent from my iPhone

On Jul 29, 2015, at 21:58, Philipp Krone [email protected] wrote:

Hello,

I get the following warning in the packager:

Unable to resolve module Dimensions from .... dist.js
Any idea how to fix that? Everything is working correctly, just the message in the packager.

Regards

—
Reply to this email directly or view it on GitHub.

:+1:

I still get this error with the current version, is someone updating the npm for this module?

https://github.com/alejomendoza/react-native-swiper/commit/90a6dbe30db87e0da90a6f9fb36f481efea3f06e

@leecade I'm getting this error as well...

@leecade I'm getting this error as well

I'm getting this error as well

Same, getting this error in .../dist/index.js

I'm experiencing the same issue. The full message is:

Unable to resolve module Dimensions from /Users/user/MyApp/node_modules/react-native-swiper/dist/index.js: Invalid directory /Users/node_modules/Dimensions

As far as I can tell the issue is that it's looking in wrong directory for Dimensions module (two levels above what it should be).

I'm getting this error too, similar to what @viktors described. Xcode can't build after adding this library and example code.

same error,
this needs to get fixed asap

Hi,

you can fix it by changing the following in dist/index.js:

from:

var _Dimensions = require('Dimensions');

var _Dimensions2 = _interopRequireDefault(_Dimensions);

var _Dimensions$get = _Dimensions2['default'].get('window');

to

var React = require('react-native');
var {
  Dimensions
} = React;
var {width, height} = Dimensions.get('window');

Regards
Philipp

Thanks so much @PhilippKrone !

fixed

Do what @PhilippKrone said after restart packager. ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicolabortignon picture nicolabortignon  Â·  3Comments

AndriiBoiko picture AndriiBoiko  Â·  3Comments

ruben-kasaz picture ruben-kasaz  Â·  3Comments

itinance picture itinance  Â·  3Comments

hadrienbbt picture hadrienbbt  Â·  3Comments