apptentive-react-native icon indicating copy to clipboard operation
apptentive-react-native copied to clipboard

Turn this into an expo plugin

Open NightScript370 opened this issue 2 years ago • 0 comments

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.

NightScript370 avatar Feb 07 '24 20:02 NightScript370