Skip to content

Fix TouchablePreview lifecycle and iOS fallback - #8348

Open
OskarEichler wants to merge 1 commit into
wix:masterfrom
OskarEichler:codex/fix-touchable-preview-lifecycle
Open

Fix TouchablePreview lifecycle and iOS fallback#8348
OskarEichler wants to merge 1 commit into
wix:masterfrom
OskarEichler:codex/fix-touchable-preview-lifecycle

Conversation

@OskarEichler

Copy link
Copy Markdown

Problem

TouchablePreview never applies its documented iOS fallback because it uses instanceof against the TouchableNativeFeedback component type. Pending preview timeouts also survive unmount and can call onPeekOut after teardown, while the shared peeking flag can be cleared by an unrelated instance.

Fix

  • compare component identity for the iOS fallback
  • cancel pending preview work during unmount
  • track ownership so only the active preview can release the shared peeking state
  • model custom touchables as React.ElementType in TypeScript and PropTypes, removing the stale cast and suppression

Breaking changes

None. This restores the documented fallback and prevents callbacks/state changes after teardown.

Test plan

  • Added regressions for the iOS native-feedback fallback, unmount timeout cleanup, and cross-instance peek ownership.
  • Added runtime type coverage for memoized React element types.
  • Focused suite passes: 4/4 tests.
  • Full yarn test-js passes: 39 suites/399 tests; 11 suites/59 tests remain intentionally skipped.
  • Focused ESLint, Bob module/type builds, and git diff --check pass.

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.

1 participant