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

Problem with fixed name #74

Open agrass opened 7 years ago

agrass commented 7 years ago

When I have multiples signatures, all save in the same name "signature.png. I created a PR to fix this #73

fabriziomoscon commented 7 years ago

Hi @jedt, thanks for this module, very cool and useful!

I am using react-native 0.47.2 react-native-signature-capture 0.4.7

I found the same issues as @agrass, since we have two screens in the app that use the SignatureCapture component. The problem exists only on iOS, on Android both signature are captured.

My code is like so

<SignatureCapture
              ref={element => this.signature = element}
              onSaveEvent={result => saveSignature(result.encoded)}
              saveImageFileInExtStorage={false}
              showNativeButtons={false}
              showTitleLabel={false}
              viewMode="portrait"
/>

I tried the Objective-C changes contained in #73 where a timestamp is appended to signature, but in my case UIImage *signImage is nil so isSuccess is false and the onSave event is never triggered.

fabriziomoscon commented 7 years ago

I found the solution for my problem and it turned out that it was not related at all to the filename.

I am rendering the two signature screen at same time, since they are part of the same TabStackNavigator, so I need to remove completely the first <SignatureCapture /> in order to make the second work. I guess the original design of the library was not meant to allow multiple signature and removing each component as you progress in the business flow is a quite easy workaround.

NgKhanh commented 6 years ago

How can we custome file name and pass from react-native app. I tried to change saveImage(String fileName) but It dont work

hellogbg commented 5 years ago

I found the solution for my problem and it turned out that it was not related at all to the filename.

I am rendering the two signature screen at same time, since they are part of the same TabStackNavigator, so I need to remove completely the first <SignatureCapture /> in order to make the second work. I guess the original design of the library was not meant to allow multiple signature and removing each component as you progress in the business flow is a quite easy workaround.

How do you "remove completely the first "?