Skip to content

Commit

Permalink
feat: add custom app delegate for tint color configuration (#2579)
Browse files Browse the repository at this point in the history
  • Loading branch information
lawvs authored Jan 15, 2025
1 parent fb2a458 commit 6c28b4f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
],
"expo-apple-authentication",
[require("./scripts/with-follow-assets.js")],
[require("./scripts/with-follow-app-delegate.js")],
],
experiments: {
typedRoutes: true,
Expand Down
33 changes: 33 additions & 0 deletions apps/mobile/scripts/with-follow-app-delegate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { withAppDelegate } = require("@expo/config-plugins")
const { mergeContents } = require("@expo/config-plugins/build/utils/generateCode")

const withFollowAppDelegate = (config) => {
return withAppDelegate(config, async (config) => {
let newContents = config.modResults.contents

newContents = mergeContents({
src: newContents,
anchor: "// You can add your custom initial props in the dictionary below.",
newSrc: `
[UIView appearanceWhenContainedInInstancesOfClasses:@[[UIAlertController class]]].tintColor =
[UIColor colorWithRed:255.0/255.0
green:92.0/255.0
blue:0.0/255.0
alpha:1.0];
self.window.tintColor = [UIColor colorWithRed:255.0/255.0
green:92.0/255.0
blue:0.0/255.0
alpha:1.0];
`,
offset: 3,
tag: "custom tint color",
comment: " //",
}).contents

config.modResults.contents = newContents

return config
})
}

module.exports = withFollowAppDelegate

0 comments on commit 6c28b4f

Please sign in to comment.