For the complete documentation index, see llms.txt. This page is also available as Markdown.

πŸ–ΌοΈShare Media/Files

Open the native share sheet to let users share text, images, or files with other apps on their device.

What is Share Media/Files?

Share Media/Files opens the device's native share sheet, letting users share content directly from your app to any other app that supports it - messaging apps, email, social media, cloud storage, and more. You can share plain text, an image by URL, a combination of text and image, or a file by URL.

The share sheet is handled entirely by the OS - your app doesn't control which apps appear or what the user selects, and there is no callback when the user completes or dismisses the share.

Prerequisites

Implementation

Choose your integration method below: Bubble.io Plugin (No-Code), JavaScript SDK (Code), or AI Agents (for AI-powered editors like Lovable, Base44, and Replit).

Initialization

Check Plugin

Before starting, verify if the Natively plugin is already installed in your Bubble project.

  1. Open your Bubble editor and navigate to the Plugins tab in the left sidebar.

  2. Check Installed Plugins: Look through your list of installed plugins for "Natively iOS & Android app builder".

    • If it IS installed: Check the version number. If an update is available (e.g., you see a button saying "Update"), click it to ensure you have the latest features and bug fixes.

  • If it is NOT installed: Click the + Add plugins button, search for "Natively", and click Install.

Check SDK

Before writing any logic, ensure the Natively SDK is correctly installed and up-to-date in your codebase.

  1. Open your project's main HTML file (or header settings) and look for the Natively script tag inside the <head> section.

  2. Install/Update: If missing or outdated, add the following code. You can specify the SDK version in the URL (e.g., @2.26.0).

To ensure you are using the most up-to-date version, check the Natively GitHub releases page for the latest version number.

Initialize the SDK

AI-powered editors like Lovable, Base44, and Replit use the JavaScript SDK to implement Natively features. Before implementing any feature, the Natively SDK must be initialized in your project.

Copy the line below and paste it into your AI agent to check and set up the Natively SDK in your project.

Setup Logic

[Action] Natively - Share

  • Type - the type of content to share:

    • text - share plain text or a URL;

    • image - share an image by URL;

    • both - share text/URL combined with an image;

    • file - share a file by URL;

  • Text or URL - the text or URL to share (used for text and both types)

  • Image URL - the URL of the image to share (used for image and both types)

  • File URL - the URL of the file to share (used for file type)

AI-powered editors like Lovable, Base44, and Replit use the JavaScript SDK to implement Natively features.

Copy the line below and paste it into your AI agent.

How to use

Use shareText to let users share a link to your app or a specific page. Pre-fill the text with a message and the URL so the user just picks where to send it.

Share a product image

Use shareImage or shareTextAndImage to let users share a product photo with a caption. Useful for e-commerce apps where users want to send items to friends.

Share a document or file

Use shareFile to let users share a PDF, invoice, receipt, or any other file. The file must be publicly accessible via URL - local files are not supported.

Trigger from a user interaction

Always trigger the share sheet from a user interaction like a button tap. Some browsers and OS versions may block share sheets that are triggered programmatically without a direct user gesture.

The OS controls the share sheet

Your app has no control over which apps appear in the share sheet or what the user selects. There is no callback when the user completes or dismisses the share sheet- design your flow accordingly.

Image and file URLs must be publicly accessible

The URLs passed to shareImage, shareTextAndImage, and shareFile must be publicly accessible - the OS fetches them directly. Private or authenticated URLs will fail silently.

Troubleshooting

Share sheet not appearing

Make sure the share is triggered from a user interaction - like a button tap - rather than automatically on page load. The OS may block share sheets that are not initiated by a direct user gesture.

Image or file not appearing in the share sheet

The URL must be publicly accessible. Private, authenticated, or local URLs will fail silently - the share sheet may open but without the expected content. Verify the URL is accessible in a browser before passing it to the share method.

Share sheet appears, but content is missing

Check that the correct method is being used for the content type - shareImage for images, shareFile for files, shareText for text only, and shareTextAndImage for both. Passing an image URL to shareText will share it as a plain text string, not as an image.

Not working in a web browser

This is a native feature and will not work in a standard web browser. Test on a real device using a Natively build or the Preview app.

No confirmation that the share was completed

There is no callback for this feature - your app has no way of knowing whether the user completed the share or dismissed the sheet. Design your flow without relying on a share confirmation.

Last updated