callstack / react-native-slider

React Native component exposing Slider from iOS and SeekBar from Android
MIT License
1.22k stars 270 forks source link

Callback for component `RNCSlider` #587

Closed jleonard99 closed 6 months ago

jleonard99 commented 7 months ago

Environment

This error occurs in the Expo Snack web editor. Here is a working snack that DOES NOT throw an error.

Description

When the working snack is switched to "My Device", "Android" or "iOS" in the Snack editor, the error below is thrown. Note - when switching to Android or iOS, press the Launch Snack button on the emulator to load the app and see the error.

View config getter callback for component RNCSlider must be a function (received undefined)

This is a repost of issue #527. Issue #527 was closed with this comment: Closing due to no reproduction possible and no author's response. Also I don't see other community folks having this issue. Feel free to leave a comment if issue is noticed again.

Reproducible Demo

  1. Follow the link to the snack app.
  2. Change the mode in the top right from Web to Android or iOS or My Device. To use My Device you'll need to install Expo Go on your mobile device.
  3. When selecting Android or iOS, press the Launch Snack button on the emulator to fire up the emulator.
  4. When the program is loaded, the error should be displayed.
  5. Switching back to "Web" removes the error.

Use Case

I teach an introductory User Interface course. I use the Snack Editor to highlight different UI widgets and their props in lecture, and to demonstrate quick UI prototypes. I like the students to follow along and see what the code looks like on their phone using the My Device QR code and the expo go phone app. For RNCSlider, the My Device, Android and iOS options throw an error.

pataroff commented 6 months ago

+1, I've encountered this issue as well.

The snack works in the Expo Snack 'Web' view, but as soon as I switch to 'My Device', 'Android' or 'iOS', I am getting the error below.

View config getter callback for component RNCSlider must be a function (received undefined)

pataroff commented 6 months ago

@jleonard99

Upgrading the following dependencies to their latest versions instead of using the recommended version for SDK 50.0.0, seems to have fixed the issue for me.

{
  "dependencies": {
    ...
    "@react-native-picker/picker": "2.7.5",
    "@react-native-community/slider": "4.5.2"
    ...
  }
}
jleonard99 commented 6 months ago

@iwwan-01 Bingo! You suggestion worked for me, too. I'm seeing warnings in the package.json file that the versions hardcoded above aren't recommended for the SDK 50.0.0, but they work! Thank you!

jleonard99 commented 6 months ago

I believe that this can be closed. It seems to be an issue with the expo/snack SDK. Hardcoding specific versions (as shown above) solves the problem.