react-native-swiper
react-native-swiper copied to clipboard
Attempted import error: 'Swiper' is not exported from 'react-native-swiper'.
Which OS ?
Web expo
Version
Which versions are you using:
- react-native-swiper v1.6
- react-native v0.62
Expected behaviour
No import problem
Actual behaviour
Attempted import error: 'Swiper' is not exported from 'react-native-swiper'.
How to reproduce it>
create new expo project add swiper somewhere
How to fix it>
replace : module.exports = Swiper; module.exports.default = Swiper; by export default Swiper export {Swiper}
try with:
import Swiper from 'react-native-swiper/src';
same here.
try with:
import Swiper from 'react-native-swiper/src';
this works, but is a hacky work around as it shows an issue in TypeScript compiler.
I got the same error:
Attempted import error: 'react-native-swiper' does not contain a default export (imported as 'Swiper').
It seems that this issue has already been fixed by OP (thank you!)... is there a reason it hasn't been merged?
Please publish the fix...
try with:
import Swiper from 'react-native-swiper/src';
this works, but is a hacky work around as it shows an issue in TypeScript compiler.
For now you could also just add this to one of your .d.ts
files:
declare module 'react-native-swiper/src' {
import Swiper from 'react-native-swiper'
export default Swiper
}
try with: import Swiper from 'react-native-swiper/src';
this works, but is a hacky work around as it shows an issue in TypeScript compiler.
For now you could also just add this to one of your
.d.ts
files:declare module 'react-native-swiper/src' { import Swiper from 'react-native-swiper' export default Swiper }
That's great! I'm glad to see that this actually works!