@holper/react-native-holper-storybook 0.6.82 → 0.6.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,7 @@ import * as ExpoImagePicker from 'expo-image-picker';
|
|
|
3
3
|
|
|
4
4
|
const ImagePicker = async (avatar) => {
|
|
5
5
|
const image = await ExpoImagePicker.launchImageLibraryAsync({
|
|
6
|
-
mediaTypes: ExpoImagePicker.
|
|
6
|
+
mediaTypes: ExpoImagePicker.MediaType.Images,
|
|
7
7
|
allowsEditing: avatar,
|
|
8
8
|
aspect: [4, 3],
|
|
9
9
|
quality: 1,
|
|
@@ -52,134 +52,135 @@ const TakePicture = ({
|
|
|
52
52
|
repeatPictureText,
|
|
53
53
|
usePictureText,
|
|
54
54
|
}) => {
|
|
55
|
-
const [permission, requestPermission] = useCameraPermissions();
|
|
56
|
-
const [type, setType] = useState('back');
|
|
57
|
-
const [image, setImage] = useState(null);
|
|
58
|
-
const [takingPicture, setTakingPicture] = useState(false);
|
|
59
|
-
const camera = useRef();
|
|
60
|
-
|
|
61
|
-
const flipCamera = () => {
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const takePicture = async () => {
|
|
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
|
-
const repeatPhoto = () => {
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const usePhoto = () => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const closeModal = () => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
if (!permission?.granted) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
55
|
+
// const [permission, requestPermission] = useCameraPermissions();
|
|
56
|
+
// const [type, setType] = useState('back');
|
|
57
|
+
// const [image, setImage] = useState(null);
|
|
58
|
+
// const [takingPicture, setTakingPicture] = useState(false);
|
|
59
|
+
// const camera = useRef();
|
|
60
|
+
|
|
61
|
+
// const flipCamera = () => {
|
|
62
|
+
// setType((current) => (current === 'back' ? 'front' : 'back'));
|
|
63
|
+
// };
|
|
64
|
+
|
|
65
|
+
// const takePicture = async () => {
|
|
66
|
+
// if (camera) {
|
|
67
|
+
// setTakingPicture(true);
|
|
68
|
+
// const tempImage = await camera.current.takePictureAsync({ quality: 1.0 });
|
|
69
|
+
|
|
70
|
+
// if (avatar) {
|
|
71
|
+
// const avatarImage = await ImageManipulator.manipulateAsync(
|
|
72
|
+
// tempImage.localUri || tempImage.uri,
|
|
73
|
+
// [
|
|
74
|
+
// {
|
|
75
|
+
// crop: {
|
|
76
|
+
// originX: 0,
|
|
77
|
+
// originY: (tempImage.height - tempImage.width) / 2,
|
|
78
|
+
// width: tempImage.width,
|
|
79
|
+
// height: tempImage.width,
|
|
80
|
+
// },
|
|
81
|
+
// },
|
|
82
|
+
// ],
|
|
83
|
+
// { compress: 1.0, format: ImageManipulator.SaveFormat.PNG }
|
|
84
|
+
// );
|
|
85
|
+
|
|
86
|
+
// setImage(avatarImage);
|
|
87
|
+
// setTakingPicture(false);
|
|
88
|
+
// } else {
|
|
89
|
+
// setImage(tempImage);
|
|
90
|
+
// setTakingPicture(false);
|
|
91
|
+
// }
|
|
92
|
+
// }
|
|
93
|
+
// };
|
|
94
|
+
|
|
95
|
+
// const repeatPhoto = () => {
|
|
96
|
+
// setImage(null);
|
|
97
|
+
// };
|
|
98
|
+
|
|
99
|
+
// const usePhoto = () => {
|
|
100
|
+
// onClose(typeof image === 'object' ? image.uri : image);
|
|
101
|
+
// setImage(null);
|
|
102
|
+
// };
|
|
103
|
+
|
|
104
|
+
// const closeModal = () => {
|
|
105
|
+
// setImage(null);
|
|
106
|
+
// onClose();
|
|
107
|
+
// };
|
|
108
|
+
|
|
109
|
+
// if (!permission?.granted) {
|
|
110
|
+
// return (
|
|
111
|
+
// <View style={style.cameraPermissionsContainer}>
|
|
112
|
+
// <Text color='red'>{cameraErrorMessage}</Text>
|
|
113
|
+
// <Button onPress={requestPermission} color='inverted'>
|
|
114
|
+
// <Text color='white'>{requestPermissionsMessage}</Text>
|
|
115
|
+
// </Button>
|
|
116
|
+
// </View>
|
|
117
|
+
// );
|
|
118
|
+
// }
|
|
119
119
|
|
|
120
120
|
return (
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
</
|
|
121
|
+
<Text>asdsdf</Text>
|
|
122
|
+
// <Modal
|
|
123
|
+
// animationType='slide'
|
|
124
|
+
// transparent={false}
|
|
125
|
+
// visible={visible}
|
|
126
|
+
// onRequestClose={onClose}
|
|
127
|
+
// >
|
|
128
|
+
// <Container style={style.cameraContainer}>
|
|
129
|
+
// <CameraView
|
|
130
|
+
// ref={camera}
|
|
131
|
+
// style={style.cameraContainer}
|
|
132
|
+
// facing={type}
|
|
133
|
+
// ratio={DESIRED_RATIO}
|
|
134
|
+
// >
|
|
135
|
+
// {avatar && isiOS && <SvgCircle />}
|
|
136
|
+
|
|
137
|
+
// <View style={style.cameraFlipContainer}>
|
|
138
|
+
// <TouchableOpacity onPress={closeModal} style={style.closeIcon}>
|
|
139
|
+
// <Ionicons
|
|
140
|
+
// name='close-outline'
|
|
141
|
+
// color={Colors.darkblue}
|
|
142
|
+
// size={24}
|
|
143
|
+
// />
|
|
144
|
+
// </TouchableOpacity>
|
|
145
|
+
// <TouchableOpacity style={style.cameraFlipBtn} onPress={flipCamera}>
|
|
146
|
+
// <Ionicons
|
|
147
|
+
// name='camera-reverse-outline'
|
|
148
|
+
// style={style.cameraFlipIcon}
|
|
149
|
+
// color={Colors.white}
|
|
150
|
+
// size={40}
|
|
151
|
+
// />
|
|
152
|
+
// </TouchableOpacity>
|
|
153
|
+
// <TouchableOpacity
|
|
154
|
+
// style={style.cameraRecordBtn}
|
|
155
|
+
// onPress={takePicture}
|
|
156
|
+
// >
|
|
157
|
+
// <Ionicons
|
|
158
|
+
// name='radio-button-on-outline'
|
|
159
|
+
// color={Colors.red}
|
|
160
|
+
// size={60}
|
|
161
|
+
// />
|
|
162
|
+
// </TouchableOpacity>
|
|
163
|
+
// </View>
|
|
164
|
+
|
|
165
|
+
// {avatar && isAndroid && <SvgCircle />}
|
|
166
|
+
// </CameraView>
|
|
167
|
+
|
|
168
|
+
// {takingPicture && (
|
|
169
|
+
// <View style={style.cameraTakingPictureOverlay}>
|
|
170
|
+
// <ActivityIndicator color={Colors.darkblue} />
|
|
171
|
+
// <Text color='white'>{processingPictureMessage} ...</Text>
|
|
172
|
+
// </View>
|
|
173
|
+
// )}
|
|
174
|
+
// <ConfirmPictureModal
|
|
175
|
+
// visible={image !== null}
|
|
176
|
+
// image={image}
|
|
177
|
+
// repeatPictureText={repeatPictureText}
|
|
178
|
+
// usePictureText={usePictureText}
|
|
179
|
+
// onRepeatPhoto={repeatPhoto}
|
|
180
|
+
// onUsePhoto={usePhoto}
|
|
181
|
+
// />
|
|
182
|
+
// </Container>
|
|
183
|
+
// </Modal>
|
|
183
184
|
);
|
|
184
185
|
};
|
|
185
186
|
|