I am new to react native. I want to capture digital signature so I using "react-native-signature-capture"
But now I am getting error like "Invariant Violation: requireNativeComponent: "RSSignatureView" was not found in the UIManager" so please help me.
I have not ejected my project yet. I am using expo.
here is my code:
import React, {createRef} from 'react';
// import all the components we are going to use
import {
SafeAreaView,
StyleSheet,
View,
Text,
TouchableHighlight,
} from 'react-native';
import SignatureCapture from 'react-native-signature-capture';
const DigSign = () => {
const sign = createRef();
const saveSign = () => {
sign.current.saveImage();
};
const resetSign = () => {
sign.current.resetImage();
};
const _onSaveEvent = (result) => {
//result.encoded - for the base64 encoded png
//result.pathName - for the file path name
alert('Signature Captured Successfully');
console.log(result.encoded);
};
const _onDragEvent = () => {
// This callback will be called when the user enters signature
console.log('dragged');
};
return (
<SafeAreaView style={styles.container}>
<View style={styles.container}>
<Text style={styles.titleStyle}>
Capture Digital Signature in React Native App
</Text>
<SignatureCapture
style={styles.signature}
ref={sign}
onSaveEvent={_onSaveEvent}
onDragEvent={_onDragEvent}
showNativeButtons={false}
showTitleLabel={false}
viewMode={'portrait'}
/>
<View style={{flexDirection: 'row'}}>
<TouchableHighlight
style={styles.buttonStyle}
onPress={() => {
saveSign();
}}>
<Text>Save</Text>
</TouchableHighlight>
<TouchableHighlight
style={styles.buttonStyle}
onPress={() => {
resetSign();
}}>
<Text>Reset</Text>
</TouchableHighlight>
</View>
</View>
</SafeAreaView>
);
};
export default DigSign;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
titleStyle: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
signature: {
flex: 1,
borderColor: '#000033',
borderWidth: 1,
},
buttonStyle: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
height: 50,
backgroundColor: '#eeeeee',
margin: 10,
},
});
question from:
https://stackoverflow.com/questions/65936602/invariant-violation-requirenativecomponent-rssignatureview-was-not-found-in 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…