CreateAnimation doesn't work with dynamic toValue

Hey I’m trying to change the fontSize based on toggle state.

<CreateAnimation
            play={true}
            iterations={Infinity}
            duration={350}
            fromTo={[
              { property: 'fontSize', fromValue: '64px', toValue: !expanded ? '64px': '24px' }
            ]}
          >
            <div>Helloworld</div>
          </CreateAnimation>

This doesn’t work. Can someone shed some light here.
Also the documentation seems a bit outdated for react
For example https://ionicframework.com/docs/utilities/animations#overriding-ionic-component-animations
The example shown there, imports CreateAnimation class which is of react but uses in the end the javascript one i.e. createAnimation.