On Android and iOS, imperative chart commands use codegenNativeCommands with the
current native host ref. Keep this path ref-based: converting the ref with
findNodeHandle and calling UIManager.dispatchViewManagerCommand sends Fabric
through findShadowNodeByTag_DEPRECATED. That lookup walks the whole shadow tree
on the JS thread and can race concurrent commits and native tree teardown
(PRO-4970); React Native only fixes it behind the
fixFindShadowNodeByTagRaceCondition flag, which is off by default. Ref-based
dispatch avoids the lookup for chart commands without changing global React
Native feature flags.
On iOS the view is a legacy view manager running through Fabric's interop layer,
which resolves a command by its method name and prepends the view tag itself, so
the native RCT_EXTERN_METHOD signatures are unchanged. Both platforms check the
current ref at call time and ignore commands after detachment. The native command
names, argument order and payloads are unchanged.
Run yarn test (Node 22+) for command routing, payload, detachment and independent
chart checks. These tests mock the native bridge; they do not prove the
intermittent Android or iOS SIGSEGV is resolved. Validate a mobile build containing this
package with repeated interval changes (including 3D β weekly), market and engine
switches, reconnects, background/foreground and idle runs, collecting native logs.
To start the project for:
-
Android:
- in
exampledir yarn install --forceyarn android- to see logs:
adb logcat, needs grep as this prints everything
- in
-
ios:
- in
exampledir:yarn install --force - in
example/iosdir:pod install - in
exampledir:yarn ios(or start from xcode) - sometimes it throws code developer signature. if it shows the application started successfully means the simulator works fine
- to see logs start in xcode
- in
Professional K-Line (Candlestick) Chart Library for React Native
Ultra-smooth rendering β’ Interactive drawing tools β’ Multiple technical indicators β’ Dark/Light themes
English
React Native KLine View is a high-performance, feature-rich candlestick chart component designed for professional trading applications. Built with native optimization for both iOS and Android, it delivers smooth 60fps scrolling, zooming, and real-time data updates.
Perfect for cryptocurrency exchanges, stock trading apps, financial dashboards, and any application requiring professional-grade market data visualization.
- β Ultra-smooth scrolling with native performance optimization
- β Pinch-to-zoom with fluid gesture recognition
- β Long-press details with animated info panels
- β Real-time updates with efficient data management
- β Multiple timeframes (1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w)
- β Main Chart Indicators: MA (Moving Average), BOLL (Bollinger Bands)
- β Sub Chart Indicators: MACD, KDJ, RSI, WR
- β Customizable parameters for all indicators
- β Multi-color indicator lines with smooth animations
- β Volume analysis with dedicated volume chart
- β Trend Lines - Diagonal support/resistance analysis
- β Horizontal Lines - Price level marking
- β Vertical Lines - Time-based event marking
- β Rectangles - Range highlighting
- β Text Annotations - Custom labels and notes
- β Drawing persistence with touch-to-edit functionality
- β Dark/Light themes with instant switching
- β Gradient backgrounds for enhanced visual appeal
- β Customizable colors for all chart elements
- β Responsive design supporting both portrait and landscape
- β High-DPI support for crisp rendering on all devices
- β iOS & Android with platform-specific optimizations
- β React Native New Architecture compatible
- β Fabric renderer support for enhanced performance
- β TypeScript definitions included
# For development version
yarn add react-native-kline-view@https://github.com/hellohublot/react-native-kline-view.gitcd ios && pod installNo additional setup required for Android.
For a comprehensive implementation with all features, please check example/App.js
The example app demonstrates:
- ποΈ Complete UI Controls - Time period selector, indicator switcher, drawing tools
- π¨ Theme Management - Dark/Light mode with smooth transitions
- π Indicator Management - Dynamic indicator switching and configuration
- βοΈ Drawing Tools - Full-featured drawing interface with tool selection
- π± Responsive Design - Adapts to different screen sizes and orientations
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
optionList |
string | β | - | JSON string containing all chart configuration and data |
onDrawItemDidTouch |
function | β | - | Callback when a drawing item is touched |
onDrawItemComplete |
function | β | - | Callback when a drawing item is completed |
onDrawPointComplete |
function | β | - | Callback when drawing point is completed |
| Callback | Parameters | Description |
|---|---|---|
onDrawItemDidTouch |
{ shouldReloadDrawItemIndex, drawColor, drawLineHeight, drawDashWidth, drawDashSpace, drawIsLock } |
Triggered when user touches an existing drawing item. Returns drawing properties for editing |
onDrawItemComplete |
{} |
Triggered when user completes creating a new drawing item |
onDrawPointComplete |
{ pointCount } |
Triggered when user completes adding points to a drawing (useful for multi-point drawings) |
The optionList is a JSON string containing all chart configuration. Here's the complete structure:
| Property | Type | Default | Description |
|---|---|---|---|
modelArray |
Array | [] |
K-line data array (see Data Format below) |
shouldScrollToEnd |
Boolean | true |
Whether to scroll to the latest data on load |
targetList |
Object | {} |
Technical indicator parameters |
configList |
Object | {} |
Visual styling configuration |
drawList |
Object | {} |
Drawing tools configuration |
Each data point should contain the following fields:
id: Timestampopen: Opening pricehigh: Highest pricelow: Lowest priceclose: Closing pricevol: VolumedateString: Formatted time stringselectedItemList: Info panel data arraymaList: Moving average data (if enabled)maVolumeList: Volume moving average data- Various technical indicator data (MACD, KDJ, RSI, etc.)
For complete data structure examples, see example/App.js
| Property | Type | Description |
|---|---|---|
colorList |
Object | { increaseColor, decreaseColor } - Bull/bear colors |
targetColorList |
Array | Colors for indicator lines |
backgroundColor |
Color | Chart background color |
textColor |
Color | Global text color |
gridColor |
Color | Grid line color |
candleTextColor |
Color | Candle label text color |
minuteLineColor |
Color | Minute chart line color |
minuteGradientColorList |
Array | Gradient colors for minute chart background |
minuteGradientLocationList |
Array | Gradient stop positions [0, 0.3, 0.6, 1] |
mainFlex |
Number | Main chart height ratio (0.6 - 0.85) |
volumeFlex |
Number | Volume chart height ratio (0.15 - 0.25) |
paddingTop |
Number | Top padding in pixels |
paddingBottom |
Number | Bottom padding in pixels |
paddingRight |
Number | Right padding in pixels |
itemWidth |
Number | Total width per candle (including margins) |
candleWidth |
Number | Actual candle body width |
fontFamily |
String | Font family for all text |
headerTextFontSize |
Number | Header text size |
rightTextFontSize |
Number | Right axis text size |
candleTextFontSize |
Number | Candle value text size |
panelTextFontSize |
Number | Info panel text size |
panelMinWidth |
Number | Minimum info panel width |
| Property | Type | Description |
|---|---|---|
drawType |
Number | Current drawing tool type (0=none, 1=trend, 2=horizontal, etc.) |
shouldReloadDrawItemIndex |
Number | Drawing state management |
drawShouldContinue |
Boolean | Whether to continue drawing after completing one item |
shouldClearDraw |
Boolean | Flag to clear all drawings |
shouldFixDraw |
Boolean | Flag to finalize current drawing |
shotBackgroundColor |
Color | Drawing overlay background color |
Contains parameter settings for various technical indicators:
Moving Average Settings:
maList: MA line configuration arraymaVolumeList: Volume MA configuration
Bollinger Bands Parameters:
bollN: Period (default "20")bollP: Standard deviation multiplier (default "2")
MACD Parameters:
macdS: Fast EMA period (default "12")macdL: Slow EMA period (default "26")macdM: Signal line period (default "9")
KDJ Parameters:
kdjN: Period (default "9")kdjM1: K smoothing (default "3")kdjM2: D smoothing (default "3")
RSI and WR Settings:
rsiList: RSI configuration arraywrList: WR configuration array
For complete configuration examples, see example/App.js
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
This project is a significant evolution and enhancement of the original KChartView by @tifezh. While inspired by the original Android-only library, this React Native implementation has been completely rewritten and includes numerous additional features:
- β Cross-platform support - iOS and Android
- β React Native integration - Native bridge implementation
- β Interactive drawing tools - Complete drawing system with multiple tools
- β Advanced theming - Dark/Light mode with smooth transitions
- β Enhanced performance - Optimized for 60fps scrolling and zooming
- β Modern UI components - Modal selectors and responsive design
- β TypeScript support - Full type definitions
- β Multiple timeframes - Comprehensive time period support
- β Gesture enhancements - Advanced touch handling and drawing interactions
- β Real-time updates - Efficient data streaming and updates
- β Professional indicators - Extended technical analysis capabilities
The codebase has been entirely rewritten to:
- Adapt to React Native's architecture and bridge system
- Implement iOS support using Swift and Objective-C
- Add comprehensive drawing functionality not present in the original
- Provide a modern, professional trading interface
- Optimize performance for mobile devices
- Support both React Native's old and new architectures
While we honor the inspiration from the original project, this implementation represents a complete reimagining optimized for modern React Native applications and professional trading interfaces.
- π§ Email: hellohublot@gmail.com
- π¬ Issues: GitHub Issues
- π― Examples: Check out example/App.js for comprehensive usage
Built with β€οΈ for the React Native community
Features β’ Installation β’ Quick Start β’ API β’ License




