Created
December 15, 2022 00:46
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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