-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[📚] Document regarding OTHER PLATFORMS is super confusing #8056
Comments
I tried to use it for web and ended with #8063 and goal is to lately migrate from those shims to modular approach so this is temporary solution but very similar to what endgame might look like so there won't be much refactoring. |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Hi @vipulbhj - at the moment, we're going through a large refactor, and at the end of it, we will be updating our documentation. To initialise the web SDK you would do it the normal way it occurs in the firebase-js-sdk. See: https://github.com/invertase/react-native-firebase/blob/main/packages/app/e2e/app.e2e.js#L105-L115 This is how we initialise for our "other" test platform for macOS: https://github.com/invertase/react-native-firebase/blob/main/tests/globals.js#L358 |
When used with expo, running bundle just fails, might be worth trying once. There are a bunch of open issues already, which have documented more specifics on this. P.S: Thank you for the update, I will keep an eye out for the update on documentation. |
@vipulbhj can you please be specific? (i.e, philosophically following https://stackoverflow.com/help/how-to-ask - exact versions, exact commands run, exact output, as text, for example). Additionally "bunch of open issues already" - I'm not aware of those 🤔 and I watch notification traffic on this repository. So I assume I've missed something, could you please specifically link to the open issues you feel are related? |
Maybe I am confused and saw it somewhere else, maybe it was a discussion and not an issue, but with out current app, expo 51.x.x, we are using the
Could also be a skill issue on my end. |
I tried this as I'm experimenting multi-platform a little with expo at the moment and I was curious. I did a I added all the packages listed as possible on "other" platform via I stopped the bundler with ctrl-c and re-ran with I opened import { useEffect } from "react";
import { getApp, initializeApp } from "@react-native-firebase/app";
import {
fetchAndActivate,
getAll,
getRemoteConfig,
} from "@react-native-firebase/remote-config";
const firebaseConfig = {
clientId: "your values here",
appId: "your values here",
authDomain: "your values here",
databaseURL:"your values here",
projectId: "your values here",
storageBucket:"your values here",
messagingSenderId:"your values here",
gaTrackingId: "your values here",
};
if (Platform.OS === "web") {
initializeApp(firebaseConfig);
}
const firebaseApp = getApp();
console.log("firebase app is: " + JSON.stringify(firebaseApp)); I re-loaded the app, and I see (via F12 in browser and switching to console of dev tools) that I have a firebaseapp I added this to the useEffect(() => {
fetchAndActivate(getRemoteConfig())
.then((config) => {
console.log(
"remoteConfig fetched and activated how? " + JSON.stringify(config)
);
console.log(
"remoteConfig getAll: " + JSON.stringify(getAll(getRemoteConfig()))
);
})
.catch((e) => {
console.log("remoteConfig failure? ", e);
});
}, []); And now when I reload I see the config parameters. As far as I can tell, this is all working, with expo So we'll need some really specific reproduction steps, as it appears to be working for me ? I'm very very new to expo though, I could be missing something |
Hey @mikehardy, we setup If you notice this section of the documentation, we have setup Google Service files for both platforms, which was my initial question, as when you do that, we don't need to do any inits or anything like that. And that's the reason I had opened this issue initially. P.S: The findings of your experiment seem interesting, I will try this tonight with our app. I am still not sure which is the correct place to do the initialisation, but I will try to figure something out. |
Also, can you trying importing something from |
After some testing and looking at the way I was doing it in other platforms I simplified the web/other platform init much further. if (Platform.OS === "web") {
initializeApp(firebaseConfig);
}
const firebaseApp = getApp(); I created docs PR #8151 to improve the "other" (and "web") platform install experience, the docs there were lacking. How does this look? https://react-native-firebase-hpuitelym-invertase.vercel.app/#other--web I tested using storage in a similar exercise to remote-config, it appeared to work fine, I listed items from a known-good bucket, all showed up in console.log import { getStorage, listAll, ref } from "@react-native-firebase/storage";
// later, inside some function showing a screen just for demonstration
useEffect(() => {
// demonstrate using storage using a path with read allowed in this project
listAll(ref(getStorage(), "/playground"))
.then((listResult) => {
listResult.items.forEach((item) => {
console.log("storage listAll found: " + item.fullPath);
});
})
.catch((e) => {
console.log("storage failure? ", e);
});
}, []); So I believe everything is working, and I hope that PR clears up the install confusion so people can start using the web platform fallback more easily for true multi-platform react-native-firebase |
Let me try this in my app and report back |
Okay, near as I can tell with the doc updated and functionality all working for me with everything I test, this should be handled now. Hopefully not super confusing any more :-) The error you just posted looks project specific. I saw you comment in another "react-native-firebase multiplatform" issue (discussion perhaps?) which was from the era before we had web-fallback implemented here. In that discussion you needed to have shims and you needed to configure them in the babel config that was loaded for web. I imagine you still have a config setup like that when it should be removed. Or perhaps you have already removed it but you still have it in your config? outdated: #4417 (comment) I've just responded to the various discussions I could see where "shims" were mentioned as I don't believe any shims are necessary anywhere anymore. Just an So I'm going to close this - I don't believe there's anymore to do with docs updated and no issues reproduced |
Documentation Feedback
In the documentation it says that on other platforms, it just falls back to Web SDK, but I am so confused.
Where would the SDK even look for / find the firebase config ?
How to use this for web ?
Does anyone have any examples or something?
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: