Open muhammadashfaq opened 3 years ago
Did you do 4th step from https://github.com/tradingview/charting-library-examples/tree/master/react-native#how-to-start---android ?
Copy all files from tradingview/charting_library. The earliest supported version of the Charting Library is 17. If you get 404 then you need to request an access to this repository.
Hello muhammadashfaq
Were you able to run? I have the same problem
Checklist
`import React, {Component} from 'react'; import {SafeAreaView, Alert} from 'react-native'; import {WebView} from 'react-native-webview';
let html = `
`;
class IOsChart extends Component { jsToInject =
tvWidget.onChartReady(function() { tvWidget.chart().onIntervalChanged().subscribe( null, function(interval) { const response = { type: "onIntervalChanged", interval: interval } //window.ReactNativeWebView.postMessage accepts one argument, data, //which will be available on the event object, event.nativeEvent.data. data must be a string. window.ReactNativeWebView.postMessage(JSON.stringify(response)); } ); }); true; // note: this is required, or you'll sometimes get silent failures // (https://github.com/react-native-webview/react-native-webview/blob/master/docs/Guide.md)
;render() { return ( <SafeAreaView style={{flex: 1}}> <WebView style={{flex: 1}} source={{uri: html}} allowFileAccessFromFileURLs={true} originWhitelist={['*']} injectedJavaScript={this.jsToInject} onMessage={(event) => { const data = JSON.parse(event.nativeEvent.data); if (data.type == 'onIntervalChanged') { Alert.alert( 'onIntervalChanged', 'Interval = ' + data.interval, [{text: 'OK', onPress: () => console.log('OK Pressed')}], {cancelable: true}, ); } }} /> ); } }
const IOsApp = () => { return ;
};
module.exports = IOsApp;
`
Example is not working ? How to run it ?