Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

react-native-printer-pt220

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-printer-pt220

React Native Module For PT-220 Thermal Printer

Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-printer-pt220

React Native Module For PT-220 Thermal Printer

Usage

import * as React from 'react';

import { StyleSheet, View, Button } from 'react-native';
import { ptConnect, ptSetPrinter, ptPrintText, PT_ALIGN_CENTER } from 'react-native-printer-pt220';

export default function App() {

  const [result, setResult] = React.useState<string>();

  React.useEffect(() => {
    console.log('Connecting...');
    ptConnect('60:6E:41:62:92:F8').then(setResult);
  }, []);

  return (
    <View style={styles.container}>
      <Button title='Print Text' onPress={() => {
        ptSetPrinter(PT_ALIGN_CENTER)
        .then(ret => {
          console.log(ret);
          console.log('Set printer to align center');

          ptPrintText('React Native Module Test...\n\n')
          .then(pret => {
            console.log(pret);
            console.log('Text printed...');
          })
          .catch(pe => {
            console.log(pe);
          });

        })
        .catch(e => {
          console.log(e);
        });

      }} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  box: {
    width: 60,
    height: 60,
    marginVertical: 20,
  },
});

Keywords

react-native

FAQs

Package last updated on 12 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts