Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation simplification for Android install and use #298

Open
Productivix opened this issue Nov 14, 2023 · 0 comments
Open

documentation simplification for Android install and use #298

Productivix opened this issue Nov 14, 2023 · 0 comments

Comments

@Productivix
Copy link

I just want here to update and simplify Android install and code : I use last 0.72.6 React Native

install:

just yarn add react-native-signature-capture

usage example:

import React, {useRef} from 'react';

  const EcranSignature = () => {
    const signRef = useRef(null);

    saveSign = () => {
      signRef.current.saveImage();
      //then reset
      resetSign();
    };

    resetSign = () => {
      signRef.current.resetImage();
      console.log('image reseted');
    };

    onSaveEvent = result => {
      //result.encoded - for the base64 encoded png
      //result.pathName - for the file path name
      console.log('signature:', result);
    };
    onDragEvent = () => {
      // This callback will be called when the user enters signature
      console.log('dragged');
    };

    return (
      <SafeAreaView style={{flex: 1, flexDirection: 'column'}}>
        <Text style={{alignItems: 'center', justifyContent: 'center'}}>
          signature reception
        </Text>
        <SignatureCapture
         style={[{flex:1},styles.signature]}
          ref={signRef}
          onSaveEvent={onSaveEvent}
          onDragEvent={onDragEvent}
          saveImageFileInExtStorage={false}
          showNativeButtons={false}
          showTitleLabel={false}
          backgroundColor="#ff00ff"
          strokeColor="#ffffff"
          minStrokeWidth={4}
          maxStrokeWidth={4}
          viewMode={'portrait'}
        />
        <View style={{flex: 1, flexDirection: 'row'}}>
          <TouchableOpacity
            style={styles.buttonStyle}
            onPress={() => {
              saveSign();
            }}>
            <Text>Save</Text>
          </TouchableOpacity>

          <TouchableOpacity
          style={styles.buttonStyle}
            onPress={() => {
              resetSign();
            }}>
            <Text>Reset</Text>
          </TouchableOpacity>
        </View>
      </SafeAreaView>
    );
  };

then use this component as

@Productivix Productivix changed the title documentation simplifcation for Android install and use documentation simplification for Android install and use Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant