react-native-select-contact icon indicating copy to clipboard operation
react-native-select-contact copied to clipboard

Expo custom config plugin

Open marcfrankel opened this issue 2 years ago • 5 comments

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]);
};

marcfrankel avatar Feb 09 '23 15:02 marcfrankel

Thanks @marcfrankel! Where would we actually put this file in our project in order for it to be auto-picked up and used by Expo? Would you like to create a PR to bring this in?

seanadkinson avatar Feb 14 '23 01:02 seanadkinson

@seanadkinson I think more info can be found here: https://docs.expo.dev/guides/config-plugins/#importing-plugins

I could potentially open a PR to do this if that's desired, but I will caution what I wrote is extremely rough and may need to be improved past my skill level...

marcfrankel avatar Feb 14 '23 18:02 marcfrankel

@seanadkinson There's a pr for this by @iamMAHAM . It would be nice to have the package support expo

eniolajayi avatar May 24 '24 08:05 eniolajayi

@eniolajayi Unfortunately I am no longer an Editor in this repo. Perhaps @giantryansaul or @kjanderson2 can direct someone to assist?

seanadkinson avatar May 30 '24 16:05 seanadkinson