Repository navigation
feat(RasterSource): add prefetchZoomDelta and tileNetworkRequestsDela… - #4356
Open
oliverfernandez wants to merge 1 commit into
Open
oliverfernandez wants to merge 1 commit into
oliverfernandez wants to merge 1 commit into
Conversation
…y props Expose two Mapbox v11 raster source options that were not reachable from JavaScript: - prefetchZoomDelta: how many zoom levels above the current one are requested as placeholders while the current tiles load. 0 turns the prefetch off. - tileNetworkRequestsDelay: milliseconds to wait before a tile's network request goes out during a gesture or camera animation, so tiles that leave the viewport first are never requested. Both map straight to the native source builders on iOS and Android. Docs regenerated with yarn generate, and a new example scene uses both props. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
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.
Description
Added
prefetchZoomDeltaandtileNetworkRequestsDelayprops toRasterSource. They expose two Mapbox v11 raster source options that are set today only by the SDK defaults:prefetchZoomDelta: how many zoom levels above the current one are requested as placeholders while the current tiles load. Mapbox defaults to 4.0turns the prefetch off, which suits overlays such as weather radar where the placeholder is never visible.tileNetworkRequestsDelay: milliseconds to wait before a tile's network request goes out while a gesture or camera animation is in progress. Tiles that leave the viewport before the delay elapses are never requested. Mapbox defaults to 0.Both map straight to
RasterSource.prefetchZoomDelta/tileNetworkRequestsDelayon iOS andRasterSource.Builder.prefetchZoomDelta()/tileNetworkRequestsDelay()on Android. They are read when the source is created, like the other source props.Motivation: a weather app with 25 raster frames at one camera position. With the defaults, each frame also fetched parent tiles it never showed, and a pan requested tiles for positions the finger had already left. With these two options the same open costs a quarter of the tile requests.
Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Testing notes: verified on iOS (v11, New Architecture) and compiled on Android (v11, New Architecture) through a production React Native 0.81 app that consumes this branch as a patch: the Fabric codegen picks up the new spec props, the component view and the Swift source compile, the Kotlin manager and source compile, and the raster tiles render on the iOS simulator with
prefetchZoomDelta={0}andtileNetworkRequestsDelay={200}. A proxy capture on iOS confirmed that only tiles of the current zoom level are requested. Android was compile-checked only; the new example sceneRasterSourceTileRequestsis the place to confirm it at runtime.Screenshot OR Video
No visual change. The example scene
Fill/Raster Layer > Raster Source tile requestsshows the props in use; compare the network log withRaster Sourcewhile panning.