diff --git a/en/react-native-smartassets.md b/en/react-native-smartassets.md index b05c80dc64d3a8adcac7cb24162e21c8ee320667..aca1aa26705b9866d41f016856e342d4e501c307 100644 --- a/en/react-native-smartassets.md +++ b/en/react-native-smartassets.md @@ -12,11 +12,11 @@

-> [!TIP] [Github address](https://github.com/smallnew/react-native-smartassets) +> [!TIP] [Github address](https://github.com/react-native-oh-library/react-native-smartassets) ## Installation and Usage -Please go to the release address of the third-party library to view the matching version information: [@react-native-oh-tpl/react-native-smartassets Releases](https://github.com/smallnew/react-native-smartassets/releases). For older versions not published to npm, please refer to the [Installation Guide](/en/tgz-usage.md) to install the tgz package. +Please go to the release address of the third-party library to view the matching version information: [@react-native-oh-tpl/react-native-smartassets Releases](https://github.com/react-native-oh-library/react-native-smartassets/releases). For older versions not published to npm, please refer to the [Installation Guide](/en/tgz-usage-en.md) to install the tgz package. Navigate to the project directory and enter the following command: @@ -172,7 +172,7 @@ std::vector> PackageProvider::getPackages(Package::Cont ### 4. Introduce SmartAssetsPackage on ArkTs Side -Open `entry/src/main/ets/RNPackagesFactory.ts` and add: +Open `entry/src/main/ets/RNPackagesFactory.ets` add: ```diff ... @@ -205,35 +205,31 @@ Then compile and run. To use this library, the correct React-Native and RNOH versions are required. Additionally, you need to use the matching DevEco Studio and phone ROM. -Please go to the corresponding Releases page of the third-party library to view the matching version information: [@react-native-oh-tpl/react-native-smartassets Releases](https://github.com/smallnew/react-native-smartassets/releases) +Please go to the corresponding Releases page of the third-party library to view the matching version information: [@react-native-oh-tpl/react-native-smartassets Releases](https://github.com/react-native-oh-library/react-native-smartassets/releases) This document is verified based on the following versions: 1. RNOH: 0.72.32; SDK: HarmonyOS-Next-DB6 5.0.0.61; IDE: DevEco Studio 5.0.3.706; ROM: 3.0.0.61; - - ## Static Methods > [!TIP] The "Platform" column indicates the platform supported by the attribute in the original third-party library. > [!TIP] If "HarmonyOS Support" is "yes", it means HarmonyOS platform supports this property; "no" means not supported; "partially" means partially supported. The usage method is cross-platform consistent, and the effect is aligned with iOS or Android. -SmartAssets is a React Native image asset intelligent loading library. It changes the React Native image loading logic by hooking the `AssetSourceResolver.defaultAsset` method, allowing applications to intelligently load image resources from application packages (Android APK, iOS IPA, HarmonyOS HAP) and file system sandbox paths. - **Name** | **Description** | **Type** | **Required** | **Platform** | **HarmonyOS Support** -- | -- | -- | -- | -- | -- initSmartAssets | Initialize SmartAssets and set up image loading hook | function | yes | All | yes -findAssetInBundles | Find image resource with specified name in application package and sandbox paths | function | no | Harmony | yes +initSmartAssetsInner | Internal initialization logic, set up resource resolution hook | function | no | All | yes | +setBundlePath | Search for image resources in a specified path | function | no | Android | yes +setiOSRelateMainBundlePath | Set iOS path to search for image resources | function | no | iOS | no ## Known Issues ## Others +- The `setiOSRelateMainBundlePath` method is only supported on iOS platform in the original third-party library, therefore it is not supported on HarmonyOS platform. + ## License This project is based on [The MIT License (MIT)](https://github.com/smallnew/react-native-smartassets/blob/master/LICENSE), please enjoy and participate in open source freely. diff --git a/zh-cn/react-native-smartassets.md b/zh-cn/react-native-smartassets.md index 84bf74df1a3044201874a9cd6fce8c789f43456f..a5878c37bf0d1eecd3e809a53cdbec72ac7ad0c5 100644 --- a/zh-cn/react-native-smartassets.md +++ b/zh-cn/react-native-smartassets.md @@ -12,11 +12,11 @@

-> [!TIP] [Github 地址](https://github.com/smallnew/react-native-smartassets) +> [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-smartassets) ## 安装与使用 -请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-smartassets Releases](https://github.com/smallnew/react-native-smartassets/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 +请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-smartassets Releases](https://github.com/react-native-oh-library/react-native-smartassets/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 进入到工程目录并输入以下命令: @@ -172,7 +172,7 @@ std::vector> PackageProvider::getPackages(Package::Cont ### 4.在 ArkTs 侧引入 SmartAssetsPackage -打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: +打开 `entry/src/main/ets/RNPackagesFactory.ets`,添加: ```diff ... @@ -205,34 +205,31 @@ ohpm install 要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。 -请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-smartassets Releases](https://github.com/smallnew/react-native-smartassets/releases) +请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-smartassets Releases](https://github.com/react-native-oh-library/react-native-smartassets/releases) 本文档内容基于以下版本验证通过: 1. RNOH: 0.72.32; SDK: HarmonyOS-Next-DB6 5.0.0.61; IDE: DevEco Studio 5.0.3.706; ROM: 3.0.0.61; - - ## 静态方法 > [!TIP] "Platform"列表示该属性在原三方库上支持的平台。 > [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 -SmartAssets 是一个 React Native 图片资源智能加载库。它通过 hook `AssetSourceResolver.defaultAsset` 方法改变了 React Native 的图片加载逻辑,让应用能够智能地从应用包(Android APK、iOS IPA、HarmonyOS HAP)和文件系统沙箱路径中加载图片资源。 - **Name** | **Description** | **Type** | **Required** | **Platform** | **HarmonyOS Support** -- | -- | -- | -- | -- | -- initSmartAssets | 初始化 SmartAssets,设置图片加载 hook | function | yes | All | yes -findAssetInBundles | 在应用包和沙箱路径中查找指定名称的图片资源 | function | no | Harmony | yes +initSmartAssetsInner | 内部初始化逻辑,设置资源解析 hook | function | no | All | yes | +setBundlePath | 指定路径查找图片资源 | function | no | Android | yes +setiOSRelateMainBundlePath | 设置 iOS 路径,查找图片资源 | function | no | iOS | no + ## 遗留问题 ## 其他 +- `setiOSRelateMainBundlePath` 方法在原三方库中仅支持 iOS 平台,因此 HarmonyOS 平台不支持此方法。 + ## 开源协议 本项目基于 [The MIT License (MIT)](https://github.com/smallnew/react-native-smartassets/blob/master/LICENSE) ,请自由地享受和参与开源。