nativescript-community / nativescript-community/ui-mapbox

Layer layout with "icon-text-fit-padding" not working in ios

Open
#95 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
38
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Hello I am currently evaluating this library for a project and noticed some support differences between ios and android.

For this case, I am able to apply "icon-text-fit": "width" to resize icon to the text size for both environment but when I provide "icon-text-fit-padding" I get an error which breaks layer rendering in ios.

` this.mapbox
.addLayer({
id: "store-locations",
type: "symbol",
source: "stores",
filter: ["has", "label_en"],
minzoom: 0,
maxzoom: 20,

      layout: {
        "icon-opacity": ["case", ["has", "label_en"], 1, 0],
        "text-field": [
          "case",
          ["has", "label_en"],
          ["get", "label_en"],
          "",
        ],
        "icon-image": ["case", ["has", "label_en"], "box2", ""],
        "icon-text-fit": "width",
        "icon-text-fit-padding": [0, 0, 0, 0],

        "icon-size": 1,
        "text-font": ["Open Sans Regular", "Arial Unicode MS Regular"],
        "text-size": 12,
      },
    })
    .catch((e) => {
      console.log(e);
    });`

This is the error in IOS

Error: -[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xac6605cc1e5c96e6

I suspect that should be a supported attribute in ios as if I provide a wrong format I get an error that the format needs to be an array with 4 items.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the addLayer call and the iOS handling of the "icon-text-fit-padding" layout property, using the reported isEqualToString error as the first symptom to trace. Compare it with the working "icon-text-fit" behavior and the existing invalid-format validation. Done means the provided layer renders on iOS with a four-item padding array without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.