react-native-rectangle-doc-scanner 3.75.0 → 3.76.0
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/package.json
CHANGED
|
@@ -21,6 +21,7 @@ class PdfScanner extends React.Component {
|
|
|
21
21
|
};
|
|
22
22
|
this.eventsSubscribed = false;
|
|
23
23
|
this.nativeRef = null;
|
|
24
|
+
this.nativeTag = null;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
onPermissionsDenied = () => {
|
|
@@ -131,7 +132,7 @@ class PdfScanner extends React.Component {
|
|
|
131
132
|
return Promise.reject(new Error('capture_not_supported'));
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
const nodeHandle = findNodeHandle(this.nativeRef);
|
|
135
|
+
const nodeHandle = this.nativeTag ?? findNodeHandle(this.nativeRef);
|
|
135
136
|
|
|
136
137
|
if (!nodeHandle) {
|
|
137
138
|
return Promise.reject(new Error('scanner_view_not_ready'));
|
|
@@ -154,12 +155,20 @@ class PdfScanner extends React.Component {
|
|
|
154
155
|
if (!this.state.permissionsAuthorized) {
|
|
155
156
|
return null;
|
|
156
157
|
}
|
|
158
|
+
const { onLayout, ...restProps } = this.props;
|
|
157
159
|
return (
|
|
158
160
|
<RNPdfScanner
|
|
159
161
|
ref={(ref) => {
|
|
160
162
|
this.nativeRef = ref;
|
|
163
|
+
this.nativeTag = ref ? findNodeHandle(ref) : null;
|
|
161
164
|
}}
|
|
162
|
-
{
|
|
165
|
+
onLayout={(event) => {
|
|
166
|
+
this.nativeTag = event?.nativeEvent?.target ?? this.nativeTag;
|
|
167
|
+
if (onLayout) {
|
|
168
|
+
onLayout(event);
|
|
169
|
+
}
|
|
170
|
+
}}
|
|
171
|
+
{...restProps}
|
|
163
172
|
onPictureTaken={this.sendOnPictureTakenEvent.bind(this)}
|
|
164
173
|
onRectangleDetect={this.sendOnRectanleDetectEvent.bind(this)}
|
|
165
174
|
useFrontCam={this.props.useFrontCam || false}
|