Skip to content

Commit

Permalink
fix: android RNGH
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqingchen committed Apr 23, 2023
1 parent 1ee8feb commit ebdd070
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 9 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"css": "sass"
},
"scripts": {
"postinstall": "patch-package",
"build:weapp": "taro build --type weapp",
"build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay",
Expand Down Expand Up @@ -71,7 +72,7 @@
"@tarojs/shared": "3.6.5-canary.1",
"@tarojs/taro": "3.6.5-canary.1",
"@tarojs/taro-rn": "3.6.5-canary.1",
"@wuba/react-native-echarts": "^1.0.0",
"@wuba/react-native-echarts": "1.1.0-alpha.0",
"d3-hierarchy": "^3.1.2",
"echarts": "^5.4.1",
"echarts-stat": "^1.2.0",
Expand All @@ -89,6 +90,8 @@
"linear-gradient-taro": "^1.0.1",
"lottie-ios": "3.4.0",
"lottie-react-native": "^5.1.3",
"patch-package": "^6.5.1",
"postinstall-postinstall": "^2.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-json-view": "^1.21.3",
Expand Down
22 changes: 22 additions & 0 deletions patches/@tarojs+rn-transformer+3.6.5-canary.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/node_modules/@tarojs/rn-transformer/dist/app.js b/node_modules/@tarojs/rn-transformer/dist/app.js
index 8dc4f76..a1f8c37 100644
--- a/node_modules/@tarojs/rn-transformer/dist/app.js
+++ b/node_modules/@tarojs/rn-transformer/dist/app.js
@@ -107,7 +107,7 @@ function generateEntry({ filename, projectRoot, sourceDir, appName, entryName, d
const routeList = pages.screenPages;
const appComponentPath = `./${sourceDir}/${entryName}`;
const appTabBar = getFormatTabBar(appPath, basePath);
- const code = `import 'react-native-gesture-handler'
+ const code = `import { gestureHandlerRootHOC } from 'react-native-gesture-handler'
import { AppRegistry } from 'react-native'
import { createReactNativeApp, createPageConfig } from '@tarojs/runtime-rn'
import Component from '${appComponentPath}'
@@ -121,7 +121,7 @@ function generateEntry({ filename, projectRoot, sourceDir, appName, entryName, d
const config = { appConfig: { ...buildConfig, ...AppComponentConfig } }
global.__taroAppConfig = config
config['pageList'] = [${routeList.map(pageItem => getPageScreen(pageItem))}]
- AppRegistry.registerComponent('${appName}',() => createReactNativeApp(Component,config))
+ AppRegistry.registerComponent('${appName}',() => gestureHandlerRootHOC(createReactNativeApp(Component,config)))
`;
return code;
}
6 changes: 3 additions & 3 deletions src/pages/explore/charts/echarts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default function EchartsPage({ option, width = E_WIDTH, height = E_HEIGHT
const svgRef = useRef<any>(null);
const skiaRef = useRef<any>(null);
useEffect(() => {
let chart;
let chart: echarts.ECharts;
if (svgRef.current) {
// @ts-ignore
chart = echarts.init(svgRef.current, 'light', {
Expand All @@ -131,7 +131,7 @@ export default function EchartsPage({ option, width = E_WIDTH, height = E_HEIGHT
}, [option]);

useEffect(() => {
let chart;
let chart: echarts.ECharts;
if (skiaRef.current) {
// @ts-ignore
chart = echarts.init(skiaRef.current, 'light', {
Expand All @@ -153,7 +153,7 @@ export default function EchartsPage({ option, width = E_WIDTH, height = E_HEIGHT
</View>
<View className='charts-container'>
<View className='charts-render'>React Native Skia</View>
<SkiaComponent ref={skiaRef} />
<SkiaComponent useRNGH ref={skiaRef} />
</View>
</View>
);
Expand Down
60 changes: 55 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4579,10 +4579,10 @@
"@webassemblyjs/ast" "1.11.1"
"@xtuc/long" "4.2.2"

"@wuba/react-native-echarts@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@wuba/react-native-echarts/-/react-native-echarts-1.0.0.tgz#91da0b7e51c0b37e39d2903e0a25b7ddf2be7670"
integrity sha512-TBf/NrMYvy6vlyQHiCwaAIeYpC5ZKDCJjH+8Vl45ylBZeSVy7NO7c8TrrKmaUn/iL8QJbZlRGK0QAFfa/ELeEw==
"@wuba/react-native-echarts@1.1.0-alpha.0":
version "1.1.0-alpha.0"
resolved "https://registry.yarnpkg.com/@wuba/react-native-echarts/-/react-native-echarts-1.1.0-alpha.0.tgz#a454a75074d004cb9f958cc94ab8830d6c98a927"
integrity sha512-8KerDZ08reg3RJvISFJGurH4qgos5F2qjgA7QKjNdLHmQZumznPvVrARqD6QVLbNVV5R5epvn+Ct0o4t11eWkw==
dependencies:
"@xmldom/xmldom" "^0.8.6"
entities "^4.4.0"
Expand All @@ -4607,6 +4607,11 @@
resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d"
integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==

"@yarnpkg/lockfile@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==

abab@^2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291"
Expand Down Expand Up @@ -9571,7 +9576,7 @@ find-yarn-workspace-root2@1.2.16:
micromatch "^4.0.2"
pkg-dir "^4.2.0"

find-yarn-workspace-root@2.0.0, find-yarn-workspace-root@~2.0.0:
find-yarn-workspace-root@2.0.0, find-yarn-workspace-root@^2.0.0, find-yarn-workspace-root@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd"
integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==
Expand Down Expand Up @@ -11962,6 +11967,13 @@ kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3:
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==

klaw-sync@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c"
integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==
dependencies:
graceful-fs "^4.1.11"

kleur@^3.0.0, kleur@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
Expand Down Expand Up @@ -13936,6 +13948,14 @@ open@^6.2.0:
dependencies:
is-wsl "^1.1.0"

open@^7.4.2:
version "7.4.2"
resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321"
integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==
dependencies:
is-docker "^2.0.0"
is-wsl "^2.1.1"

open@^8.0.4, open@^8.0.9, open@^8.3.0:
version "8.4.2"
resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9"
Expand Down Expand Up @@ -14284,6 +14304,26 @@ password-prompt@^1.0.4:
ansi-escapes "^3.1.0"
cross-spawn "^6.0.5"

patch-package@^6.5.1:
version "6.5.1"
resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.5.1.tgz#3e5d00c16997e6160291fee06a521c42ac99b621"
integrity sha512-I/4Zsalfhc6bphmJTlrLoOcAF87jcxko4q0qsv4bGcurbr8IskEOtdnt9iCmsQVGL1B+iUhSQqweyTLJfCF9rA==
dependencies:
"@yarnpkg/lockfile" "^1.1.0"
chalk "^4.1.2"
cross-spawn "^6.0.5"
find-yarn-workspace-root "^2.0.0"
fs-extra "^9.0.0"
is-ci "^2.0.0"
klaw-sync "^6.0.0"
minimist "^1.2.6"
open "^7.4.2"
rimraf "^2.6.3"
semver "^5.6.0"
slash "^2.0.0"
tmp "^0.0.33"
yaml "^1.10.2"

path-browserify@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd"
Expand Down Expand Up @@ -14918,6 +14958,11 @@ postcss@^8.1.10, postcss@^8.2.14, postcss@^8.3.5, postcss@^8.4.18, postcss@^8.4.
picocolors "^1.0.0"
source-map-js "^1.0.2"

postinstall-postinstall@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3"
integrity sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ==

preferred-pm@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/preferred-pm/-/preferred-pm-3.0.3.tgz#1b6338000371e3edbce52ef2e4f65eb2e73586d6"
Expand Down Expand Up @@ -16636,6 +16681,11 @@ slash@^1.0.0:
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
integrity sha512-3TYDR7xWt4dIqV2JauJr+EJeW356RXijHeUlO+8djJ+uBXPn8/2dpzBc8yQhh583sVvc9CvFAeQVgijsH+PNNg==

slash@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44"
integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==

slash@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
Expand Down

0 comments on commit ebdd070

Please sign in to comment.