-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.android.js
95 lines (83 loc) · 2.35 KB
/
index.android.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity,
Image
} from 'react-native';
import { RNCamera, FaceDetector } from 'react-native-camera';
import { SvgCss } from 'react-native-svg';
import { CryptoModule, GCMCryptoModule } from './NativeUtils';
CryptoModule.show('Awesome', 4);
CryptoModule.encrypt("some text goes here", "test1234", (msg) => {
alert(msg);
});
GCMCryptoModule.nativeEncrypt('This is test data', 'thisisthetestkey',(msg) => {
console.log('err', msg);
},(encryptedData) => {
console.log(encryptedData);
});
GCMCryptoModule.nativeDecrypt('AAAADAAAAAAAAAAAAAAAAMj7e0MHUabJOGXPmsXaI2Xt1icsljhWuK7k0IWe0TXa1g==', 'thisisthetestkey',(msg) => {
console.log('err', msg);
},(encryptedData) => {
console.log(encryptedData);
});
class HelloUser extends React.Component {
constructor(props) {
super(props);
this.state = {
imageUrl: null
}
}
takePicture = async() => {
if (this.camera) {
const options = { quality: 0.5, base64: true };
const data = await this.camera.takePictureAsync(options);
console.log(data.uri);
this.setState({
imageUrl: data.uri
});
}
};
render() {
const svgXml = `
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="13" viewBox="0 0 14 13">
<g fill="#222" fill-rule="evenodd" transform="translate(.446)">
<rect width="1.152" height="12.674" x="5.94" rx=".576"/>
<path d="M12.853 6.337c0 .318-.258.576-.576.576H.755c-.318 0-.576-.258-.576-.576 0-.318.258-.576.576-.576h11.522c.318 0 .576.258.576.576z"/>
</g>
</svg>
`;
return (
<View style={styles.container}>
{this.state.imageUrl && <Image style={{width: 200, height: 200}} source={{uri: this.state.imageUrl}} /> }
<View style={styles.container}>
<SvgCss xml={svgXml} width="100%" height="100%" />
</View>
</View>
)
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
preview: {
flex: 1,
justifyContent: 'flex-end',
alignItems: 'center',
},
capture: {
flex: 0,
backgroundColor: '#fff',
borderRadius: 5,
padding: 15,
paddingHorizontal: 20,
alignSelf: 'center',
margin: 20,
},
});
AppRegistry.registerComponent('AwesomeReactApp', () => HelloUser);