Skip to content

Function: ssPreload() ​

ssPreload(source, options?): Promise<void>

Defined in: packages/react-native-spritestudio/src/player/preload.ts:35

Loads a pack and its atlases ahead of the mount that needs them.

Both halves matter and the second is the slower one: parsing the .ssab happens in C++ against bytes that never enter the JS heap, while every texture is a PNG decode. A <SpriteStudioView> that mounts against a warm cache draws on its first frame instead of showing placeholder while the atlas arrives.

The way the textures get warmed is by loading a whole player and throwing it away — there is no shorter route, because the texture list is read out of the .ssab by a context, which is a player. What survives the throwaway is exactly the cache entries, retained so its dispose does not evict them.

Balanced by ssUnload, or by ssClearCaches for the lot. Calling it twice for one source is safe and does the work once.

Parameters ​

source ​

SsSource

options? ​

animation? ​

string

Returns ​

Promise<void>