@jescon-technologies/react-native-ui-kit 0.0.6 → 0.0.7
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.
- package/dist/Common/ErrorBoundary.d.ts +15 -0
- package/dist/Common/ErrorBoundary.d.ts.map +1 -0
- package/dist/Common/ErrorBoundary.js +64 -0
- package/dist/Common/ErrorBoundary.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/src/Common/ErrorBoundary.d.ts +15 -0
- package/dist/src/Common/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/Common/ErrorBoundary.js +64 -0
- package/dist/src/Common/ErrorBoundary.js.map +1 -0
- package/package.json +17 -5
- package/.gitattributes +0 -2
- package/index.d.ts +0 -66
- package/index.js +0 -66
- package/src/Alerts/AAlert.js +0 -137
- package/src/Alerts/AAlertIOS.js +0 -97
- package/src/Alerts/ABlink.js +0 -40
- package/src/Common/ErrorBoundary.tsx +0 -73
- package/src/Common/Icons.js +0 -49
- package/src/Common/NetworkServiceCall.js +0 -265
- package/src/CommonStyle/CommonTheme.js +0 -11
- package/src/CommonStyle/ComponentFunctions.js +0 -632
- package/src/CommonStyle/PopupStyle.js +0 -146
- package/src/CommonStyle/commonStyle.js +0 -93
- package/src/CommonStyle/componentStyle.js +0 -545
- package/src/CommonStyle/optionListStyles.js +0 -175
- package/src/Components/ByProductPage.js +0 -200
- package/src/Components/CDropDownListNew.js +0 -153
- package/src/Components/CSupplierList.js +0 -88
- package/src/Components/CVerificationCard.js +0 -2822
- package/src/Components/CustomButton.js +0 -67
- package/src/Components/CustomCard.js +0 -127
- package/src/Components/CustomTextInput.js +0 -47
- package/src/Components/EquipmentPage.js +0 -313
- package/src/Components/FilterInput.Copy.js +0 -723
- package/src/Components/FilterInput.js +0 -569
- package/src/Components/HSubHeading.js +0 -68
- package/src/Components/HeaderCard.js +0 -40
- package/src/Components/MoreOptionsScreen.js +0 -251
- package/src/Components/NonSwipableProductCard.js +0 -226
- package/src/Components/NonSwipableSupplierCard.js +0 -348
- package/src/Components/ProductCard.js +0 -1336
- package/src/Components/QualityProductCard.js +0 -1059
- package/src/Components/RateProductCard.js +0 -1452
- package/src/Components/RawMaterial.js +0 -261
- package/src/Components/SDropDownEdited.js +0 -549
- package/src/Components/SDropDownNew.js +0 -529
- package/src/Components/SHelpDescription.js +0 -147
- package/src/Components/STextInputNew.js +0 -510
- package/src/Components/SearchProductCard.js +0 -470
- package/src/Components/StageByProduct.js +0 -199
- package/src/Components/SupplierCard.js +0 -243
- package/src/Components/SupplierInvoiceCard.js +0 -405
- package/src/Components/SwipableSupplierCard.js +0 -136
- package/src/Components/TagTemplate.js +0 -74
- package/src/Components/WrappedComponent.js +0 -25
- package/src/Custom/CBooking.js +0 -944
- package/src/Custom/CBookingPostpone.js +0 -1822
- package/src/Custom/CCalendar.js +0 -560
- package/src/Custom/CCard.js +0 -880
- package/src/Custom/CDetailCard.js +0 -205
- package/src/Custom/CHelpImage.js +0 -52
- package/src/Custom/CReport.js +0 -569
- package/src/Custom/CScrollView.js +0 -73
- package/src/Custom/CSignature.js +0 -112
- package/src/Custom/CSliderMenu.js +0 -339
- package/src/Custom/CSupplierCard.js +0 -99
- package/src/Custom/CTemplateCard.js +0 -438
- package/src/Custom/CTokenAllocation.js +0 -1402
- package/src/Custom/CTokenListOverlay.js +0 -122
- package/src/Custom/CWardStatus.js +0 -444
- package/src/Custom/Charts/CBarChart.js +0 -218
- package/src/Custom/Charts/CDashBoardList.js +0 -133
- package/src/Custom/Charts/CDashBoardTable.js +0 -172
- package/src/Custom/Charts/CLineChart.js +0 -193
- package/src/Custom/Charts/CPieChart.js +0 -186
- package/src/Custom/Loader.js +0 -182
- package/src/Custom/OUserView.js +0 -1121
- package/src/Custom/PreviewDosage.js +0 -115
- package/src/Custom/SearchLoader.js +0 -32
- package/src/Custom/TableComponent/CActivityTable.js +0 -707
- package/src/Custom/TableComponent/CMoreButtonTable.js +0 -197
- package/src/Custom/TableComponent/CTable.js +0 -185
- package/src/Custom/TableComponent/CTextBody.js +0 -40
- package/src/Custom/TableComponent/CTextHeader.js +0 -17
- package/src/Custom/TableComponent/PreviewPrescriptionNew.js +0 -1011
- package/src/Custom/TableComponent/SDropdownTable.js +0 -491
- package/src/Custom/TableComponent/TagTable.js +0 -1200
- package/src/CustomComponents/CAddColumn.js +0 -140
- package/src/CustomComponents/CAssessmentDelete.js +0 -307
- package/src/CustomComponents/CAwesomeButton.js +0 -83
- package/src/CustomComponents/CAwesomeMoreButton.js +0 -54
- package/src/CustomComponents/CBackHandler.js +0 -273
- package/src/CustomComponents/CCalendar.js +0 -243
- package/src/CustomComponents/CCommentOverlay.js +0 -202
- package/src/CustomComponents/CComments.js +0 -162
- package/src/CustomComponents/CContainerView.js +0 -24
- package/src/CustomComponents/CCustomTextInput.js +0 -336
- package/src/CustomComponents/CDetailView.js +0 -40
- package/src/CustomComponents/CDropDownList.js +0 -153
- package/src/CustomComponents/CDropdownSelect.js +0 -555
- package/src/CustomComponents/CFooterView.js +0 -42
- package/src/CustomComponents/CImagePickerSave.js +0 -316
- package/src/CustomComponents/CModalOverlay.js +0 -91
- package/src/CustomComponents/CNetworkStatus.js +0 -327
- package/src/CustomComponents/CNotesInstructions.js +0 -1000
- package/src/CustomComponents/COverlay.js +0 -81
- package/src/CustomComponents/CRemarks.js +0 -176
- package/src/CustomComponents/CRowAdd.js +0 -143
- package/src/CustomComponents/CSummaryDropDown.js +0 -327
- package/src/CustomComponents/CText.js +0 -9
- package/src/CustomComponents/CVectorIcon.js +0 -34
- package/src/CustomComponents/HtmlContentViewer.js +0 -65
- package/src/CustomComponents/PdfContentViewer.js +0 -90
- package/src/CustomComponents/SDropDownDosage.js +0 -1087
- package/src/CustomComponents/SwipableProductCard.js +0 -246
- package/src/CustomComponents/SwipableProductImageCard.js +0 -254
- package/src/CustomComponents/WorkOrderDetails.js +0 -1216
- package/src/CustomComponents/WorkOrderDetailsPage.js +0 -1213
- package/src/HOC/ConfirmOverlay.js +0 -192
- package/src/HOC/HHeading.js +0 -70
- package/src/HOC/HMoreButton.js +0 -88
- package/src/HOC/HNatureHeading.js +0 -402
- package/src/HOC/HOCIcons.js +0 -80
- package/src/HOC/HOverlayCentered.js +0 -140
- package/src/HOC/HShadowButton.js +0 -45
- package/src/HOC/HShadowCountButton.js +0 -82
- package/src/HOC/OptionOverlay.js +0 -48
- package/src/Json/Chart.json +0 -818
- package/src/Json/Consultation.json +0 -622
- package/src/Json/CreditBill.json +0 -490
- package/src/Json/Dropdown.json +0 -216
- package/src/Json/DropdownConsultation.json +0 -228
- package/src/Json/DynamicReports.json +0 -623
- package/src/Json/Footer.json +0 -79
- package/src/Media/AudioScreen.js +0 -342
- package/src/Media/BarcodeScan.js +0 -145
- package/src/Media/CAudioPlay.js +0 -228
- package/src/Media/CCaptureImageWithoutEdit.js +0 -330
- package/src/Media/CImageGallery.js +0 -289
- package/src/Media/CImageZoom.js +0 -82
- package/src/Media/CSingleImage.js +0 -391
- package/src/Media/CSketchCanvas.js +0 -76
- package/src/Media/CVideoPlay.js +0 -31
- package/src/Media/DocumentScreen.js +0 -362
- package/src/Media/DrawingScreen.js +0 -578
- package/src/Media/ImageScreen.js +0 -309
- package/src/Media/RecordAudio.js +0 -250
- package/src/Media/RecordVideo.js +0 -223
- package/src/Media/VideoScreen.js +0 -378
- package/src/Navigation/PageNavigation.js +0 -224
- package/src/Navigation/useFocusEffect.js +0 -2
- package/src/Navigation/useFocusEffect.native.js +0 -1
- package/src/Navigation/useFocusEffect.web.js +0 -1
- package/src/Navigation/useIsFocused.js +0 -1
- package/src/Navigation/useIsFocused.native.js +0 -1
- package/src/Navigation/useIsFocused.web.js +0 -1
- package/src/Navigation/useNavigation.js +0 -2
- package/src/Navigation/useNavigation.native.js +0 -1
- package/src/Navigation/useNavigation.web.js +0 -1
- package/src/Screens/CMedications.js +0 -528
- package/src/Screens/CWebViewGallery.js +0 -203
- package/src/Screens/ChartScan.js +0 -279
- package/src/Screens/ChartScreenNew.js +0 -1579
- package/src/Screens/Consultation.js +0 -1500
- package/src/Screens/Dashboard.js +0 -778
- package/src/Screens/FileExplorer.js +0 -288
- package/src/Screens/Footer.js +0 -340
- package/src/Screens/ForgotPassword.js +0 -288
- package/src/Screens/HeaderBlock.js +0 -353
- package/src/Screens/Login.js +0 -328
- package/src/Screens/Notification.js +0 -149
- package/src/Screens/OcrScreen.js +0 -20
- package/src/Screens/PdfPreview.js +0 -507
- package/src/Screens/RegistrationDetails.js +0 -467
- package/src/Screens/SearchScreen.js +0 -582
- package/src/Screens/Splash.js +0 -788
- package/src/Screens/SwipeLeftView.js +0 -1867
- package/src/StaticComponents/SAlphabet.js +0 -47
- package/src/StaticComponents/SCheckBox.js +0 -42
- package/src/StaticComponents/SDatePicker.js +0 -208
- package/src/StaticComponents/SDatePickerLabel.js +0 -253
- package/src/StaticComponents/SDatePickerNew.js +0 -258
- package/src/StaticComponents/SDateTimePickerNew.js +0 -381
- package/src/StaticComponents/SDropDownGenerate.js +0 -450
- package/src/StaticComponents/SDropDownHoc.js +0 -636
- package/src/StaticComponents/SDropDownIcon.js +0 -500
- package/src/StaticComponents/SMenuBox.js +0 -131
- package/src/StaticComponents/SOverlay.js +0 -177
- package/src/StaticComponents/SOverlayTextInput.js +0 -109
- package/src/StaticComponents/SSearch.js +0 -438
- package/src/StaticComponents/SSearchBar.js +0 -53
- package/src/StaticComponents/SSpeedDial.js +0 -303
- package/src/StaticComponents/STextInput.js +0 -289
- package/src/StaticComponents/STextInputProps.js +0 -36
- package/src/StaticComponents/STimePicker.js +0 -171
- package/src/StaticComponents/STimingDropDownNew.js +0 -1585
- package/src/StaticComponents/STimingSwitch.js +0 -34
- package/src/layout/CContainerView.js +0 -21
- package/src/layout/CDetailView.js +0 -81
- package/src/layout/HeaderBlock.js +0 -353
- package/src/layout/INVLoginLayout.js +0 -657
- package/src/layout/Loader.js +0 -176
package/src/Media/CAudioPlay.js
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, Image, Text, TouchableOpacity, StyleSheet, Platform, Dimensions } from 'react-native';
|
|
3
|
-
import Slider from '@react-native-community/slider';
|
|
4
|
-
import Sound from 'react-native-sound';
|
|
5
|
-
import { colors } from '../CommonStyle/commonStyle';
|
|
6
|
-
import ComponentStyles, { normalize } from '../CommonStyle/componentStyle';
|
|
7
|
-
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
8
|
-
|
|
9
|
-
export default class PlayerScreen extends React.Component {
|
|
10
|
-
static navigationOptions = props => ({
|
|
11
|
-
title: props.navigation.state.params.title,
|
|
12
|
-
});
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
this.state = {
|
|
16
|
-
playState: 'paused', //playing, paused
|
|
17
|
-
playSeconds: 0,
|
|
18
|
-
duration: 0,
|
|
19
|
-
};
|
|
20
|
-
this.sliderEditing = false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
componentDidMount() {
|
|
24
|
-
// this.play();
|
|
25
|
-
|
|
26
|
-
this.timeout = setInterval(() => {
|
|
27
|
-
if (this.sound && this.sound.isLoaded() && this.state.playState == 'playing' && !this.sliderEditing) {
|
|
28
|
-
this.sound.getCurrentTime((seconds, isPlaying) => {
|
|
29
|
-
this.setState({ playSeconds: seconds });
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}, 100);
|
|
33
|
-
}
|
|
34
|
-
componentWillUnmount() {
|
|
35
|
-
if (this.sound) {
|
|
36
|
-
this.sound.release();
|
|
37
|
-
this.sound = null;
|
|
38
|
-
}
|
|
39
|
-
if (this.timeout) {
|
|
40
|
-
clearInterval(this.timeout);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
onSliderEditStart = () => {
|
|
45
|
-
this.sliderEditing = true;
|
|
46
|
-
};
|
|
47
|
-
onSliderEditEnd = () => {
|
|
48
|
-
this.sliderEditing = false;
|
|
49
|
-
};
|
|
50
|
-
onSliderEditing = value => {
|
|
51
|
-
if (this.sound) {
|
|
52
|
-
this.sound.setCurrentTime(value);
|
|
53
|
-
this.setState({ playSeconds: value });
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
play = async () => {
|
|
57
|
-
if (this.sound) {
|
|
58
|
-
this.sound.play(this.playComplete);
|
|
59
|
-
this.setState({ playState: 'playing' });
|
|
60
|
-
} else {
|
|
61
|
-
const filepath = this.props.audio;
|
|
62
|
-
this.sound = new Sound(filepath,'', (error) => {
|
|
63
|
-
if (error) {
|
|
64
|
-
this.setState({ playState: 'paused' });
|
|
65
|
-
} else {
|
|
66
|
-
this.setState({ playState: 'playing', duration: this.sound.getDuration() });
|
|
67
|
-
this.sound.play(this.playComplete);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
playComplete = (success) => {
|
|
73
|
-
if (this.sound) {
|
|
74
|
-
if (success) {
|
|
75
|
-
} else {
|
|
76
|
-
}
|
|
77
|
-
this.setState({ playState: 'paused', playSeconds: 0 });
|
|
78
|
-
this.sound.setCurrentTime(0);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
pause = () => {
|
|
83
|
-
if (this.sound) {
|
|
84
|
-
this.sound.pause();
|
|
85
|
-
}
|
|
86
|
-
this.setState({ playState: 'paused' });
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
jumpPrev15Seconds = () => { this.jumpSeconds(-15); };
|
|
90
|
-
jumpNext15Seconds = () => { this.jumpSeconds(15); };
|
|
91
|
-
jumpSeconds = (secsDelta) => {
|
|
92
|
-
if (this.sound) {
|
|
93
|
-
this.sound.getCurrentTime((secs, isPlaying) => {
|
|
94
|
-
let nextSecs = secs + secsDelta;
|
|
95
|
-
if (nextSecs < 0) {nextSecs = 0;}
|
|
96
|
-
else if (nextSecs > this.state.duration) {nextSecs = this.state.duration;}
|
|
97
|
-
this.sound.setCurrentTime(nextSecs);
|
|
98
|
-
this.setState({ playSeconds: nextSecs });
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
getAudioTimeString(seconds) {
|
|
103
|
-
const h = parseInt(seconds / (60 * 60));
|
|
104
|
-
const m = parseInt(seconds % (60 * 60) / 60);
|
|
105
|
-
const s = parseInt(seconds % 60);
|
|
106
|
-
return ((h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s));
|
|
107
|
-
}
|
|
108
|
-
render() {
|
|
109
|
-
const currentTimeString = this.getAudioTimeString(this.state.playSeconds);
|
|
110
|
-
const durationString = this.getAudioTimeString(this.state.duration);
|
|
111
|
-
return (
|
|
112
|
-
<View style={layoutstyles.main_container}>
|
|
113
|
-
<View style={layoutstyles.main_child_container}>
|
|
114
|
-
{/* {this.props.component != undefined && this.props.component != null ?
|
|
115
|
-
<TouchableOpacity
|
|
116
|
-
onLongPress={() => this.props.deleterequest(this.props.component)}
|
|
117
|
-
style={layoutstyles.left_container}>
|
|
118
|
-
{this.props.component.hasOwnProperty("filestatus") && this.props.component.filestatus == 3 ?
|
|
119
|
-
<Image
|
|
120
|
-
source={{ uri: "https://cdn.iconscout.com/icon/premium/png-256-thumb/restore-3313724-2794064.png" }}
|
|
121
|
-
style={layoutstyles.delete_restore_icon}
|
|
122
|
-
/>
|
|
123
|
-
:
|
|
124
|
-
<Image
|
|
125
|
-
source={{ uri: "https://cdn.iconscout.com/icon/premium/png-256-thumb/restore-3313724-2794064.png" }}
|
|
126
|
-
style={layoutstyles.delete_restore_icon}
|
|
127
|
-
/>
|
|
128
|
-
}
|
|
129
|
-
</TouchableOpacity>
|
|
130
|
-
: null} */}
|
|
131
|
-
<View style={layoutstyles.right_container}>
|
|
132
|
-
<View style={layoutstyles.right_child_container}>
|
|
133
|
-
<TouchableOpacity
|
|
134
|
-
onPress={this.jumpPrev15Seconds}
|
|
135
|
-
style={ComponentStyles.View_col_center}
|
|
136
|
-
>
|
|
137
|
-
<FontAwesome name="rotate-left" size={25} />
|
|
138
|
-
</TouchableOpacity>
|
|
139
|
-
|
|
140
|
-
{this.state.playState == 'playing' &&
|
|
141
|
-
<TouchableOpacity onPress={this.pause}
|
|
142
|
-
style={layoutstyles.play_or_pause_container}
|
|
143
|
-
>
|
|
144
|
-
<FontAwesome name="pause" size={25} />
|
|
145
|
-
</TouchableOpacity>}
|
|
146
|
-
{this.state.playState == 'paused' &&
|
|
147
|
-
<TouchableOpacity onPress={this.play}
|
|
148
|
-
style={layoutstyles.play_or_pause_container}>
|
|
149
|
-
<FontAwesome name="play" size={25} />
|
|
150
|
-
</TouchableOpacity>}
|
|
151
|
-
<TouchableOpacity onPress={this.jumpNext15Seconds}
|
|
152
|
-
style={ComponentStyles.View_col_center}>
|
|
153
|
-
<FontAwesome name="rotate-right" size={25} />
|
|
154
|
-
</TouchableOpacity>
|
|
155
|
-
</View>
|
|
156
|
-
<View style={layoutstyles.slider_bar_container}>
|
|
157
|
-
<Text style={layoutstyles.duration_text}>
|
|
158
|
-
{currentTimeString}</Text>
|
|
159
|
-
<Slider
|
|
160
|
-
onTouchStart={this.onSliderEditStart}
|
|
161
|
-
onTouchEnd={this.onSliderEditEnd}
|
|
162
|
-
onValueChange={this.onSliderEditing}
|
|
163
|
-
value={this.state.playSeconds} maximumValue={this.state.duration}
|
|
164
|
-
maximumTrackTintColor={colors.color_audio_minimumTrackTintColor}
|
|
165
|
-
minimumTrackTintColor={colors.color_audio_maximumTrackTintColor} thumbTintColor={colors.color_audio_maximumTrackTintColor}
|
|
166
|
-
style={layoutstyles.slider_bar_style}
|
|
167
|
-
/>
|
|
168
|
-
<Text style={layoutstyles.duration_text}>
|
|
169
|
-
{durationString}
|
|
170
|
-
</Text>
|
|
171
|
-
</View>
|
|
172
|
-
</View>
|
|
173
|
-
</View>
|
|
174
|
-
</View>
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const layoutstyles = StyleSheet.create({
|
|
180
|
-
main_container: {
|
|
181
|
-
width: Dimensions.get('window').width * 0.7,
|
|
182
|
-
marginLeft:10,
|
|
183
|
-
},
|
|
184
|
-
slider_bar_style: {
|
|
185
|
-
flex: 1, alignSelf: 'center',
|
|
186
|
-
marginHorizontal: Platform.select({ ios: 5 }),
|
|
187
|
-
},
|
|
188
|
-
main_child_container: {
|
|
189
|
-
backgroundColor:'#DAF0FF',
|
|
190
|
-
padding: 5,
|
|
191
|
-
borderColor: colors.color_componentBordercolor, borderWidth: 0.5,
|
|
192
|
-
marginTop: Dimensions.get('window').height * 0.005,
|
|
193
|
-
borderRadius: 7,
|
|
194
|
-
justifyContent: 'center',
|
|
195
|
-
width: Dimensions.get('window').width * 0.7,
|
|
196
|
-
justifyContent: 'center', flexDirection: 'row',
|
|
197
|
-
},
|
|
198
|
-
right_container: {
|
|
199
|
-
flex: 5,
|
|
200
|
-
},
|
|
201
|
-
delete_restore_icon: {
|
|
202
|
-
width: 50, height: 50, margin: 5, alignSelf: 'center',
|
|
203
|
-
},
|
|
204
|
-
right_child_container: {
|
|
205
|
-
flexDirection: 'row', justifyContent: 'center', marginVertical: 5,
|
|
206
|
-
},
|
|
207
|
-
left_container: {
|
|
208
|
-
flex: 1, justifyContent: 'center', alignItems: 'center',
|
|
209
|
-
},
|
|
210
|
-
duration_text: {
|
|
211
|
-
color: 'black', alignSelf: 'center', fontSize: normalize(10),
|
|
212
|
-
},
|
|
213
|
-
slider_bar_container: {
|
|
214
|
-
marginVertical: 2, marginHorizontal: 2, flexDirection: 'row',
|
|
215
|
-
paddingRight: Dimensions.get('window').width * 0.02,
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
jumpleft_or_right_icon: {
|
|
219
|
-
width: 30, height: 30,
|
|
220
|
-
},
|
|
221
|
-
play_or_pause_container: {
|
|
222
|
-
marginHorizontal: 20, marginLeft: 25, marginRight: 25,
|
|
223
|
-
},
|
|
224
|
-
play_or_pause_icon: {
|
|
225
|
-
width: 35, height: 35,
|
|
226
|
-
},
|
|
227
|
-
});
|
|
228
|
-
|
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Dimensions, Text } from 'react-native';
|
|
3
|
-
import ComponentStyles, { normalize } from '../CommonStyle/componentStyle';
|
|
4
|
-
import { isBNUL, isNU, isNUQ, notifyMessage } from '../CommonStyle/ComponentFunctions';
|
|
5
|
-
import HeaderBlock from '../Screens/HeaderBlock';
|
|
6
|
-
import { useNavigation } from '../Navigation/useNavigation';
|
|
7
|
-
import { Camera, getCameraDevice, useCameraDevices, useCameraFormat, useCodeScanner } from 'react-native-vision-camera';
|
|
8
|
-
import CFooterView from '../CustomComponents/CFooterView';
|
|
9
|
-
import { Global } from '../../../../../src/Common/Global';
|
|
10
|
-
import HOCIcons from '../HOC/HOCIcons';
|
|
11
|
-
import PhotoEditor from 'react-native-photo-editor';
|
|
12
|
-
|
|
13
|
-
export default function CCaptureImageWithoutEdit(props) {
|
|
14
|
-
|
|
15
|
-
const [cameraType, setCameraType] = useState();
|
|
16
|
-
const [showCamera, setShowCamera] = useState(false);
|
|
17
|
-
const navigation = useNavigation();
|
|
18
|
-
const vcamera = useRef(null);
|
|
19
|
-
const vdevices = Camera.getAvailableCameraDevices();
|
|
20
|
-
const [vdevice, setVDevice] = useState();
|
|
21
|
-
// for video recording
|
|
22
|
-
const [isRecording, setIsRecording] = useState(false); // New state for recording
|
|
23
|
-
const [videoPath, setVideoPath] = useState(''); // To store the video path when recording is stopped
|
|
24
|
-
|
|
25
|
-
const codeScanner = useCodeScanner({
|
|
26
|
-
|
|
27
|
-
codeTypes: ['qr', 'ean-13','code-128','code-39','code-93'],
|
|
28
|
-
onCodeScanned: (codes) => {
|
|
29
|
-
if ((props.route?.params?.cameramoduletype == 2) && isBNUL(codes) && isNUQ(codes[0].value)) {
|
|
30
|
-
props.route.params.onSelect({
|
|
31
|
-
data: codes[0].value,
|
|
32
|
-
});
|
|
33
|
-
navigation.pop();
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
async function getPermission() {
|
|
40
|
-
const newCameraPermission = await Camera.requestCameraPermission();
|
|
41
|
-
if (newCameraPermission == 'granted') {
|
|
42
|
-
let cameraAngle = props.route?.params?.cameratype ? props.route?.params?.cameratype : 'back';
|
|
43
|
-
setCameraType(cameraAngle);
|
|
44
|
-
setVDevice(getCameraDevice(vdevices, cameraAngle));
|
|
45
|
-
setShowCamera(true);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
getPermission();
|
|
49
|
-
}, [vdevices]);
|
|
50
|
-
|
|
51
|
-
function getCameraType(params, vdevices) {
|
|
52
|
-
|
|
53
|
-
if (params == 'back') {
|
|
54
|
-
console.log('getCameraType1111', params);
|
|
55
|
-
setCameraType('front');
|
|
56
|
-
setVDevice(getCameraDevice(vdevices, 'front'));
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
console.log('getCameraType 222', params);
|
|
60
|
-
setCameraType('back');
|
|
61
|
-
setVDevice(getCameraDevice(vdevices, 'back'));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const capturePhoto = async () => {
|
|
66
|
-
if (vcamera.current !== null) {
|
|
67
|
-
|
|
68
|
-
const photo = await vcamera.current.takePhoto({
|
|
69
|
-
// qualityPrioritization: 'quality', // prioritize photo quality
|
|
70
|
-
// maxWidth: 640, // Decrease the width for lower resolution
|
|
71
|
-
// maxHeight: 480, // D
|
|
72
|
-
});
|
|
73
|
-
const photopath = `file://${photo.path}`;
|
|
74
|
-
// let imgPath = photopath.replace('file:///', '');
|
|
75
|
-
let fileName = photopath.substr(photopath.lastIndexOf('/') + 1);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
PhotoEditor.Edit({
|
|
79
|
-
path: photo.path, hiddenControls: ['sticker', 'save'],
|
|
80
|
-
onDone: () => {
|
|
81
|
-
props.route.params.onSelect({
|
|
82
|
-
uri: photopath,
|
|
83
|
-
filename: fileName,
|
|
84
|
-
filetype: 'image/jpeg',
|
|
85
|
-
});
|
|
86
|
-
navigation.pop();
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// props.route.params.onSelect({
|
|
91
|
-
// uri: `file://${photo.path}`,
|
|
92
|
-
// filename: fileName,
|
|
93
|
-
// filetype: "image/jpeg",
|
|
94
|
-
// });
|
|
95
|
-
// navigation.pop();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const startRecording = async () => {
|
|
100
|
-
if (vcamera.current) {
|
|
101
|
-
try {
|
|
102
|
-
setIsRecording(true);
|
|
103
|
-
const video = await vcamera.current.startRecording({
|
|
104
|
-
onRecordingFinished: (uri) => {
|
|
105
|
-
setVideoPath(uri.path);
|
|
106
|
-
console.log('videoPath real ........', uri);
|
|
107
|
-
props.route.params.onSelect({
|
|
108
|
-
uri: `file://${uri.path}`,
|
|
109
|
-
filename: `${new Date().toISOString()}.mp4`,
|
|
110
|
-
filetype: 'video/mp4',
|
|
111
|
-
});
|
|
112
|
-
// console.log('videoPath............', videoPath);
|
|
113
|
-
navigation.pop();
|
|
114
|
-
},
|
|
115
|
-
onRecordingError: (error) => {
|
|
116
|
-
console.error(error);
|
|
117
|
-
setIsRecording(false);
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
} catch (error) {
|
|
121
|
-
console.error('Error starting video recording:', error);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const stopRecording = async () => {
|
|
127
|
-
if (vcamera.current) {
|
|
128
|
-
try {
|
|
129
|
-
setIsRecording(false);
|
|
130
|
-
await vcamera.current.stopRecording();
|
|
131
|
-
} catch (error) {
|
|
132
|
-
console.error('Error stopping video recording:', error);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const format = useCameraFormat(vdevice, [
|
|
138
|
-
{
|
|
139
|
-
photoResolution: { width: 640, height: 480 },
|
|
140
|
-
},
|
|
141
|
-
]);
|
|
142
|
-
|
|
143
|
-
// { videoResolution: { width: 3048, height: 2160 } },
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
<View style={{ flex: 1 }}>
|
|
148
|
-
<HeaderBlock
|
|
149
|
-
/>
|
|
150
|
-
<View style={[layoutstyles.container]}>
|
|
151
|
-
{vdevice != null && showCamera ? (
|
|
152
|
-
<View style={{ flex: 1, borderWidth: 1 }}>
|
|
153
|
-
<Camera
|
|
154
|
-
ref={vcamera}
|
|
155
|
-
style={StyleSheet.absoluteFill}
|
|
156
|
-
device={vdevice}
|
|
157
|
-
// format={format}
|
|
158
|
-
isActive={showCamera}
|
|
159
|
-
photo={true}
|
|
160
|
-
codeScanner={codeScanner}
|
|
161
|
-
video={props.route?.params?.cameramoduletype === 1}
|
|
162
|
-
// format={''}
|
|
163
|
-
// videoBitRate={'extra-low'}
|
|
164
|
-
onInitialized={() => {
|
|
165
|
-
console.log('camera initialized.');
|
|
166
|
-
}}
|
|
167
|
-
/>
|
|
168
|
-
</View>
|
|
169
|
-
) : (
|
|
170
|
-
|
|
171
|
-
<View style={{ justifyContent: 'center', alignItems: 'center', flex: 1, borderWidth: 1 }}>
|
|
172
|
-
<Text>{'Camera Permission required.'}</Text>
|
|
173
|
-
</View>
|
|
174
|
-
)}
|
|
175
|
-
</View>
|
|
176
|
-
{
|
|
177
|
-
props.route?.params?.hidebuttons ?
|
|
178
|
-
null :
|
|
179
|
-
<CFooterView>
|
|
180
|
-
{isNU(cameraType) && isNU(vdevices) ?
|
|
181
|
-
<View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
|
|
182
|
-
<View style={{ flex: 2 }} />
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
{/* Start/Stop Video Recording Button */}
|
|
186
|
-
{props.route?.params?.cameramoduletype === 1 ?
|
|
187
|
-
<View style={{ borderWidth: 0, flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
188
|
-
<TouchableOpacity
|
|
189
|
-
onPress={() => {
|
|
190
|
-
if (isRecording) {
|
|
191
|
-
stopRecording();
|
|
192
|
-
} else {
|
|
193
|
-
startRecording();
|
|
194
|
-
}
|
|
195
|
-
}}
|
|
196
|
-
style={{
|
|
197
|
-
opacity: 1,
|
|
198
|
-
borderRadius: 100,
|
|
199
|
-
borderLeftWidth: 2,
|
|
200
|
-
borderBottomWidth: 2,
|
|
201
|
-
borderColor: Global.AppTheme.primary_color,
|
|
202
|
-
borderWidth: 0.5,
|
|
203
|
-
justifyContent: 'center',
|
|
204
|
-
alignItems: 'center',
|
|
205
|
-
margin: normalize(5),
|
|
206
|
-
height: normalize(60),
|
|
207
|
-
width: normalize(60),
|
|
208
|
-
backgroundColor: isRecording ? 'red' : 'white',
|
|
209
|
-
elevation: 2,
|
|
210
|
-
}}>
|
|
211
|
-
<HOCIcons.Icons
|
|
212
|
-
icongroup={5}
|
|
213
|
-
name={isRecording ? 'stop' : 'video'}
|
|
214
|
-
color={isRecording ? 'white' : Global.AppTheme.primary_color}
|
|
215
|
-
size={normalize(30)} style={{
|
|
216
|
-
marginHorizontal: normalize(3),
|
|
217
|
-
}}
|
|
218
|
-
/>
|
|
219
|
-
|
|
220
|
-
</TouchableOpacity>
|
|
221
|
-
<Text adjustsFontSizeToFit style={{
|
|
222
|
-
fontSize: normalize(8),
|
|
223
|
-
color: Global.AppTheme.primary_color,
|
|
224
|
-
textAlign: 'center',
|
|
225
|
-
fontWeight: 'bold',
|
|
226
|
-
}} >
|
|
227
|
-
{isRecording ? 'Stop' : 'Record'}
|
|
228
|
-
</Text>
|
|
229
|
-
</View>
|
|
230
|
-
:
|
|
231
|
-
<View style={{ borderWidth: 0, flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
232
|
-
<TouchableOpacity
|
|
233
|
-
onPress={() => {
|
|
234
|
-
capturePhoto();
|
|
235
|
-
}}
|
|
236
|
-
style={{
|
|
237
|
-
opacity: 1,
|
|
238
|
-
borderRadius: 100,
|
|
239
|
-
borderLeftWidth: 2,
|
|
240
|
-
borderBottomWidth: 2,
|
|
241
|
-
borderColor: Global.AppTheme.primary_color,
|
|
242
|
-
borderWidth: 0.5,
|
|
243
|
-
justifyContent: 'center',
|
|
244
|
-
alignItems: 'center',
|
|
245
|
-
margin: normalize(5),
|
|
246
|
-
height: normalize(60),
|
|
247
|
-
width: normalize(60),
|
|
248
|
-
backgroundColor: 'white',
|
|
249
|
-
elevation: 2,
|
|
250
|
-
}}>
|
|
251
|
-
<HOCIcons.Icons
|
|
252
|
-
icongroup={5}
|
|
253
|
-
name={'camera'}
|
|
254
|
-
color={Global.AppTheme.primary_color}
|
|
255
|
-
size={normalize(22)} style={{
|
|
256
|
-
marginHorizontal: normalize(3),
|
|
257
|
-
}}
|
|
258
|
-
/>
|
|
259
|
-
|
|
260
|
-
</TouchableOpacity>
|
|
261
|
-
<Text adjustsFontSizeToFit style={{
|
|
262
|
-
fontSize: normalize(8),
|
|
263
|
-
color: Global.AppTheme.primary_color,
|
|
264
|
-
textAlign: 'center',
|
|
265
|
-
fontWeight: 'bold',
|
|
266
|
-
}} >
|
|
267
|
-
{'Capture'}
|
|
268
|
-
</Text>
|
|
269
|
-
</View>
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
<View style={{ justifyContent: 'center', alignItems: 'center', flex: 2 }}>
|
|
273
|
-
{isRecording ?
|
|
274
|
-
null :
|
|
275
|
-
<>
|
|
276
|
-
<TouchableOpacity
|
|
277
|
-
onPress={() => {
|
|
278
|
-
getCameraType(cameraType, vdevices);
|
|
279
|
-
}}
|
|
280
|
-
style={{
|
|
281
|
-
opacity: 1,
|
|
282
|
-
borderRadius: 100,
|
|
283
|
-
borderLeftWidth: 2,
|
|
284
|
-
borderBottomWidth: 2,
|
|
285
|
-
borderColor: Global.AppTheme.primary_color,
|
|
286
|
-
borderWidth: 0.5,
|
|
287
|
-
justifyContent: 'center',
|
|
288
|
-
alignItems: 'center',
|
|
289
|
-
margin: normalize(5),
|
|
290
|
-
height: normalize(45),
|
|
291
|
-
width: normalize(45),
|
|
292
|
-
backgroundColor: 'white',
|
|
293
|
-
elevation: 2,
|
|
294
|
-
}}>
|
|
295
|
-
<HOCIcons.Icons
|
|
296
|
-
icongroup={2}
|
|
297
|
-
name={'flip-camera-ios'}
|
|
298
|
-
color={Global.AppTheme.primary_color}
|
|
299
|
-
size={normalize(22)} style={{
|
|
300
|
-
marginHorizontal: normalize(3),
|
|
301
|
-
}}
|
|
302
|
-
/>
|
|
303
|
-
|
|
304
|
-
</TouchableOpacity>
|
|
305
|
-
<Text adjustsFontSizeToFit style={{
|
|
306
|
-
fontSize: normalize(7),
|
|
307
|
-
color: Global.AppTheme.primary_color,
|
|
308
|
-
textAlign: 'center',
|
|
309
|
-
fontWeight: 'bold',
|
|
310
|
-
}} >
|
|
311
|
-
{'Rotate'}
|
|
312
|
-
</Text>
|
|
313
|
-
</>
|
|
314
|
-
}
|
|
315
|
-
</View>
|
|
316
|
-
</View>
|
|
317
|
-
: null}
|
|
318
|
-
</CFooterView>
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
</View>
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const layoutstyles = StyleSheet.create({
|
|
326
|
-
container: {
|
|
327
|
-
flex: 1,
|
|
328
|
-
flexDirection: 'column',
|
|
329
|
-
},
|
|
330
|
-
});
|