Skip to content

chore/visibility - #13

Merged
majornutcracker-dev merged 7 commits into
mainfrom
chore/visibility
Sep 23, 2026
Merged

majornutcracker-dev merged 7 commits into
mainfrom
chore/visibility

Conversation

@JoshuaPariona

Copy link
Copy Markdown
Collaborator

Summary

Makes the package work in Expo Go and Snack, rewrites the metadata that npm and
search engines index, documents the selection-menu recipe people keep asking
for, and cuts 1.1.0.

src/SelectableTextModule.ts resolved the native module with
requireNativeModule at import time, only to expose a version constant that
nothing reads. In Expo Go that module is not in the binary, so importing the
package threw — even though react-native-webview, the thing the view actually
needs, ships inside Expo Go. It now resolves with requireOptionalNativeModule.
The native module stays, so we can patch the WebView natively later; the default
export is simply null where it is absent.

The rest is metadata and docs:

  • npm description no longer opens with the brand (the words npm weighs most)
    and no longer promises "custom menus", which the module does not ship.
  • Keywords drop the brand, the package's own name, and terms nobody searches
    (serialization, synchronization, restoration, native module) in favour
    of how people describe the problem: highlighter, annotation, ebook,
    reader, notes, bookmark.
  • API reference gains Your own selection menu: webViewProps.menuItems and
    onCustomMenuSelection reach react-native-webview untouched, so the native
    menu can drive the ref's highlight methods. example/src/screens/Reader.tsx
    already wires exactly this, so the section points at working code.
  • README opens with badges and an Is this the right library? table that is
    as explicit about what this is not for (native <Text>, web, PDF) as what it
    is for.
  • docs/VERSION-UPDATE.md now also maps the cosmetic version references, the
    four places the supported react-native-webview range is duplicated, and the
    nine places the vendored rangy@1.3.2 directory name appears.

Type of change

  • fix — bug fix (no public API change)
  • feat — new backward-compatible API
  • Breaking change to the public API or the RN ↔ WebView bridge contract
  • docs / chore / ci / test — no runtime change

The default export's type widens from the module to Module | null, which is
why this is 1.1.0 and not 1.0.1. Anyone reading .version off it now needs a
null check; nothing else in the public surface moves.

How was this tested?

yarn lint, yarn typecheck and yarn test (151 tests) pass.

On device, through a throwaway app outside this repo that installs the library
from npm pack — a real copy of what would be published, not a path link:

Expo Go Android Expo Go iOS Bare Android Bare iOS
Loads without throwing yes yes yes yes
Native module null null loaded loaded
HTML content rendered yes yes yes yes
Selection menu items yes — yes —
Highlight + serialized payload yes — yes —
Save → remount → restore yes — — —

The bare runs came from npx expo prebuild, which autolinked the pod
MajornutcrackerReactNativeSelectableText from the tarball; Gradle and Xcode
built with no further setup.

On Android the whole loop was exercised: long-press selects, the menu shows only
our items, applying one paints the highlight and emits the serialized payload,
remount drops the WebView (captured mid-reload, blank), and restore repaints it
from the saved payload.

The — cells are the touch half on iOS only: the simulator takes no input from
the CLI without accessibility permission. iOS rendering and the null module
were verified; iOS selection behaviour is unchanged by this PR and is what the
example app's GIFs already show.

  • iOS (rendering and module resolution; touch interaction not exercised)
  • Android (full interaction loop)

Checklist

  • yarn lint, yarn typecheck, and yarn test all pass.
  • Public API changes are documented — the nullable default export is in the
    changelog and in a comment at the call site. It is not in the README prop
    table, which covers props rather than the module export.
  • Bridge changes keep all three sides in sync — no bridge change here.
  • CHANGELOG.md updated under ## [Unreleased] — deliberately not: this PR
    cuts the release, so the entries sit under ## [1.1.0] - 2026-09-23 with a
    fresh empty ## [Unreleased] above.
  • I did not bump the version — deliberately not: bump: v1.1.0
    syncs all six places docs/VERSION-UPDATE.md lists (versionCode 1 → 2)
    per its release flow, which commits the bump, merges to main, and then
    tags. Merging this arms git tag v1.1.0, which publishes to npm.

@JoshuaPariona JoshuaPariona added documentation Improvements or additions to documentation enhancement New feature or request release labels Sep 23, 2026
@JoshuaPariona JoshuaPariona changed the title Chore/visibility chore/visibility Sep 23, 2026
@majornutcracker-dev
majornutcracker-dev merged commit 8b82f4f into main Sep 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants