0

我基本上从文档中复制/粘贴了示例

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

我收到以下错误:

 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)

我是 React Native 和 UI Kitten 的新手,因此不胜感激。

4

1 回答 1

1
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>

我遇到了同样的问题,但是用 Layout Comp 包装它时它起作用了。来自 UI Kitten,但现在尝试选择时未显示任何选项

于 2020-11-07T09:44:08.943 回答