Skip to content

Turn this into an expo plugin #245

@NightScript370

Description

@NightScript370

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions