Skip to content

Wrong documentation for haptic feedback #207

@Aquets

Description

@Aquets

Issue description

The documentation in the README.md file for LineChart haptic feedback is incorrect.

It is suggested to use invokehaptic on onActivated and onActivated of <LineChart.CursorCrosshair /> but it isn't working. I solved it using it on onCurrentIndexChange of <LineChart.Provider />

Suggested code example

I suggest to change the code example in the documentation like this:

import * as haptics from 'expo-haptics';

const data = [...];

function invokeHaptic() {
  haptics.impactAsync(haptics.ImpactFeedbackStyle.Light);
}

function Example() {
  return (
    <LineChart.Provider data={data} onCurrentIndexChange={invokeHaptic}>
      <LineChart>
        <LineChart.Path />
        <LineChart.CursorCrosshair>
          <LineChart.Tooltip />
        </LineChart.CursorCrosshair>
      </LineChart>
    </LineChart.Provider>
  )
}

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