Skip to content

Expo custom config plugin #64

@marcfrankel

Description

@marcfrankel

Thought I would leave this here for anyone who needs it but this is a basic config plugin I made to get this package working with Expo.

Would love to see someone take this, polish it up a bit, and include it in the package itself. But hopefully it's useful to anyone in the future.

const { withAndroidManifest, withPlugins } = require('@expo/config-plugins');

const withCustomManifest = (config) => {
    return withAndroidManifest(config, async (config) => {
        let androidManifest = config.modResults.manifest;

        androidManifest['queries'].push({
            intent: [
                {
                    action: [
                        {
                            $: {
                                'android:name': 'android.intent.action.VIEW',
                            },
                        },
                    ],
                    category: [
                        {
                            $: {
                                'android:name':
                                    'android.intent.category.DEFAULT',
                            },
                        },
                    ],
                    data: [
                        {
                            $: {
                                'android:mimeType':
                                    'vnd.android.cursor.dir/contact',
                            },
                        },
                    ],
                },
            ],
        });

        return config;
    });
};

module.exports = function withAndroidContactSelector(config) {
    return withPlugins(config, [withCustomManifest]);
};

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