Skip to content

title / titleCancel not updated when props change #4

@rbarkhouse

Description

@rbarkhouse

I am trying to use the title & titleCancel props of FullscreenControl to provide translated strings depending on my selected language -- I'm using redux-polyglot and plugging into FullscreenControl like this:

          <FullscreenControl
            title={this.props.p.t('FullScreen')}
            titleCancel={this.props.p.t('ExitFullScreen')}
            position='topright'
            content={fullscreenIcon} />

The issue is, when the Map is mounted, polyglot will not have finished loading the translation strings yet... eventually, this.props.p will be updated when the strings have been loaded. But, when this.props.p gets updated, FullscreenControl never updates to pass the new values to the underlying Leaflet code.

I see in the FullscreenControl source that props are only utilized in componentWillMount, could you add a hook so that when props change, the leaflet.fullscreen plugin gets updated as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions