react-native-ui-lib icon indicating copy to clipboard operation
react-native-ui-lib copied to clipboard

SegmentControl: Value is undefined, expecting a object

Open Ulset opened this issue 2 years ago • 3 comments

Description

When trying to use the SegmentControl i get the following error

Related to

  • [X] Components
  • [ ] Demo
  • [ ] Docs
  • [ ] Typings

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

  • React Native: 0.63
  • React Native UI Lib: 6.15.1

Affected platforms

  • [ ] Android
  • [X] iOS
  • [ ] Web

Ulset avatar May 24 '22 13:05 Ulset

Hi @Ulset,

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

M-i-k-e-l avatar Jun 02 '22 13:06 M-i-k-e-l

Hey! Yes i did 😄

Ulset avatar Jun 02 '22 17:06 Ulset

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 avatar Aug 22 '22 10:08 M-i-k-e-l