React-mapbox-gl: Support for Right To Left Scripts

Created on 7 Jun 2018  路  3Comments  路  Source: alex3165/react-mapbox-gl

Is it possible initialising mapboxgl with RTL support could be added? This is detailed in this Mapbox example:

https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-rtl-text/

The key line being:

mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.2/mapbox-gl-rtl-text.js')

I may be wrong but I couldn't find a way of doing this with this package so had to fork it and build a slightly hacky version for now. Ideally I suppose the ReactMapboxGl options would include an optional RTL plugin URL, which if included would initialise the plugin.

Most helpful comment

import { setRTLTextPlugin } from "mapbox-gl";

setRTLTextPlugin(
  "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js",
  null,
  true
);

https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-rtl-text/

All 3 comments

Hey @DaveBathnes,

I had the same issue and I could fix it without making any changes into the library. Since you've installed mapbox-gl package alongside this library, you can do the following before you start using it:

import { setRTLTextPlugin } from 'mapbox-gl';

and then:

setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.2/mapbox-gl-rtl-text.js');

thank you @jmosawy it worked for me ....

import { setRTLTextPlugin } from "mapbox-gl";

setRTLTextPlugin(
  "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js",
  null,
  true
);

https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-rtl-text/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evanfrawley picture evanfrawley  路  26Comments

UncleChenna picture UncleChenna  路  14Comments

rlueder picture rlueder  路  13Comments

PawkaHub picture PawkaHub  路  17Comments

piaaaac picture piaaaac  路  13Comments