Skip to content

Commit d3abefe

Browse files
authored
Release v0.7.2 (#889)
This PR fixes package.json in both expo and bare resource fetchers. ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [x] Bug fix (change which fixes an issue) - [ ] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [ ] Other (chores, tests, code style improvements etc.) ### Tested on - [x] iOS - [ ] Android ### Testing instructions <!-- Provide step-by-step instructions on how to test your changes. Include setup details if necessary. --> ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues <!-- Link related issues here using #issue-number --> ### Checklist - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes <!-- Include any additional information, assumptions, or context that reviewers might need to understand this PR. -->
1 parent a305030 commit d3abefe

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

packages/react-native-executorch/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-executorch",
3-
"version": "0.7.1",
3+
"version": "0.7.2",
44
"description": "An easy way to run AI models in React Native with ExecuTorch",
55
"source": "./src/index.ts",
66
"main": "./lib/module/index.js",
@@ -67,8 +67,8 @@
6767
},
6868
"peerDependencies": {
6969
"expo": ">=54.0.0",
70-
"expo-asset": "^12.0.0",
71-
"expo-file-system": "^19.0.0",
70+
"expo-asset": ">=12.0.0",
71+
"expo-file-system": ">=19.0.0",
7272
"react": "*",
7373
"react-native": "*"
7474
},

packages/react-native-executorch/src/modules/computer_vision/TextToImageModule.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ResourceFetcher } from '../../utils/ResourceFetcher';
22
import { ResourceSource } from '../../types/common';
33
import { BaseModule } from '../BaseModule';
4-
import { Buffer } from 'buffer';
4+
55
import { PNG } from 'pngjs/browser';
66
import { RnExecutorchErrorCode } from '../../errors/ErrorCodes';
77
import { RnExecutorchError } from '../../errors/errorUtils';
@@ -115,10 +115,15 @@ export class TextToImageModule extends BaseModule {
115115
return '';
116116
}
117117
const png = new PNG({ width: imageSize, height: imageSize });
118-
png.data = Buffer.from(outputArray);
118+
png.data = outputArray as unknown as Buffer;
119119
const pngBuffer = PNG.sync.write(png, { colorType: 6 });
120-
const pngString = pngBuffer.toString('base64');
121-
return pngString;
120+
const pngArray = new Uint8Array(pngBuffer as unknown as ArrayBufferLike);
121+
let binary = '';
122+
const chunkSize = 8192;
123+
for (let i = 0; i < pngArray.length; i += chunkSize) {
124+
binary += String.fromCharCode(...pngArray.subarray(i, i + chunkSize));
125+
}
126+
return btoa(binary);
122127
}
123128

124129
/**

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12966,8 +12966,8 @@ __metadata:
1296612966
zod: "npm:^3.25.0"
1296712967
peerDependencies:
1296812968
expo: ">=54.0.0"
12969-
expo-asset: ^12.0.0
12970-
expo-file-system: ^19.0.0
12969+
expo-asset: ">=12.0.0"
12970+
expo-file-system: ">=19.0.0"
1297112971
react: "*"
1297212972
react-native: "*"
1297312973
languageName: unknown

0 commit comments

Comments
 (0)