Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I just added few lines of simple code to test remote config on React Native Web but i keep getting error below:
I saw in the documentation it stated support other platform (https://rnfirebase.io/platforms)

Your web project is importing a module from 'react-native' instead of 'react-native-web'. Learn more: https://expo.fyi/fb-batched-bridge-config-web

"dependencies": {
    "@react-native-firebase/analytics": "^23.5.0",
    "@react-native-firebase/app": "^23.5.0",
    "@react-native-firebase/remote-config": "^23.5.0",
}
import {
  getRemoteConfig,
  fetchAndActivate,
} from "@react-native-firebase/remote-config";
import { getApp } from "@react-native-firebase/app";

export default function HomePage()  {
 const getRemoteConfigInstance = () => {
    const firebaseApp = getApp();
    return getRemoteConfig(firebaseApp);
  };

useEffect(() => {
    const remoteConfig = getRemoteConfigInstance();

    remoteConfig
      .setDefaults({
        awesome_new_feature: "disabled",
      })
      .then(() => fetchAndActivate)
      .then((fetchedRemotely) => {
        console.log("Configs were retrieved from the backend and activated.");
      });
  }, []);

}
You must be logged in to vote

Replies: 1 comment

Comment options

react-native-web support still does not exist out of the box with anything except shims unfortunately

what we do have - which means there is a great but currently unrealized hope for react-native-web - is "Other" platform support which you have apparently found. This does use the firebase-js-sdk internally, underneath the current @react-native-firebase/<package> namespaces and APIs and it works well - there are apps in production with it, but it was developed primarily for the purpose of supporting react-native-macos, which is a native platform from a react-native perspective (just a third-party one), not a web platform in the sense of react-native-web

what is left to do is do the work to make this Other platform be the thing that react-native-web selects and tries to use when it loads @react-native-firebase/<package> items

Until then, if you search for web and shims here it should turn up info

https://github.com/invertase/react-native-firebase/discussions?discussions_q=is%3Aopen+web+shim

and that'll lead to a concrete example, though it is old, where I made shims and then used webpack aliases to load them https://github.com/invertase/react-native-firebase-authentication-example/tree/main/template/src/shims
https://github.com/invertase/react-native-firebase-authentication-example/blob/68bd37f8c219f892655b40c73e9818370f368b82/template/craco.config.js#L105-L117

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.