From 73785a0c355e91c613a6ee730f78c8b0e8be55ea Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Wed, 9 Jun 2021 13:20:40 +0200 Subject: [PATCH] Forward ref to WebView --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index a08123b..a50276f 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ import { View } from 'react-native'; import styles from './styles'; import { getInit, getEnd, flattenObject } from './helpers'; -function Chart(props) { +const Chart = React.forwardRef((props, ref) => { let config = JSON.stringify(props.config, (_, value) => { //create string of json but if it detects function it uses toString() return typeof value === 'function' ? value.toString() : value; @@ -24,10 +24,11 @@ function Chart(props) { scalesPageToFit={true} scrollEnabled={false} automaticallyAdjustContentInsets={true} + ref={ref} {...props} /> ); -} +}); export default Chart;