NoriginMedia / Norigin-Spatial-Navigation

React Hooks based Spatial Navigation (Key & Remote Control Navigation) / Web Browsers, Smart TVs and Connected TVs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic RTL switching

karimlaham opened this issue · comments

Is your feature request related to a problem? Please describe.
My app supports dynamic switching of languages, hence necessitates updating the writingDirection prop of the spacial navigation instance
I want to do so without calling init again

Describe the solution you'd like
I would like to add the bellow function to the SpacialNavigation.ts class
bellow is my suggestion

 /**
   * This function updates the writing direction
   * @param rtl whether the writing direction is right-to-left
   */
  updateRtl(rtl: boolean) {
    this.writingDirection = rtl ? WritingDirection.RTL : WritingDirection.LTR;
  }

reference to PR with suggested change: #120