1

i am using ionic react and struggling on how to use calcWidth to get the width dynamically. Currently i am using something like below

width={310}

which gives 310 px in my react component i am using. the documentation suggest to use calcWidth but does not explain how. I see some examples to use Dimensions but seems i could not use that with ionic react.

i tried plain

width={calcWidth} 

but that does not work as it will need the width property.

Moblize IT
  • 1,140
  • 2
  • 18
  • 44

1 Answers1

2

Well you can obtain the screen width by using the window:

window.innerWidth
Luís Silva
  • 146
  • 5