Maps: SymbolLayer style `textVariableAnchor` & `textRadialOffset` not typed (was: SymbolLayer style "textVariableAnchor" & "textRadialOffset" are not working)

Created on 31 Jul 2020  路  12Comments  路  Source: react-native-mapbox-gl/maps

textVariableAnchor is documented under the docs for SymbolLayer, but it's not defined in the type definitions and does not work when I try using it anyway. I am using v8.0.0 and do not see any evidence of this feature being added to v8.1.0.

Is there any other way to dynamically avoid text collisions for a SymbolLayer without the text overlapping?

good first issue help wanted

All 12 comments

Can you please add a working test case to reproduce this?

@ferdicus I've started writing a test in the PR I opened, but I'm not sure how to finish it.

  • I have no idea how to actually test that textVariableAnchor is working with multiple SymbolLayer points (My manual testing demonstrates it's not working for v8.0.0).
  • I do not know how to test that the array input for textVariableAnchor is valid. I noticed that it's actually accepting an invalid array while the root of the style will throw an error for an invalid style object key.
  • v8.0.0 index.d.ts does not include textVariableAnchor nor textRadialOffset, while styleMap.js does. I see that styleMap.js is auto generated and I have no idea how that works. I would think both index.d.ts and styleMap.js should be auto generated together.

Here's the official Mapbox documentation for these features.

@tomdaniel0x01 sorry we just need an example component we can reproduce the issue.

Something like this:
https://github.com/react-native-mapbox-gl/maps/blob/master/example/src/examples/BugReportExample.js

@ferdicus I've started writing a test in the PR I opened, but I'm not sure how to finish it.

* I have no idea how to actually test that `textVariableAnchor` is working with multiple SymbolLayer points (My manual testing demonstrates it's not working for v8.0.0).

* I do not know how to test that the array input for `textVariableAnchor` is valid. I noticed that it's actually accepting an invalid array while the root of the style will throw an error for an invalid style object key.

* v8.0.0 `index.d.ts` does not include `textVariableAnchor` nor `textRadialOffset`, while `styleMap.js` does. I see that `styleMap.js` is auto generated and I have no idea how that works. I would think both `index.d.ts` and `styleMap.js` should be auto generated together.

Here's the official Mapbox documentation for these features.

Oh man... terribly sorry for wasting your time...
I didn't communicate my intentions clearly enough, yeah - I meant what mfazekas said in the above comment.

Feel free to edit the description of this ticket and close the accompanying PR.

Thanks, and sorry again

So I discovered that textVariableAnchor and textRadialOffset are actually working, but sometimes not. It works suitably, but not as well as I was expecting. So I don't think that has anything to do with this library.

However, the TypeScript typings are still missing for both textVariableAnchor and textRadialOffset.

Oh man... terribly sorry for wasting your time...
I didn't communicate my intentions clearly enough, yeah - I meant what mfazekas said in the above comment.

No worries, I practice TDD so I was more than happy to give it a shot.

Feel free to edit the description of this ticket and close the accompanying PR.

Why not just include this test in the repo? One doesn't exist for SymbolLayer yet but tests do exist for many of the other components. I've removed the last test in the file for textVariableAnchor and textRadialOffset. IMHO the more test coverage the better.

Why not just include this test in the repo? One doesn't exist for SymbolLayer yet but tests do exist for many of the other components. I've removed the last test in the file for textVariableAnchor and textRadialOffset. IMHO the more test coverage the better.

Yeah, you're right - now that it's there, why close it amirite.jpg

Will check this friday and let you know.

Thanks

Changed the label to: First issue, as it's now just about the TS props.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Bump.

Are the TS types fixed now?

Bump.

Are the TS types fixed now?

Are now - will wait for the tests to pass and merge it

@tomdaniel0x01 , it's in the current master

@ferdicus Awesome. Thanks!

Was this page helpful?
0 / 5 - 0 ratings