diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f99f867..c0f9a70 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ We want this community to be friendly and respectful to each other. Please follo This project is a monorepo managed using [Bun workspaces](https://bun.sh/docs/install/workspaces). It contains the following packages: -- The library package in the root directory. +- The library package in the `package/` directory. - An example app in the `example/` directory. To get started, install Bun 1.3.1 and the version of [Node.js](https://nodejs.org/) specified in [`.nvmrc`](./.nvmrc). diff --git a/babel.config.js b/babel.config.js index 0c05fd6..ac8b060 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,12 +1 @@ -module.exports = { - overrides: [ - { - exclude: /\/node_modules\//, - presets: ['module:react-native-builder-bob/babel-preset'], - }, - { - include: /\/node_modules\//, - presets: ['module:@react-native/babel-preset'], - }, - ], -}; +module.exports = require('./package/babel.config'); diff --git a/bun.lock b/bun.lock index 2d84c1b..510883a 100644 --- a/bun.lock +++ b/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "react-native-graph", @@ -29,11 +30,6 @@ "turbo": "^2.5.6", "typescript": "^5.9.2", }, - "peerDependencies": { - "react": "*", - "react-native": "*", - "react-native-reanimated": "*", - }, }, "example": { "name": "react-native-graph-example", @@ -50,6 +46,7 @@ "react-dom": "19.2.0", "react-native": "0.83.2", "react-native-gesture-handler": "^2.30.0", + "react-native-graph": "workspace:*", "react-native-haptic-feedback": "^2.3.4", "react-native-pressable-scale": "^2.1.0", "react-native-reanimated": "^4.2.3", @@ -61,6 +58,15 @@ "react-native-monorepo-config": "^0.3.3", }, }, + "package": { + "name": "react-native-graph", + "version": "1.3.0", + "peerDependencies": { + "react": "*", + "react-native": "*", + "react-native-reanimated": "*", + }, + }, }, "packages": { "@ark/schema": ["@ark/schema@0.56.2", "", { "dependencies": { "@ark/util": "0.56.2" } }, "sha512-Qx4D2JFbBWpntiHZaTv7bGG4H/M2rigiknezKg/WVyDSaLdE4YCcWAOoFB7pjjDqHbbV2OqRfntm1nnXvwMexg=="], @@ -1749,6 +1755,8 @@ "react-native-gesture-handler": ["react-native-gesture-handler@2.33.0", "", { "dependencies": { "@egjs/hammerjs": "^2.0.17", "@types/react-test-renderer": "^19.1.0", "hoist-non-react-statics": "^3.3.0", "invariant": "^2.2.4" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-aFMjweXGrsDKwxjAiH7Kl+nc7qAudl0MF6Bqlxf9QQEUNDWBpsQ5WXA7sF6eLFaeRQGEq4ERKr6iuD+GfmunFA=="], + "react-native-graph": ["react-native-graph@workspace:package"], + "react-native-graph-example": ["react-native-graph-example@workspace:example"], "react-native-haptic-feedback": ["react-native-haptic-feedback@2.3.4", "", { "peerDependencies": { "react-native": ">=0.60.0" } }, "sha512-3nHECsi+pL1c2TKNpOD5aPtAfFzrkjpABjioi6OUBb6OVeuUObQlx9idoXSbj1h/L7TCaC13LqKT5ILl0xxHjQ=="], diff --git a/eslint.config.mjs b/eslint.config.mjs index 16b00bb..5b03395 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -24,6 +24,6 @@ export default defineConfig([ }, }, { - ignores: ['node_modules/', 'lib/'], + ignores: ['node_modules/', 'lib/', 'package/lib/'], }, ]); diff --git a/example/babel.config.js b/example/babel.config.js index a2e8f4e..9a7e2cb 100644 --- a/example/babel.config.js +++ b/example/babel.config.js @@ -1,8 +1,8 @@ const path = require('path'); const { getConfig } = require('react-native-builder-bob/babel-config'); -const pkg = require('../package.json'); +const pkg = require('../package/package.json'); -const root = path.resolve(__dirname, '..'); +const root = path.resolve(__dirname, '../package'); module.exports = function (api) { api.cache(true); diff --git a/example/package.json b/example/package.json index 829aab2..0c5a613 100644 --- a/example/package.json +++ b/example/package.json @@ -22,6 +22,7 @@ "react-native-gesture-handler": "^2.30.0", "react-native-haptic-feedback": "^2.3.4", "react-native-pressable-scale": "^2.1.0", + "react-native-graph": "workspace:*", "react-native-reanimated": "^4.2.3", "react-native-web": "~0.21.0", "react-native-worklets": "^0.7.4" diff --git a/example/src/data/GraphData.ts b/example/src/data/GraphData.ts index db97cc0..d63a514 100644 --- a/example/src/data/GraphData.ts +++ b/example/src/data/GraphData.ts @@ -1,4 +1,4 @@ -import type { GraphPoint } from '../../../src/LineGraphProps'; +import type { GraphPoint } from '../../../package/src/LineGraphProps'; import gaussian from 'gaussian'; function weightedRandom(mean: number, variance: number): number { diff --git a/example/src/screens/GraphPage.tsx b/example/src/screens/GraphPage.tsx index 6d8af23..06c6aea 100644 --- a/example/src/screens/GraphPage.tsx +++ b/example/src/screens/GraphPage.tsx @@ -2,7 +2,7 @@ import { useCallback, useMemo, useState } from 'react'; import { View, StyleSheet, Text, Button, ScrollView } from 'react-native'; import { LineGraph } from 'react-native-graph'; // import StaticSafeAreaInsets from 'react-native-static-safe-area-insets' -import type { GraphRange } from '../../../src/LineGraphProps'; +import type { GraphRange } from '../../../package/src/LineGraphProps'; import { SelectionDot } from '../components/CustomSelectionDot'; import { Toggle } from '../components/Toggle'; import { diff --git a/package.json b/package.json index 3911789..dfa326f 100644 --- a/package.json +++ b/package.json @@ -1,80 +1,22 @@ { - "name": "react-native-graph", + "name": "react-native-graph-workspace", "version": "1.3.0", - "description": "📈 Beautiful, high-performance Graphs and Charts for React Native", - "main": "./lib/module/index.js", - "types": "./lib/typescript/src/index.d.ts", - "exports": { - ".": { - "source": "./src/index.ts", - "types": "./lib/typescript/src/index.d.ts", - "default": "./lib/module/index.js" - }, - "./package.json": "./package.json" - }, - "files": [ - "src", - "lib", - "android", - "ios", - "cpp", - "*.podspec", - "react-native.config.js", - "!ios/build", - "!android/build", - "!android/gradle", - "!android/gradlew", - "!android/gradlew.bat", - "!android/local.properties", - "!**/__tests__", - "!**/__fixtures__", - "!**/__mocks__", - "!**/.*" + "private": true, + "packageManager": "bun@1.3.1", + "workspaces": [ + "package", + "example" ], "scripts": { + "graph": "bun --cwd package", "example": "bun --cwd example", - "clean": "del-cli lib", - "prepare": "bob build", + "clean": "bun graph clean", + "prepare": "bun graph prepare", "typecheck": "tsc", - "release": "release-it --only-version", - "test": "jest", + "release": "bun graph release", + "test": "bun graph test", "lint": "eslint \"**/*.{js,ts,tsx}\"" }, - "keywords": [ - "react-native", - "ios", - "android", - "react", - "svg", - "chart", - "charts", - "library", - "performance", - "react-native", - "crypto", - "graph", - "animation", - "graphs", - "stock", - "beautiful", - "wallet", - "animated", - "skia", - "linegraph" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/margelo/react-native-graph.git" - }, - "author": "Marc Rousavy (https://github.com/mrousavy)", - "license": "MIT", - "bugs": { - "url": "https://github.com/margelo/react-native-graph/issues" - }, - "homepage": "https://github.com/margelo/react-native-graph#readme", - "publishConfig": { - "registry": "https://registry.npmjs.org/" - }, "devDependencies": { "@eslint/compat": "^1.3.2", "@eslint/eslintrc": "^3.3.1", @@ -101,74 +43,11 @@ "turbo": "^2.5.6", "typescript": "^5.9.2" }, - "peerDependencies": { - "react": "*", - "react-native": "*", - "react-native-reanimated": "*" - }, - "workspaces": [ - "example" - ], - "packageManager": "bun@1.3.1", - "react-native-builder-bob": { - "source": "src", - "output": "lib", - "targets": [ - [ - "module", - { - "esm": true - } - ], - [ - "typescript", - { - "project": "tsconfig.build.json" - } - ] - ] - }, - "release-it": { - "git": { - "commitMessage": "chore: release ${version}", - "tagName": "v${version}" - }, - "npm": { - "publish": true - }, - "github": { - "release": true - }, - "plugins": { - "@release-it/conventional-changelog": { - "preset": { - "name": "angular" - } - } - } - }, - "jest": { - "preset": "react-native", - "modulePathIgnorePatterns": [ - "/example/node_modules", - "/lib/" - ] - }, "prettier": { "quoteProps": "consistent", "singleQuote": true, "tabWidth": 2, "trailingComma": "es5", "useTabs": false - }, - "create-react-native-library": { - "type": "library", - "languages": "js", - "tools": [ - "release-it", - "jest", - "eslint" - ], - "version": "0.57.2" } } diff --git a/package/LICENSE b/package/LICENSE new file mode 100644 index 0000000..09a0039 --- /dev/null +++ b/package/LICENSE @@ -0,0 +1,20 @@ +MIT License + +Copyright (c) 2026 Marc Rousavy +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/package/README.md b/package/README.md new file mode 100644 index 0000000..7bd5791 --- /dev/null +++ b/package/README.md @@ -0,0 +1,280 @@ + + + + + Nitro Modules + + + +
+ +

+ 📈
+ react-native-graph

+ +

+ +Beautiful, high-performance Graphs/Charts for React Native. + +
+ +## About + +**react-native-graph** is a Line Graph implementation based on the high performance 2D graphics rendering engine "Skia". It's used in the [Bamboo app](https://bambooassets.com) to power thousands of token graphs every day. + +- 🏎️ Faster and smoother than react-native-svg graphs +- ⚡️ Native path interpolation in Skia +- 🐎 Up to 120 FPS animations +- 📈 Cubic bezier rendering for smoother edges +- 👍 Smooth pan/scrubbing gesture +- 💰 Made for crypto apps and Wallets +- ❌ Does not block navigation, press or scroll animations + +## Installation + +
+yarn add react-native-reanimated # Reanimated requires react-native-worklets
+yarn add react-native-gesture-handler
+yarn add @shopify/react-native-skia
+yarn add react-native-graph
+
+ +## Usage + +```tsx +import { LineGraph, type GraphPoint } from 'react-native-graph'; + +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 ( + + ); +} +``` + +`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. + +| Prop | Type | Default | Availability | Description | +| ------------------------- | ------------------------------------------ | -------------------------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `animated` | `boolean` | `false` | Always | Uses the animated renderer when `true` and the lightweight static renderer when `false`. | +| `points` | `GraphPoint[]` | None. Required. | Always | The points to draw. Each point contains a numeric `value` and a `Date`. The graph scales to fit them unless `range` overrides an axis. | +| `color` | `string` | None. Required. | Always | The graph line color. | +| `range` | `GraphRange` | `undefined`. Both axes are inferred from `points`. | Always | Overrides all or part of the visible x-axis and y-axis ranges. | +| `gradientFillColors` | `Color[]` | `undefined`. No area fill is drawn. | `animated={true}` | Colors for the vertical gradient below the graph line. | +| `lineThickness` | `number` | `3` | Always | The graph line width in points. | +| `enableFadeInMask` | `boolean` | `false` | Always | Fades in the start of the graph line. | +| `enablePanGesture` | `boolean` | `false` | `animated={true}` | Lets the user press and scrub through graph points. | +| `panGestureDelay` | `number` | `300` | `animated={true}` | Time in milliseconds that a press must be held before scrubbing starts. Set it to `0` to start immediately. | +| `onGestureStart` | `() => void` | `undefined`. No callback runs. | `animated={true}` | Called when scrubbing starts. | +| `onPointSelected` | `(point: GraphPoint) => void` | `undefined`. No callback runs. | `animated={true}` | Called when scrubbing reaches a different point. | +| `onGestureEnd` | `() => void` | `undefined`. No callback runs. | `animated={true}` | Called when scrubbing ends. | +| `SelectionDot` | `ComponentType \| null` | Built-in `SelectionDot` | `animated={true}` | Renders the current scrub position. Pass `null` to hide it. | +| `selectionDotShadowColor` | `string` | `undefined` | `animated={true}` | Currently unused. This prop has no visual effect. | +| `horizontalPadding` | `number` | `10` when the indicator is enabled, otherwise `0` | `animated={true}` | Adds space to both horizontal edges of the drawing area. | +| `verticalPadding` | `number` | The value of `lineThickness` | `animated={true}` | Adds space to both vertical edges of the drawing area. | +| `enableIndicator` | `boolean` | `false` | `animated={true}` | Shows an indicator at the last graph point. | +| `indicatorPulsating` | `boolean` | `false` | `animated={true}` | Pulses the indicator while the graph is idle. Requires `enableIndicator`. | +| `TopAxisLabel` | `() => ReactElement \| null` | `undefined`. Nothing is rendered. | `animated={true}` | Renders a label above the graph. | +| `BottomAxisLabel` | `() => ReactElement \| null` | `undefined`. Nothing is rendered. | `animated={true}` | Renders a label below the graph. | + +### Data types + +```ts +interface GraphPoint { + value: number; + date: Date; +} + +interface GraphRange { + x?: { min: Date; max: Date }; + y?: { min: number; max: number }; +} +``` + +You can provide either axis in `range` and let the graph infer the other one from `points`. + +## Prop examples + +### `animated` + + + +Whether to animate between data changes. Defaults to `false` when omitted. + +Animations run using the [Skia animation system](https://shopify.github.io/react-native-skia/docs/animations/animations), with path interpolation handled on the UI thread. + +If `animated` is `false`, the graph uses a lightweight static renderer. This is useful when displaying many graphs in a list. + +Example: + +```jsx + +``` + +--- + +### `enablePanGesture` + + + +Whether to enable the pan gesture. Defaults to `false`. + +> Requires `animated` to be `true`. + +There are three events fired when the user interacts with the graph: + +1. `onGestureStart`: Fires once the user presses and holds the graph. The pan gesture activates. +2. `onPointSelected`: Fires for each point the user pans through. Use it to update a label or highlight the selected value. +3. `onGestureEnd`: Fires once the user releases the graph. The pan gesture deactivates. + +The pan gesture can be configured using these props: + +- `panGestureDelay` controls how long the user must hold before the gesture activates. It defaults to `300` milliseconds. Set it to `0` to start immediately. + +Example: + +```jsx + hapticFeedback('impactLight')} + onPointSelected={(p) => updatePriceTitle(p)} + onGestureEnd={() => resetPriceTitle()} +/> +``` + +--- + +### `TopAxisLabel` / `BottomAxisLabel` + + + +Renders labels above or below the graph. Both props default to `undefined`, so no labels are rendered. + +> Requires `animated` to be `true`. + +These labels usually show the maximum and minimum values. `AxisLabel` is not a component exported by this package: both props are callbacks that receive no arguments and render any React Native element you provide. The graph reserves a row above or below the canvas; positioning and styling inside that row belong to your label component. + +Example: + +```tsx +import { Text } from 'react-native'; + +function PriceGraph() { + const values = priceHistory.map((point) => point.value); + const maxValue = Math.max(...values); + const minValue = Math.min(...values); + + return ( + {`Max: ${maxValue.toFixed(2)}`}} + BottomAxisLabel={() => {`Min: ${minValue.toFixed(2)}`}} + /> + ); +} +``` + +### `range` + + + +Defines the visible range of the graph canvas. It defaults to `undefined`, which infers both axes from `points`. + +Use a custom range to show a fixed time frame or value scale, even when the data does not cover the whole range. Points outside the x-axis range are not drawn. + +
+
+ +This example shows January 2000 and sets the y-axis range to 0 through 200: + +```jsx + +``` + +--- + +### `SelectionDot` + + + +Renders the selection dot. It defaults to the built-in `SelectionDot`. Pass `null` to hide it. + +> Requires `animated` and `enablePanGesture` to be `true`. + +A custom selection-dot component receives these props from `LineGraph`. They are all required and have no defaults when you render `SelectionDot` directly. + +| Prop | Type | Default | Description | +| --------------- | ---------------------- | --------------- | ----------------------------------------------------------- | +| `isActive` | `SharedValue` | None. Required. | Whether the pan gesture is active. | +| `color` | `string` | None. Required. | The graph line color. | +| `lineThickness` | `number \| undefined` | None. Required. | The resolved graph line width when supplied by `LineGraph`. | +| `circleX` | `SharedValue` | None. Required. | The selected point's x-coordinate. | +| `circleY` | `SharedValue` | None. Required. | The selected point's y-coordinate. | + +Example: + +```jsx + +``` + +See this [example `` component](https://github.com/margelo/react-native-graph/blob/main/example/src/components/CustomSelectionDot.tsx). + +## Sponsor + + + +**react-native-graph** is sponsored by [Pink Panda](https://pinkpanda.io). + +Download the Pink Panda mobile app to see react-native-graph in action! + +## Community Discord + +[Join the Margelo Community Discord](https://discord.gg/6CSHz2qAvA) to chat about react-native-graph or other Margelo libraries. + +## Adopting at scale + +react-native-graph was built at Margelo, an elite app development agency. For enterprise support or other business inquiries, contact us at hello@margelo.com! + +## Thanks + +Special thanks to [William Candillon](https://github.com/wcandillon) and [Christian Falch](https://github.com/chrfalch) for their amazing help and support for React Native Skia ❤️ diff --git a/package/babel.config.js b/package/babel.config.js new file mode 100644 index 0000000..0c05fd6 --- /dev/null +++ b/package/babel.config.js @@ -0,0 +1,12 @@ +module.exports = { + overrides: [ + { + exclude: /\/node_modules\//, + presets: ['module:react-native-builder-bob/babel-preset'], + }, + { + include: /\/node_modules\//, + presets: ['module:@react-native/babel-preset'], + }, + ], +}; diff --git a/package/package.json b/package/package.json new file mode 100644 index 0000000..6fae3ec --- /dev/null +++ b/package/package.json @@ -0,0 +1,124 @@ +{ + "name": "react-native-graph", + "version": "1.3.0", + "description": "📈 Beautiful, high-performance Graphs and Charts for React Native", + "main": "./lib/module/index.js", + "types": "./lib/typescript/src/index.d.ts", + "exports": { + ".": { + "source": "./src/index.ts", + "types": "./lib/typescript/src/index.d.ts", + "default": "./lib/module/index.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "src", + "lib", + "!**/__tests__", + "!**/__fixtures__", + "!**/__mocks__", + "!**/.*" + ], + "scripts": { + "clean": "del-cli lib", + "prepare": "../node_modules/.bin/bob build", + "release": "release-it --only-version", + "test": "jest", + "lint": "eslint \"**/*.{js,ts,tsx}\"" + }, + "keywords": [ + "react-native", + "ios", + "android", + "react", + "svg", + "chart", + "charts", + "library", + "performance", + "react-native", + "crypto", + "graph", + "animation", + "graphs", + "stock", + "beautiful", + "wallet", + "animated", + "skia", + "linegraph" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/margelo/react-native-graph.git" + }, + "author": "Marc Rousavy (https://github.com/mrousavy)", + "license": "MIT", + "bugs": { + "url": "https://github.com/margelo/react-native-graph/issues" + }, + "homepage": "https://github.com/margelo/react-native-graph#readme", + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "peerDependencies": { + "react": "*", + "react-native": "*", + "react-native-reanimated": "*" + }, + "react-native-builder-bob": { + "source": "src", + "output": "lib", + "targets": [ + [ + "module", + { + "esm": true + } + ], + [ + "typescript", + { + "tsc": "../node_modules/.bin/tsc", + "project": "tsconfig.build.json" + } + ] + ] + }, + "release-it": { + "git": { + "commitMessage": "chore: release ${version}", + "tagName": "v${version}" + }, + "npm": { + "publish": true + }, + "github": { + "release": true + }, + "plugins": { + "@release-it/conventional-changelog": { + "preset": { + "name": "angular" + } + } + } + }, + "jest": { + "preset": "react-native", + "modulePathIgnorePatterns": [ + "/lib/" + ] + }, + "create-react-native-library": { + "type": "library", + "languages": "js", + "tools": [ + "release-it", + "jest", + "eslint" + ], + "version": "0.57.2" + } +} diff --git a/src/AnimatedLineGraph.tsx b/package/src/AnimatedLineGraph.tsx similarity index 100% rename from src/AnimatedLineGraph.tsx rename to package/src/AnimatedLineGraph.tsx diff --git a/src/CreateGraphPath.ts b/package/src/CreateGraphPath.ts similarity index 100% rename from src/CreateGraphPath.ts rename to package/src/CreateGraphPath.ts diff --git a/src/GetYForX.ts b/package/src/GetYForX.ts similarity index 100% rename from src/GetYForX.ts rename to package/src/GetYForX.ts diff --git a/src/LineGraph.tsx b/package/src/LineGraph.tsx similarity index 100% rename from src/LineGraph.tsx rename to package/src/LineGraph.tsx diff --git a/src/LineGraphProps.ts b/package/src/LineGraphProps.ts similarity index 100% rename from src/LineGraphProps.ts rename to package/src/LineGraphProps.ts diff --git a/src/SelectionDot.tsx b/package/src/SelectionDot.tsx similarity index 100% rename from src/SelectionDot.tsx rename to package/src/SelectionDot.tsx diff --git a/src/StaticLineGraph.tsx b/package/src/StaticLineGraph.tsx similarity index 100% rename from src/StaticLineGraph.tsx rename to package/src/StaticLineGraph.tsx diff --git a/src/__tests__/CreateGraphPath.test.ts b/package/src/__tests__/CreateGraphPath.test.ts similarity index 100% rename from src/__tests__/CreateGraphPath.test.ts rename to package/src/__tests__/CreateGraphPath.test.ts diff --git a/src/__tests__/LineGraphProps.test.ts b/package/src/__tests__/LineGraphProps.test.ts similarity index 100% rename from src/__tests__/LineGraphProps.test.ts rename to package/src/__tests__/LineGraphProps.test.ts diff --git a/src/hooks/usePanGesture.ts b/package/src/hooks/usePanGesture.ts similarity index 100% rename from src/hooks/usePanGesture.ts rename to package/src/hooks/usePanGesture.ts diff --git a/src/index.ts b/package/src/index.ts similarity index 100% rename from src/index.ts rename to package/src/index.ts diff --git a/src/utils/getSixDigitHex.ts b/package/src/utils/getSixDigitHex.ts similarity index 100% rename from src/utils/getSixDigitHex.ts rename to package/src/utils/getSixDigitHex.ts diff --git a/src/utils/hexToRgba.ts b/package/src/utils/hexToRgba.ts similarity index 100% rename from src/utils/hexToRgba.ts rename to package/src/utils/hexToRgba.ts diff --git a/package/tsconfig.build.json b/package/tsconfig.build.json new file mode 100644 index 0000000..2bf27a1 --- /dev/null +++ b/package/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig", + "include": ["src"], + "compilerOptions": { + "rootDir": "." + } +} diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 3c0636a..0000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig", - "exclude": ["example", "lib"] -} diff --git a/tsconfig.json b/tsconfig.json index 0a160ea..4589338 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "rootDir": ".", "paths": { - "react-native-graph": ["./src/index"] + "react-native-graph": ["./package/src/index"] }, "allowUnreachableCode": false, "allowUnusedLabels": false, diff --git a/turbo.json b/turbo.json index 1c23ae3..ba6d29a 100644 --- a/turbo.json +++ b/turbo.json @@ -6,11 +6,9 @@ "build:android": { "env": ["ANDROID_HOME", "ORG_GRADLE_PROJECT_newArchEnabled"], "inputs": [ - "package.json", - "android", - "!android/build", - "src/*.ts", - "src/*.tsx", + "package/package.json", + "package/src/**/*.ts", + "package/src/**/*.tsx", "example/package.json", "example/android", "!example/android/.gradle", @@ -27,11 +25,9 @@ "RCT_USE_PREBUILT_RNCORE" ], "inputs": [ - "package.json", - "*.podspec", - "ios", - "src/*.ts", - "src/*.tsx", + "package/package.json", + "package/src/**/*.ts", + "package/src/**/*.tsx", "example/package.json", "example/ios", "!example/ios/build",