Skip to content
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

Turn this into an expo plugin #245

Open
NightScript370 opened this issue Feb 7, 2024 · 0 comments
Open

Turn this into an expo plugin #245

NightScript370 opened this issue Feb 7, 2024 · 0 comments

Comments

@NightScript370
Copy link

I currently use expo by having it generate my apk without having me deal with any Android XML data. With that being said, apptentive expects values written to the styles.xml file that by normal standards I wouldn't be able to write to. As such, I ask that a app.plugin.js file be added which would generate the necessary changes once the plugin is linked in the app's app.config.ts file.

Here's my attempt, which for some reason doesn't end up writing anything

// @ts-check

const expoCP = require('@expo/config-plugins')

/** @type {expoCP.ConfigPlugin} */
function expoModifyPlugin (baseConfig) {
    baseConfig = expoCP
        .withAndroidColors(baseConfig, config => {
            config.modResults = expoCP.AndroidConfig.Colors.assignColorValue(config.modResults, { name: "colorSurface", "value": "#000000" })
            return config
        })
    baseConfig = expoCP
        .withAndroidStyles(baseConfig, config => {
            config.modResults = expoCP.AndroidConfig.Styles.assignStylesValue(config.modResults, { name: "colorSurface", "value": "@color/colorSurface", add: true, parent: expoCP.AndroidConfig.Styles.getAppThemeLightNoActionBarGroup()})
            return config
        })

    return baseConfig;
}

module.exports = expoModifyPlugin;

Let me know if there's any way I could help with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant