An Expo native module wrapping LNExtensionExecutor. Allows bypassing UIActivityViewController to execute both UI and non-UI action extensions.
-
Create a new Expo native module in your app
npx create-expo-module@latest --local ln-extension-executor-bridge
-
Delete all files in
modules/ln-extension-executor-bridge
:rm -rf modules/ln-extension-executor-bridge/*
-
Clone this repo into the
modules/ln-extension-executor-bridge
directory. You can delete README.md and LICENSE.cd modules/ln-extension-executor-bridge && git clone https://github.com/carter-0/ln-extension-executor-bridge.git .
rm README.md LICENSE
That's it! It's not the most elegent installation and it could definitely be improved by making it a real package but I spent so long getting this to work that I'm not touching it for now.
Make sure to re-build your app before usage.
Import the module:
import LnExtensionExecutorBridgeModule from "../modules/ln-extension-executor-bridge/src/LnExtensionExecutorBridgeModule"
Executes an iOS extension with the given context.
async function executeExtension(context: ExtensionContext): Promise<ExtensionResult>
Parameters:
context
: An object containing:bundleIdentifier
: The bundle ID of the extension to executeextensionPointIdentifier
(optional): The extension point IDactivityItems
(optional): Array of items to pass to the extension
Returns:
ExtensionResult
: Object containing:completed
: Boolean indicating if execution completedreturnItems
: Array of items returned from the extension
Lists all available extensions.
async function listExtensions(): Promise<ExtensionItem[]>
Returns array of ExtensionItem
objects containing:
bundleIdentifier
: Extension's bundle IDname
: Extension nameextensionPointIdentifier
: Extension point ID
Checks if an extension is available.
async function isExtensionAvailable(bundleIdentifier: string): Promise<boolean>
Parameters:
bundleIdentifier
: Bundle ID to check
Returns boolean indicating availability.
// Check if extension exists
const available = await LnExtensionExecutorBridgeModule.isExtensionAvailable(
"com.burbn.instagram.shareextension"
);
// List all extensions
const extensions = await LnExtensionExecutorBridgeModule.listExtensions();
// Execute an extension
const result = await LnExtensionExecutorBridgeModule.executeExtension({
bundleIdentifier: "com.burbn.instagram.shareextension",
activityItems: ["https://www.google.com"]
});
These can be hard to find so here's a list of some common ones to help you out :)
com.burbn.instagram.shareextension
: Instagramcom.toyopagroup.picaboo.share
: Snapchatnet.whatsapp.WhatsApp.ShareExtension
: WhatsAppcom.facebook.Messenger.ShareExtension
: Facebook Messengerph.telegra.Telegraph.Share
: Telegramcom.iwilab.KakaoTalk.Share
: KakaoTalkjp.naver.line.Share
: LINE
MIT