Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NativeModules.RNSnackbar.LENGTH_LONG - Cannot read property 'LENGTH_LONG' of undefined #74

Closed
Pliman opened this issue May 10, 2018 · 8 comments

Comments

@Pliman
Copy link

Pliman commented May 10, 2018

Hello, when I am writing a 'Hello world' example according to readme, I got this error
"Cannot read property 'LENGTH_LONG' of undefined"
I think it's because this expression: "LENGTH_LONG: NativeModules.RNSnackbar.LENGTH_LONG,", which in src/index.js

I used "expo": "^27.0.1" with react native version 0.55.2
I imported react-native-snackbar this way:
import * as SnackBar from 'react-native-snackbar', I think error occured when importing.

Can somebody help me on this?

@Pliman
Copy link
Author

Pliman commented May 10, 2018

When debug app, I add
console.log(_reactNative.NativeModules.RNSnackbar)
after
var _reactNative = require('react-native');
in lib/index.js

_reactNative.NativeModules.RNSnackbar is undefined, so when to set RNSnackbar on _reactNative.NativeModules?

@Pliman
Copy link
Author

Pliman commented May 10, 2018

link information:

react-native link react-native-snackbar
Scanning folders for symlinks in /data/projects/{xxx}/node_modules (17ms)

@Grandmac
Copy link

Maybe it's because you don't re-run react-native run-ios or run-android after linking the package

@cooperka
Copy link
Owner

Hi @Pliman, this seems potentially similar to #43. Can you give those suggestions a try? Let me know if you're still having issues.

I'm also not sure if this will work with Expo -- I thought Expo doesn't support native libraries? I could be wrong.

@5ervant
Copy link

5ervant commented Oct 13, 2019

Not working with Expo. ;(

@romreed
Copy link

romreed commented Oct 24, 2019

still get with error
"react-native": "0.61.2"

@smitkaswala
Copy link

Working well with Expo. :)

Snackbar.show({
text: 'Image Downloaded Successfully.',
duration: Snackbar.LENGTH_LONG ---> replace with static duration - '1000',
});

@Waikato153
Copy link

Working well with Expo. :)

Snackbar.show({ text: 'Image Downloaded Successfully.', duration: Snackbar.LENGTH_LONG ---> replace with static duration - '1000', });

I add this line to my file

import {Snackbar} from 'react-native-snackbar';

nothing else. then the error happens.
how to resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants