【问题标题】:There is an issue in react-native-paper SegmentedButtonsreact-native-paper SegmentedButtons 中存在问题
【发布时间】:2023-01-09 23:05:47
【问题描述】:

我在用反应本机纸为了分段按钮这是 react-native-paper 的网站链接。

react-native-paper

我只是复制并粘贴我项目中的所有代码,但它给了我这个 错误

错误:元素类型无效:应为字符串(用于内置 组件)或类/函数(对于复合组件)但得到: 不明确的。您可能忘记从文件中导出您的组件 它在中定义,或者您可能混淆了默认导入和命名导入

什么时候我删除了 segmentButton 的代码然后它工作正常但当 在我的项目中添加代码它总是给我这个错误。 当我在 Expo snack 中运行这段代码时,它没有给出任何类型的错误并且运行正常 我只是警察

Expo snack Link

我的代码

    import {SegmentedButtons} from 'react-native-paper';
    
      const [value, setValue] = useState('');
    
return (
     <SafeAreaView>
            <SegmentedButtons
               value={value}
    onValueChange={setValue}
              buttons={[
                {
                  value: 'walk',
                  label: 'Walking',
                },
                {
                  value: 'train',
                  label: 'Transit',
                },
                {
                  value: 'drive',
                  label: 'Driving',
                },
              ]}>
    </SegmentedButtons>
          </SafeAreaView>
    )

【问题讨论】:

    标签: javascript reactjs react-native button react-hooks


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-28
      • 1970-01-01
      • 1970-01-01
      • 2020-11-21
      • 2021-09-11
      • 1970-01-01
      • 2023-01-08
      • 1970-01-01
      相关资源
      最近更新 更多