Version Packages - #25
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
react-native-theme-transition@2.0.0
Major Changes
390a887: v2: Skia engine, 9 transitions, radically simpler API.
The engine was rebuilt on top of
@shopify/react-native-skia. The providernow snapshots the inner tree into a pre-mounted Skia Canvas, swaps the theme
underneath, and animates the captured frame away with one of nine transition
styles. The public API was re-shaped around a four-field hook and a
discriminated options union.
The hook now splits two orthogonal concepts:
themeis always concrete(the theme currently painted on screen), and
preferenceis the user'sraw pick (which can be
'system'). No moreisSystemModeflags, nomore "picker state vs active theme" duality.
Breaking: peer dependencies
react-native-view-shotis replaced by@shopify/react-native-skia(>= 2.0.0):Minimum versions for the surrounding stack were also raised:
react>=18.0.0>=19.0.0react-native>=0.76.0>=0.78.0react-native-reanimated>=4.0.0>=4.0.0react-native-worklets>=0.5.0>=0.5.0react-native-view-shot>=3.0.0@shopify/react-native-skia>=2.0.0React 19 and React Native 0.78 are hard requirements: v2 reads context
via React 19's
use()hook, and@shopify/react-native-skia2.0 itselfdeclares
react: ">=19.0"andreact-native: ">=0.78"as peerdependencies. Apps on older React or React Native versions need to
upgrade before installing v2.
Breaking:
useThemereturn shapecolorsandnamemoved undertheme, andtheme.schemeis a newbinary
'light' | 'dark'classifier derived fromdarkThemes.preferenceis a brand-new top-level field that mirrors the user'sraw pick (including
'system') and updates synchronously insidesetThemeso pickers can drop their optimistic local state.selected,select,initialSelection,SelectOptions,UseThemeOptions, anduseReducedMotionare gone. The engine's internalSETTLE.beforeCapturewait gives React batching time to paint before the snapshot is taken, so
no hook magic is needed. See the Migration guide.
Breaking:
setThemereturn type'accepted'means the library will apply the change (instantly or via ananimated transition).
'ignored'means nothing will happen (alreadytransitioning, or same theme in the same mode). Most callers don't need
the return value; reactive state (
isTransitioning, callbacks) isusually enough.
Breaking: removed config options
reduceMotion: removed. The library no longer honors OS ReduceMotion: these are brief color transitions, not spatial motion, and instant
swaps are arguably more jarring than a 350ms fade. Consumers who want
to honor the OS setting write their own
AccessibilityInfolistenerand pass
animated: falseper call.duration: removed from config. Each transition family has its owncalibrated default (350ms fade / reveal / strip, 800ms shape, 750ms
shader). A global override would flatten that calibration. Override
per call with
setTheme(name, { duration: 400 })when you need it.backgroundColor: removed. The library no longer paints aroot background behind the inner tree. Set
backgroundColoronyour own root
Viewas with any standard React Native app.Breaking: renamed option fields
{ transition: 'split', axis: 'horizontal' }{ transition: 'split', mode: 'top-bottom' }{ transition: 'split', axis: 'vertical' }{ transition: 'split', mode: 'left-right' }{ transition: 'dissolve', grainSize: 5 }{ transition: 'dissolve', noiseSize: 5 }{ transition: 'invertedCircularReveal' }{ transition: 'circularReveal', inverted: true }The
diamondtransition proposed in early v2 work was removed beforeshipping; only the 9 below are supported.
Breaking:
directionsemantics unified (wipe + slide)In v1,
direction: 'right'meant "sweep rightward" onwipebut "newenters from the right" on
slide: two opposite visual meanings for thesame string. In v2 both transitions share the same rule:
direction: 'right'is the direction the motion is heading, so the new theme enters from the
LEFT edge and sweeps rightward. Default is
'right'.New transitions
On top of v1's
fade, v2 adds eight new styles:circularReveal: expanding circle from any origin (point or ref).heart: a heart-shaped clip grows from the origin.star: a 5-point star clip grows from the origin.wipe: a directional edge sweeps across the screen.slide: both old and new slide across like a carousel.split: the screen parts or shutters alongmode.pixelize: shader crossfade through a shared pixel grid.dissolve: noise-threshold disintegration.Every reveal / shape transition accepts
inverted.SetThemeOptionsis adiscriminated union: TypeScript only accepts the extra fields valid for
the chosen
transition.New:
TRANSITION_METAruntime exportThe same table that drives the type union is exported so consumers can
build transition pickers that adapt their UI without hardcoding the list:
Internal changes worth noting
setTimeout(finish, duration + 50)to
setTimeout(finish, duration), removing v1's safety buffer thatstacked latency on fast devices. Reanimated 4's worklet completion
callback would be cleaner, but it doesn't reliably fire for the
nested-async closures the engine creates — see the comment on
finishTimerRef.SETTLE.treeRepaintis gated to reveal / shape / capturesNew transitionsso fade / wipe / split / dissolve save a frame of start latency.
OverlayParamsand theDEFAULT_*constants live insrc/overlay/types.tsas a single source of truth for the engine andthe overlay.
darkThemesconfig is now validated at init (unknown names throw).SkImagecapture replaces the v1view-shot to URI to RN
<Image>decode pipeline, shaving roughly30ms off every swap.
Migration
Full walkthrough at
recipes/migration.