Skip to content

Instantly share code, notes, and snippets.

@frankcalise
Created December 15, 2022 00:46
Show Gist options
  • Save frankcalise/9f9192655c138c8d94cd62afebf48ff0 to your computer and use it in GitHub Desktop.
Save frankcalise/9f9192655c138c8d94cd62afebf48ff0 to your computer and use it in GitHub Desktop.
Expo Plugin to fix react-native-firebase 16.4.6, you'll also need to EAS build with --clear-cache
// See this recommendation for the native fix
// https://github.com/invertase/react-native-firebase/issues/6725#issuecomment-1342808185
import { ExpoConfig, ConfigContext } from "@expo/config"
import { ConfigPlugin, withDangerousMod } from "expo/config-plugins"
import { mergeContents } from "@expo/config-plugins/build/utils/generateCode"
import * as fs from "fs"
import * as path from "path"
const withReactNativeFirebase: ConfigPlugin = (config) => {
return withDangerousMod(config, [
"ios",
async (config) => {
const filePath = path.join(config.modRequest.platformProjectRoot, "Podfile")
const contents = fs.readFileSync(filePath, "utf-8")
const firebaseOverride = mergeContents({
tag: "IR-Firebase-SDK-Version-Override",
src: contents,
newSrc: "# Override Firebase SDK Version\n$FirebaseSDKVersion = '10.3.0'",
anchor: /scripts\/autolinking/gm,
offset: 0,
comment: "#",
})
fs.writeFileSync(filePath, firebaseOverride.contents)
return config
},
])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment