rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.28k stars 847 forks source link

add preferredFramesPerSecond support #3627

Open knowbody opened 2 months ago

knowbody commented 2 months ago

Description

Added support for preferredFramesPerSecond property in both iOS and Android, which allows developers to set the preferred frame rate for rendering the MapView. This feature is especially useful for optimizing performance and battery usage by adjusting the frame rate dynamically.

Checklist

Screenshot OR Video

N/A

Component to reproduce the issue you're fixing


<MapView
  preferredFramesPerSecond={30}
  style={{ flex: 1 }}
/>
knowbody commented 2 months ago

would you be able to help me or point me in the right direction on how/where to do it?

mfazekas commented 2 months ago

would you be able to help me or point me in the right direction on how/where to do it?

Sure. First you have to add to:

https://github.com/rnmapbox/maps/blob/96552bc37ec5a4694c50a054cc1f8dc2351e5f0c/src/specs/RNMBXMapViewNativeComponent.ts#L35-L37

Then run yarn generate to update java interfaces for old arch. Then you need to add to a few places. Search for an existing property like:

compassFadeWhenNorth:

https://github.com/rnmapbox/maps/blob/96552bc37ec5a4694c50a054cc1f8dc2351e5f0c/src/specs/RNMBXMapViewNativeComponent.ts#L43

And add where it is.

mfazekas commented 1 month ago

@knowbody what's the status on this? Do you need help to move it forward?

knowbody commented 3 weeks ago

@mfazekas I do apologise, now I have notifications on so will be more responsive.

I updated my PR. When I tried running yarn generate I ran into issues of missing dependencies in the /example, and when I tried running yarn in the /example I get an error:

$ node ./scripts/set_access_token.js && patch-package
node:internal/fs/utils:350
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'accesstoken'

otherwise I did the changes you asked for

mfazekas commented 4 days ago

$ node ./scripts/set_access_token.js && patch-package node:internal/fs/utils:350 throw err; ^

Error: ENOENT: no such file or directory, open 'accesstoken'

This might be int the contributing docs, in order to run the example you'll need to create an accesstoken file with a mapbox access token