0
votes

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

2
Three things: have you checked to make sure that react-native-wheel-scroll-picker is actually in your package.json and it's the version you expected? Second, have you checked that it's actually in root/node_modules/react-native-wheel-scroll-picker? Last, have you debugged your application to see what path it's resolving to? Maybe it doesn't match root/node_modules/react-native-wheel-scroll-picker because you have some webpack configuration that overrides all ^react-native* packages or something, for example... there's a lot of things that could go wrong.Patrick Roberts
Will check. Thank you!!! I'm a 100% react noob, and this was the exact checklist I needed. Thx much. Very excited.hunterp
You'll get the hang of it after a while. I just started react-native a week ago and there's admittedly a lot of things you're expected to already know before you even start your project. If you haven't gotten past the "hello world" stage yet, I recommend checking out expo-cli. If I had known to try expo when I started, it would have saved me several hours of pain.Patrick Roberts
Also steer clear of react-native-dom... very buggy since it's brand new. Though since you seem to be doing android development, you're probably not going to be deploying to web anyway.Patrick Roberts
there might be a problem with the package itself, as (Snack) itself cant install the packagedisplayname

2 Answers

1
votes

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

0
votes

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.