wix / react-native-ui-lib

UI Components Library for React Native
https://wix.github.io/react-native-ui-lib/
MIT License
6.47k stars 707 forks source link

SegmentControl: Value is undefined, expecting a object #2061

Closed Ulset closed 1 year ago

Ulset commented 2 years ago

Description

When trying to use the SegmentControl i get the following error

Related to

Steps to reproduce

Add <SegmentedControl segments={[{label: '1st'}, {label: '2nd'}]}/> to your code

More Info

Code snippet

const Picker = <T extends unknown>(props: PickerProps<T>) => {
  return <SegmentedControl segments={[{label: '1st'}, {label: '2nd'}]}/>
};

Screenshots/Video

image

Environment

Affected platforms

M-i-k-e-l commented 2 years ago

Hi @Ulset,

Did you follow the installation guide here? SegmentControl requires the react-native-reanimated and react-native-gesture-handler libs.

Ulset commented 2 years ago

Hey! Yes i did 😄

M-i-k-e-l commented 2 years ago

Hi,

Sorry for the delay.

I have a project with these:

  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.67.3",
    "react-native-gesture-handler": "2.5.0",
    "react-native-reanimated": "2.8.0",
    "react-native-ui-lib": "^6.20.0"
  },

I get no errors when adding the following to my App.js:

<SegmentedControl segments={[{label: '1st'}, {label: '2nd'}]}/>
M-i-k-e-l commented 1 year ago

Closing, please reopen with more details if it is still relevant