UI Kitten Select Exception

633 Views Asked by At

I basically copy/pasted the example from the documentation

         <Select
          selectedIndex={this.currLangIndex}
          onSelect={(index) => {
            this.currLangIndex = index;
          }}>
          <SelectItem title="Option1" />
          <SelectItem title="Option2" />
        </Select>

and I get the following error:

 TypeError: undefined is not an object (evaluating 'props.getItem')
 This error is located at:
    in FlatList (created by List)
    in List (created by Context.Consumer)
    in Wrapper (created by List)
    in List (created by Autocomplete)
    in RCTView (at View.js:34)
    in View (created by PopoverView)
    in RCTView (at View.js:34)
    in View (created by PopoverView)
    in PopoverView (created by Context.Consumer)
    in Wrapper (created by PopoverView)
    in PopoverView
    in Unknown
    in RCTView (at View.js:34)
    in View (created by ModalResolver)
    in ModalResolver (created by ModalPanel)
    in RCTView (at View.js:34)
    in View (created by ModalPanel)
    in ModalPanel (created by ApplicationProvider)
    in ThemeProvider (created by StyleProvider)
    in MappingProvider (created by StyleProvider)
    in StyleProvider (created by ApplicationProvider)
    in ApplicationProvider (at app.tsx:65)
    in App (at renderApplication.js:45)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:106)
    in RCTView (at View.js:34)
    in View (at AppContainer.js:132)
    in AppContainer (at renderApplication.js:39)

I'm new to React Native and UI Kitten so any help is appreciated.

1

There are 1 best solutions below

0
On
const [selectedIndex, setSelectedIndex] = useState(new IndexPath(0));


<Layout style={styles.container} level='1'>
  <Select
    selectedIndex={selectedIndex}
    onSelect={index => setSelectedIndex(index)}>
    <SelectItem title='Option 1'/>
    <SelectItem title='Option 2'/>
    <SelectItem title='Option 3'/>
  </Select>
</Layout>

I got same problem , but it worked when wrapped it with Layout Comp. from UI Kitten, but now it is not showing any option when trying to select