无法解析 react-native-swiper

Unable to resolve react-native-swiper

React Native 相对较新。发出以下命令以创建新的 React Native 项目:

create-react-native-app SwiperExample
cd SwiperExample
npm install --save react-native-swipe-gestures

我修改了 App.js 并包含了

import Swiper from 'react-native-swiper';

当我使用 npm start 进行测试时,出现以下错误:

Unable to resolve react-native-swiper" from "./C:\Users\sue\ReactNativeApps\SwiperExample\App.js"
Failed building JavaScript bundle

我的 package.json 包括以下依赖项

"dependencies": {
"expo": "^25.0.0",
"react": "16.2.0",
"react-native": "0.52.0",
"react-native-swipe-gestures": "^1.0.2"
}

有什么建议吗?

您导入错误 改变这个

import Swiper from 'react-native-swiper';

import Swiper from 'react-native-swiper-gestures';

或者安装正确的包以防安装错误

npm install --save react-native-swipe