Javascript Firebase云在世博会项目中的作用
因此,我有一个云功能(这还不在react native app目录中): 这是用于我的swift应用程序。如何将此应用程序用于使用Expo构建的react本机应用程序 我已经安装了以下Javascript Firebase云在世博会项目中的作用,javascript,firebase,react-native,google-cloud-functions,react-native-firebase,Javascript,Firebase,React Native,Google Cloud Functions,React Native Firebase,因此,我有一个云功能(这还不在react native app目录中): 这是用于我的swift应用程序。如何将此应用程序用于使用Expo构建的react本机应用程序 我已经安装了以下warn add@react native firebase/functions 我在根目录中设置了firebase.js文件: import * as firebase from "firebase"; // Your web app's Firebase configuration var
warn add@react native firebase/functions
我在根目录中设置了firebase.js文件:
import * as firebase from "firebase";
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "test",
authDomain: "test",
databaseURL: "test",
projectId: "test",
storageBucket: "test",
messagingSenderId: "test",
appId: "test"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
export default firebase;
我有一个按钮:
<Text>Delete Account</Text>
<View>
<Button
title="Delete Account"
color="#F9578E"
accessibilityLabel="Delete Account"
/>
</View>
删除帐户
单击后,用户将退出并运行上述云功能。我不熟悉react-native和in-Expo,但从
@react-native firebase/functions
来看,您似乎需要执行以下操作:
import functions from '@react-native-firebase/functions';
function App() {
useEffect(() => {
functions()
.httpsCallable('deleteUser')()
.then(response => {
// ....
});
}, []);
// ...
}
您没有将任何数据从应用程序传递到可调用的云函数,即,您没有在云函数中使用
数据
对象,这就是为什么您需要执行函数().httpscalable('deleteUser')()
。
如果需要传递一些数据,文档将显示一个示例,传递一个对象:
functions().httpsCallable('listProducts')({
page: 1,
limit: 15,
})
(这与调用可调用云函数的方式完全一致,这就是为什么我回答了这个问题,即使我对react native和Expo缺乏了解……)只是不得不将导入从“../../firebase”更改为
导入firebase;导入“firebase/函数”
functions().httpsCallable('listProducts')({
page: 1,
limit: 15,
})