hunterp
hunterp

Reputation: 15986

Unable to resolve "react-native-wheel-scroll-picker" from "App.js"

As per https://www.npmjs.com/package/react-native-wheel-scroll-picker

I did npm install react-native-wheel-scroll-picker --save

Then I copied the example into my App.js however...I get this error when I try to run it:

Unable to resolve "react-native-wheel-scroll-picker" from "App.js"

import React, {Component} from 'react';
import ScrollPicker from 'react-native-wheel-scroll-picker';

export default class SimpleExample extends Component {

    render() {
        return(
             <ScrollPicker
                  dataSource={[
                       'a',
                       'b',
                       'c',
                       'd',
                  ]}
                  selectedIndex={1}
                  renderItem={(data, index, isSelected) => {
                      //
                  }}
                  onValueChange={(data, selectedIndex) => {
                      //
                  }}
                  wrapperHeight={180}
                  wrapperWidth={150}
                  wrapperBackground={'#FFFFFF'}
                  itemHeight={60}
                  highlightColor={'#d8d8d8'}
                  highlightBorderWidth={2}
                  activeItemColor={'#222121'}
                  itemColor={'#B4B4B4'}
                />
        )
    }
}

UPDATE: ok new error, first I added to packages.json with

"react-native-wheel-scroll-picker": "0.2.4"

then I did the reset-cache, then i did npm start, then I get following error: enter image description here

Upvotes: 0

Views: 2016

Answers (2)

RobPesc
RobPesc

Reputation: 45

I had this same error. I figured it out, you have to install the npm package: styled-components. https://www.npmjs.com/package/styled-components

You need this for the scroll wheel

https://github.com/unlayer/react-email-editor/issues/44

Upvotes: 1

Nirmalsinh Rathod
Nirmalsinh Rathod

Reputation: 5186

There may be a case that you haven't restart the server and you try to use the package.

Just use below command to kill all the running server

killall node -9

And then start a new server

react-native start

I had the same issue when I tried to install the package and without restarting the server, I got the same error.

Upvotes: 0

Related Questions