From c33d023f6451ddc4624298a140756f88fbd94f62 Mon Sep 17 00:00:00 2001 From: felipe-lighter Date: Wed, 11 Feb 2026 17:04:02 +0500 Subject: [PATCH] Export types as proper module and point package types --- index.d.ts | 100 +++++++++++++++++++++++++-------------------------- package.json | 1 + 2 files changed, 50 insertions(+), 51 deletions(-) diff --git a/index.d.ts b/index.d.ts index 8d56e4b..3e8e2c4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,56 +1,54 @@ -declare module 'react-native-kline-view' { - import { Component } from 'react'; - import { ViewProps, ViewStyle } from 'react-native'; +import { Component } from 'react'; +import { ViewProps, ViewStyle } from 'react-native'; - export interface OrderLine { - id: string; - type: string; // 'limit' | 'liquidation' | 'stop_loss' | 'take_profit' | etc. - price: number; - amount: number; - color: string; // Hex color string with optional transparency (e.g., '#FF0000' or '#FF000080' for 50% transparent red) - label?: string; // Optional label text to display on the line - labelFontSize?: number; // Optional font size for the label (default: 12) - labelBackgroundColor?: string; // Optional background color for the label pill with optional transparency (e.g., '#FF0000' or '#00000080' for 50% transparent black) - labelColor?: string; // Optional color for the label text (defaults to line color if not specified) - labelDescription?: string; // Optional description text displayed next to the label - labelDescriptionColor?: string; // Optional color for the description text (defaults to labelColor if not specified) - } +export interface OrderLine { + id: string; + type: string; // 'limit' | 'liquidation' | 'stop_loss' | 'take_profit' | etc. + price: number; + amount: number; + color: string; // Hex color string with optional transparency (e.g., '#FF0000' or '#FF000080' for 50% transparent red) + label?: string; // Optional label text to display on the line + labelFontSize?: number; // Optional font size for the label (default: 12) + labelBackgroundColor?: string; // Optional background color for the label pill with optional transparency (e.g., '#FF0000' or '#00000080' for 50% transparent black) + labelColor?: string; // Optional color for the label text (defaults to line color if not specified) + labelDescription?: string; // Optional description text displayed next to the label + labelDescriptionColor?: string; // Optional color for the description text (defaults to labelColor if not specified) +} - export interface BuySellMark { - id: string; - time: number; - type: 'buy' | 'sell'; - amount: string; - price: string; - orderCount?: number; - tooltipText?: string; - } +export interface BuySellMark { + id: string; + time: number; + type: 'buy' | 'sell'; + amount: string; + price: string; + orderCount?: number; + tooltipText?: string; +} - export interface RNKLineViewRef { - updateLastCandlestick: (candlestick: any) => void; - addCandlesticksAtTheEnd: (candlesticks: any[]) => void; - addCandlesticksAtTheStart: (candlesticks: any[]) => void; - addOrderLine: (orderLine: OrderLine) => void; - removeOrderLine: (orderLineId: string) => void; - updateOrderLine: (orderLine: OrderLine) => void; - getOrderLines: () => OrderLine[]; - addBuySellMark: (buySellMark: BuySellMark) => void; - removeBuySellMark: (buySellMarkId: string) => void; - updateBuySellMark: (buySellMark: BuySellMark) => void; - getBuySellMarks: () => BuySellMark[]; - } +export interface RNKLineViewRef { + updateLastCandlestick: (candlestick: any) => void; + addCandlesticksAtTheEnd: (candlesticks: any[]) => void; + addCandlesticksAtTheStart: (candlesticks: any[]) => void; + addOrderLine: (orderLine: OrderLine) => void; + removeOrderLine: (orderLineId: string) => void; + updateOrderLine: (orderLine: OrderLine) => void; + getOrderLines: () => OrderLine[]; + addBuySellMark: (buySellMark: BuySellMark) => void; + removeBuySellMark: (buySellMarkId: string) => void; + updateBuySellMark: (buySellMark: BuySellMark) => void; + getBuySellMarks: () => BuySellMark[]; +} - export interface RNKLineViewProps extends ViewProps { - style?: ViewStyle; - optionList?: string; - onDrawItemDidTouch?: (event: any) => void; - onScrollLeft?: (event: any) => void; - onChartTouch?: (event: any) => void; - onDrawItemComplete?: (event: any) => void; - onDrawPointComplete?: (event: any) => void; - } +export interface RNKLineViewProps extends ViewProps { + style?: ViewStyle; + optionList?: string; + onDrawItemDidTouch?: (event: any) => void; + onScrollLeft?: (event: any) => void; + onChartTouch?: (event: any) => void; + onDrawItemComplete?: (event: any) => void; + onDrawPointComplete?: (event: any) => void; +} - export default class RNKLineView extends Component { - // Component ref methods will be available through imperative handle - } -} \ No newline at end of file +export default class RNKLineView extends Component { + // Component ref methods will be available through imperative handle +} diff --git a/package.json b/package.json index 9a6d674..1ce0752 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.1", "description": "React Native Kline chart component with native Android and iOS implementations", "main": "index.js", + "types": "index.d.ts", "repository": "git@github.com:elliottech/react-native-kline-view.git", "author": "elliottech", "publishConfig": {