Skip to content

Commit c33d023

Browse files
Export types as proper module and point package types
1 parent fcc1413 commit c33d023

2 files changed

Lines changed: 50 additions & 51 deletions

File tree

index.d.ts

Lines changed: 49 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,54 @@
1-
declare module 'react-native-kline-view' {
2-
import { Component } from 'react';
3-
import { ViewProps, ViewStyle } from 'react-native';
1+
import { Component } from 'react';
2+
import { ViewProps, ViewStyle } from 'react-native';
43

5-
export interface OrderLine {
6-
id: string;
7-
type: string; // 'limit' | 'liquidation' | 'stop_loss' | 'take_profit' | etc.
8-
price: number;
9-
amount: number;
10-
color: string; // Hex color string with optional transparency (e.g., '#FF0000' or '#FF000080' for 50% transparent red)
11-
label?: string; // Optional label text to display on the line
12-
labelFontSize?: number; // Optional font size for the label (default: 12)
13-
labelBackgroundColor?: string; // Optional background color for the label pill with optional transparency (e.g., '#FF0000' or '#00000080' for 50% transparent black)
14-
labelColor?: string; // Optional color for the label text (defaults to line color if not specified)
15-
labelDescription?: string; // Optional description text displayed next to the label
16-
labelDescriptionColor?: string; // Optional color for the description text (defaults to labelColor if not specified)
17-
}
4+
export interface OrderLine {
5+
id: string;
6+
type: string; // 'limit' | 'liquidation' | 'stop_loss' | 'take_profit' | etc.
7+
price: number;
8+
amount: number;
9+
color: string; // Hex color string with optional transparency (e.g., '#FF0000' or '#FF000080' for 50% transparent red)
10+
label?: string; // Optional label text to display on the line
11+
labelFontSize?: number; // Optional font size for the label (default: 12)
12+
labelBackgroundColor?: string; // Optional background color for the label pill with optional transparency (e.g., '#FF0000' or '#00000080' for 50% transparent black)
13+
labelColor?: string; // Optional color for the label text (defaults to line color if not specified)
14+
labelDescription?: string; // Optional description text displayed next to the label
15+
labelDescriptionColor?: string; // Optional color for the description text (defaults to labelColor if not specified)
16+
}
1817

19-
export interface BuySellMark {
20-
id: string;
21-
time: number;
22-
type: 'buy' | 'sell';
23-
amount: string;
24-
price: string;
25-
orderCount?: number;
26-
tooltipText?: string;
27-
}
18+
export interface BuySellMark {
19+
id: string;
20+
time: number;
21+
type: 'buy' | 'sell';
22+
amount: string;
23+
price: string;
24+
orderCount?: number;
25+
tooltipText?: string;
26+
}
2827

29-
export interface RNKLineViewRef {
30-
updateLastCandlestick: (candlestick: any) => void;
31-
addCandlesticksAtTheEnd: (candlesticks: any[]) => void;
32-
addCandlesticksAtTheStart: (candlesticks: any[]) => void;
33-
addOrderLine: (orderLine: OrderLine) => void;
34-
removeOrderLine: (orderLineId: string) => void;
35-
updateOrderLine: (orderLine: OrderLine) => void;
36-
getOrderLines: () => OrderLine[];
37-
addBuySellMark: (buySellMark: BuySellMark) => void;
38-
removeBuySellMark: (buySellMarkId: string) => void;
39-
updateBuySellMark: (buySellMark: BuySellMark) => void;
40-
getBuySellMarks: () => BuySellMark[];
41-
}
28+
export interface RNKLineViewRef {
29+
updateLastCandlestick: (candlestick: any) => void;
30+
addCandlesticksAtTheEnd: (candlesticks: any[]) => void;
31+
addCandlesticksAtTheStart: (candlesticks: any[]) => void;
32+
addOrderLine: (orderLine: OrderLine) => void;
33+
removeOrderLine: (orderLineId: string) => void;
34+
updateOrderLine: (orderLine: OrderLine) => void;
35+
getOrderLines: () => OrderLine[];
36+
addBuySellMark: (buySellMark: BuySellMark) => void;
37+
removeBuySellMark: (buySellMarkId: string) => void;
38+
updateBuySellMark: (buySellMark: BuySellMark) => void;
39+
getBuySellMarks: () => BuySellMark[];
40+
}
4241

43-
export interface RNKLineViewProps extends ViewProps {
44-
style?: ViewStyle;
45-
optionList?: string;
46-
onDrawItemDidTouch?: (event: any) => void;
47-
onScrollLeft?: (event: any) => void;
48-
onChartTouch?: (event: any) => void;
49-
onDrawItemComplete?: (event: any) => void;
50-
onDrawPointComplete?: (event: any) => void;
51-
}
42+
export interface RNKLineViewProps extends ViewProps {
43+
style?: ViewStyle;
44+
optionList?: string;
45+
onDrawItemDidTouch?: (event: any) => void;
46+
onScrollLeft?: (event: any) => void;
47+
onChartTouch?: (event: any) => void;
48+
onDrawItemComplete?: (event: any) => void;
49+
onDrawPointComplete?: (event: any) => void;
50+
}
5251

53-
export default class RNKLineView extends Component<RNKLineViewProps> {
54-
// Component ref methods will be available through imperative handle
55-
}
56-
}
52+
export default class RNKLineView extends Component<RNKLineViewProps> {
53+
// Component ref methods will be available through imperative handle
54+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.1",
44
"description": "React Native Kline chart component with native Android and iOS implementations",
55
"main": "index.js",
6+
"types": "index.d.ts",
67
"repository": "git@github.com:elliottech/react-native-kline-view.git",
78
"author": "elliottech",
89
"publishConfig": {

0 commit comments

Comments
 (0)