tradingview / charting-library-examples

Examples of Charting Library integrations with other libraries, frameworks and data transports
MIT License
1.33k stars 744 forks source link

unable to find index.html used in webView example react native #231

Open muhammadashfaq opened 3 years ago

muhammadashfaq commented 3 years ago

Checklist

Screenshot 2021-06-05 at 12 42 40 AM

`import React, {Component} from 'react'; import {SafeAreaView, Alert} from 'react-native'; import {WebView} from 'react-native-webview';

let html = `

Debug page

`;

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 ?

timocov commented 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.

soia commented 2 years ago

Hello muhammadashfaq

Were you able to run? I have the same problem