Skip to content

WhenState with factory function never gets stateValue #23

@evelant

Description

@evelant

    const [activeState, setActiveState] = useFluidState(false)

    const whenFac: WhenFactoryFunction = ({ screenSize, metrics, state, stateValue }) => {
        console.log("State value? ", stateValue)
        return {
            interpolation: [
                {
                    styleKey: "transform.translateY",
                    inputRange: [0, 1],
                    outputRange: [0,  10],
                },
            ],
        }
    }

   const config = useFluidConfig( WhenState(activeState, whenFac))
   ....

In this example stateValue is always undefined when the factory runs regardless of the value of activeState

If I add a line activeState.value = activeState.active then stateValue gets passed to the factory function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions