首页 > 解决方案 > 如何修复 withAuthenticator(App) 渲染错误

问题描述

我安装了 @react-native-picker/picker 并且我的应用程序中的所有内容都正常运行。当我实现 Auth 并将导出从更改export default Appexport default withAuthenticator(App); 它时,我收到了一个渲染错误,说 Picker 已从反应中删除。无论我是导入 Picker 还是删除 Picker,都会发生这种情况。在此处输入图像描述

import 'react-native-gesture-handler';
import React, {useState} from 'react';
import { StyleSheet, SafeAreaView} from 'react-native';
import Navigation from './src/navigation/index';
import { withAuthenticator } from 'aws-amplify-react-native';
import Amplify from '@aws-amplify/core';
import awsconfig from './src/aws-exports';

Amplify.configure(awsconfig);

const App = () => {
  return (
    <SafeAreaView style={{flex:1}}>
        <Navigation />
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  root: {
    flex: 1,
  },
  pageContainer: {
    justifyContent: 'center',
    alignItems: 'center',
    flex: 1,
  },
  topNavigation: {
    flexDirection: 'row',
    justifyContent: 'space-around',
    width: '100%',
    padding: 10,
  },
});

export default withAuthenticator(App);

标签: react-native

解决方案


推荐阅读