[RN]trading-view example 적용

Jang Seok Woo·2022년 11월 16일
1

실무

목록 보기
131/136

트레이딩뷰(Trading View) 라이브러리 사용 이슈

사용하는 트레이딩 뷰라이브러리 공식 웹사이트 :

우리가 사용할 플랜 : Premium

  1. 위 웹사이트에서 결제 후 트레이딩뷰의 Repository(https://github.com/tradingview/charting_library/)의 Access 권한을 얻는다

  2. TradingView의 Chart를 띄우는 예시 Repositroy :
    https://github.com/tradingview/charting-library-examples/tree/master/react-native

Repository -> /react-native/app/ios.app.js or android.app.js
내부 코드를 보면 WebView 컴포넌트를 이용하여 style, source.. 등 props를 전달하여 차트를 띄우는 방식으로 구현되어있다.

  1. /react-native/README.md 에 나와있는대로
    android/app/src/main/assets에 Repository(https://github.com/tradingview/charting_library/)의 모든 파일들을 추가한다.

  2. npx react-native run-android

트러블 슈팅

Task :react-native-webview:generateDebugRFile FAILED
react-native/android/build.gradle에

하단의 allprojects 위에 def REACT_NATIVE_VERSION… 추가

하단의 allprojects에 configurations.all { … resolutionStrategy { force “com.facebook.react:react-native:” + REACT_NATIVE_VERSION 추가

예시코드)

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.66, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}

Task :app:installDebug FAILED

  • What went wrong:
    Execution failed for task ':app:installDebug'.

발생시 node 버전을 16.13.0으로 낮춰주면 해결

nvm을 사용해서 버전을 맞춰주었음

profile
https://github.com/jsw4215

0개의 댓글