当我尝试从rnfirebase登录时,我得到一个未定义的错误,下面是我的代码:
CompileSdk = 33Android = 11最新版本的rnfirebase
import auth from '@react-native-firebase/auth';
export default function App() {
const SignOut = () => {
auth.signOut().then(() => console.log('User Signed Out')).catch(e => console.log(e.message));
}
return(
<>
<Button onPress={SignOut}>Sign Out</Button>
</>
)
}
我尝试Async Await,但我得到了一个未处理的承诺,我重新安装了它几次,但仍然不工作
答案发现:
我忘了auth import不是一个对象,它是一个函数,所以修复是:
const SignOut = () => {
auth().signOut().then(() => console.log('User Signed Out')).catch(e => console.log(e.message));
}