Sunmi Printer package problem with react-native version 0.71.7
PhoenixAssutech opened this issue · comments
@PhoenixAssutech fixed the issue. Please reinstall the library and then try.
@geekdroid07 @d-lindau Can you guys give more detail about the code like how are you calling library methods for printing?
because it is working with me with react-native 0.71.14 without any issue.
Sunmi V2s
react-native-cli: 2.0.1
react-native: 0.71.14
node 20 (also tried node 18)
windows 11
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
I have now started a brand new project. I have only installed @heasy/react-native-sunmi-printer and changed App.tsx to this:
import React from 'react';
import { SafeAreaView, Button } from 'react-native';
import SunmiPrinter from '@heasy/react-native-sunmi-printer';
async function _printRecieve(text) {
if (text === "print") {
alert("Printing");
try {
await SunmiPrinter.printerText('Hello World\n');
} catch (e) {
// Handle the error here. Using `setState` implies this should be within a class or useState hook
console.error("Printer error: " + e.message);
}
}
}
function App(): JSX.Element {
const handlePrint = () => _printRecieve('print'); // This creates a new function that calls _printRecieve with 'print'
return (
<SafeAreaView>
<Button title="Print" onPress={handlePrint} />
</SafeAreaView>
);
}
export default App;
I get the error on start.
Update: Started new issue #43
@d-lindau
Make sure to add android-manifest.plugin.js file in root folder
const { withAndroidManifest } = require("@expo/config-plugins");
module.exports = function androiManifestPlugin(config) {
return withAndroidManifest(config, async (config) => {
let androidManifest = config.modResults.manifest;
androidManifest.queries.push({
package: {
$: {
"android:name": "woyou.aidlservice.jiuiv5",
},
},
});
return config;
});
};
and add following in app.json
"plugins": [
"./android-manifest.plugin.js",
...restcode