Skip to content

callbackWithX usage example #23

@nunsie

Description

@nunsie

Good day.

Really enjoying your library so far but I am struggling to understand how to make use of callbackWithX.

I need to update another elements content with the value returned from this function.

Example:

  const currentText = 12345.44
  const updateText = (text) => {
     // if not update state then what?
  }
  return (
    <View style={styles.container}>
        <Text>{currentText}</Text>
        <SlideAreaChart
          scrollable
          callbackWithX={updateText}
          animated={false}
          alwaysShowIndicator={false}
          style={{ marginTop: 32 }}
          shouldCancelWhenOutside={false}
          data={data}
          axisWidth={0}
          axisHeight={0}
          paddingBottom={8}
          toolTipProps={{
          }}
        />
    </View>
  );

In the example above, my goal is to update currentText so I can have this displayed in the <Text /> component.

If I should not be making use of state to achieve this, what should I be using instead?

I'm just struggling to find a pattern that works.

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