RepairShopr / react-native-signature-capture

A simple modular component for react native (iOS) to capture a signature as an image
MIT License
962 stars 514 forks source link

SaveImage does not call on save event #122

Open bhautik-bharadava opened 6 years ago

bhautik-bharadava commented 6 years ago

I have enabled saveImageFileInExtStorage={true} but it seems when i call

saveSign = () => { console.log("Here"); this.refs["sign"].saveImage(); };

<SignatureCapture style={styles.signature} ref="sign" onSaveEvent={this._onSaveEvent} onDragEvent={this._onDragEvent} showBorder={false} saveImageFileInExtStorage={true} showNativeButtons={false} showTitleLabel={false} viewMode={'portrait'} />

OnSaveEvent is not calling what to do in this situation?

reneemeyer commented 6 years ago

@bhautik-bharadava The issue is the refs, React doesn't store refs in a global ref object anymore. Try the following ` saveSign() { this.sign.saveImage(); }

render() {
    return (
        <Modal isVisible={true}>
            <View style={{ flex: 1 }}>
                <SignatureCapture
                    style={[{flex:1},styles.signature]}
                    ref={input => this.sign = input}
                    onSaveEvent={this.handleSave}
                    saveImageFileInExtStorage={false}
                    showNativeButtons={false}
                    showTitleLabel={true}
                    viewMode={"landscape"}/>

                <View style={{ flex: 0, flexDirection: "row" }}>
                    <TouchableHighlight style={styles.buttonStyle}
                        onPress={this.props.handleCancel} >
                        <Text>Exit</Text>
                    </TouchableHighlight>
                    <TouchableHighlight style={styles.buttonStyle}
                        onPress={() => { this.saveSign() } } >
                        <Text>Save</Text>
                    </TouchableHighlight>
                </View>

            </View>
      </Modal>
    );
}`
MangalBeta commented 6 years ago

Not working on tablet please other solution ??

iainheng commented 6 years ago

Having the same issue where onSaveEvent is not called. Any solution to this issue?

lucasriondel commented 6 years ago

same here.

LHJ-K2S commented 6 years ago

I opened the android storage permission and it works

spruce-bruce commented 5 years ago

Hmmm

I have

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

but I'm still seeing this. What's odd is this was working for me until I updated to RN 0.57.4.

spruce-bruce commented 5 years ago

asked and answered. Even if it's in the manifest you have to ask for it now, https://facebook.github.io/react-native/docs/permissionsandroid

gaurav-sardana commented 5 years ago

Having the same issue, reset is working fine but after firing for save action the save event is not getting triggered. https://www.npmjs.com/package/react-native-signature-capture#example Tried this example.

hellogbg commented 4 years ago

asked and answered. Even if it's in the manifest you have to ask for it now, https://facebook.github.io/react-native/docs/permissionsandroid

This saved my day (or week)

neildevas commented 4 years ago

I'm still having this issue, even after explicitly requesting Android permissions. RN 0.63.2

kongjeey commented 3 years ago

I get the same thing. Read/write permission granted, but onSaveImage function doesn't get called on Android only (ios works fine even without the permission) so I have no way to get the image path.

tiffanym19 commented 3 years ago

how this issue fixed?

Jazibabdullah commented 3 years ago

I have enabled saveImageFileInExtStorage={true} but it seems when i call

saveSign = () => { console.log("Here"); this.refs["sign"].saveImage(); };

<SignatureCapture style={styles.signature} ref="sign" onSaveEvent={this._onSaveEvent} onDragEvent={this._onDragEvent} showBorder={false} saveImageFileInExtStorage={true} showNativeButtons={false} showTitleLabel={false} viewMode={'portrait'} />

OnSaveEvent is not calling what to do in this situation?