Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ yarn add <b>react-native-graph</b>
## Usage

```tsx
import { LineGraph } from 'react-native-graph';
import { LineGraph, type GraphPoint } from 'react-native-graph';

function App() {
const priceHistory = usePriceHistory('ethereum');
const priceHistory: GraphPoint[] = [
{ date: new Date('2026-08-27T00:00:00Z'), value: 3.44 },
{ date: new Date('2026-08-28T00:00:00Z'), value: 3.51 },
{ date: new Date('2026-08-29T00:00:00Z'), value: 3.49 },
];

function App() {
return (
<LineGraph
style={{ height: 200 }}
Expand All @@ -58,6 +62,8 @@ function App() {
}
```

`react-native-graph` does not fetch data or provide a `usePriceHistory` hook. Create the `GraphPoint[]` from your own API, state, or local data. Each point uses a `Date` for its horizontal position and a `number` for its vertical value; keep the points ordered from oldest to newest. Categorical string values are not supported on the x-axis.

## Configuration

`LineGraph` accepts the following props. It also accepts React Native [`ViewProps`](https://reactnative.dev/docs/view#props), which are forwarded to the root view.
Expand Down