Code Monkey home page Code Monkey logo

monkzl / react-native-clipboard-command Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 434 KB

类似于淘口令的应用,打开app检测粘贴板内容,但是要求不能更改剪切板的内容,在自己的应用内只能检测一次,再者如果是自己应用内的淘口令,自己不能检测

License: MIT License

Java 45.35% JavaScript 4.31% Ruby 5.98% Makefile 3.72% C++ 17.15% C 0.25% Objective-C 1.20% Objective-C++ 13.54% Swift 0.17% TypeScript 8.33%

react-native-clipboard-command's Introduction

react-native-clipboard-command

类似于淘口令的应用,打开app检测粘贴板内容,但是要求不能更改剪切板的内容,在自己的应用内只能检测一次,再者如果是自己应用内的淘口令,自己不能检测

Installation

npm install react-native-clipboard-command

Usage

import { setCommand, useCommand } from 'react-native-clipboard-command';

export default function App() {
  const [commandStr, setCommandStr] = React.useState('');

  useCommand(
    (command) => {
      alert('复制过来的指令是: ' + command);
    },
    (reason) => {
      alert(reason);
    }
  );

  return (
    <View style={styles.container}>
      <TextInput
        placeholder={'请输入口令'}
        value={commandStr}
        onChangeText={setCommandStr}
        style={{
          width: '50%',
          height: 50,
          borderWidth: 1,
          paddingHorizontal: 10,
        }}
      />
      <TouchableOpacity
        style={{
          width: 100,
          height: 100,
          backgroundColor: 'red',
          alignItems: 'center',
          justifyContent: 'center',
        }}
        onPress={() => {
          setCommand(commandStr);
          alert('设置成功');
        }}
      >
        <Text>设置口令</Text>
      </TouchableOpacity>
    </View>
  );
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

react-native-clipboard-command's People

Stargazers

Bogdan Georgian Alexa avatar  avatar zhaoaixu520 avatar

Watchers

zhangliang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.