Skip to content

Support Web Share API in Android WebView#594

Open
albasitum wants to merge 17 commits intodevelopfrom
feature/native-share
Open

Support Web Share API in Android WebView#594
albasitum wants to merge 17 commits intodevelopfrom
feature/native-share

Conversation

@albasitum
Copy link
Contributor

The Web Share API (navigator.canShare and navigator.share) is patched on Android WebView by overriding both methods in the Map Viewer, forwarding share events via postMessage, and handling them natively with the React Native Share API.

cristian-situm and others added 17 commits October 15, 2025 08:53
Automatic merge into master to Release 3.16.0
Automatic merge into master to Release 3.16.1
Automatic merge into master to Release 3.16.2
Automatic merge into master to Release 3.16.3
Automatic merge into master to Release 3.16.4
Automatic merge into master to Release 3.17.0
Automatic merge into master to Release 3.17.1
Automatic merge into master to Release 3.17.2
Automatic merge into master to Release 3.17.3
Automatic merge into master to Release 3.18.0
Automatic merge into master to Release 3.18.1
Automatic merge into master to Release 3.18.2
Automatic merge into master to Release 3.18.3
Automatic merge into master to Release 3.18.4
Automatic merge into master to Release 3.18.5
@albasitum albasitum changed the title Feature/native share Support Web Share API in Android WebView Feb 16, 2026
}
};

const _onWebShareMessage = useCallback(async (param: WebShareAPIParam) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Por que useCallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Porque non quero que se cree esta función en cada render. Todas as función se deberían de memoizar. Por exemplo handleRequestFromViewer estase recreando en cada render, e pasándoselle ao compoñente WebView como si fose unha prop nova siempre, e quizais non en todos os render é o caso.

Por ese mesmo motivo _androidShareInjection está dentro dun useMemo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entón, é correcto manter const handleRequestFromViewer = (event: WebViewMessageEvent) => { sin engadir useCallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, non é correcto. Habería que revisar o plugin enteiro porque si lle meto useCallback a handleRequestFromViewer pero algunha das dependencias non ten useCallback é coma se non fixera nada 🤕 .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, xa te visitaremos xD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments