File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,23 @@ class PdfScanner extends React.Component<PdfScannerProps> {
8484 }
8585 }
8686
87+ componentDidUpdate ( prevProps : PdfScannerProps ) {
88+ if ( Platform . OS === 'android' ) {
89+ if ( this . props . onPictureTaken !== prevProps . onPictureTaken ) {
90+ if ( prevProps . onPictureTaken )
91+ DeviceEventEmitter . removeListener ( 'onPictureTaken' , prevProps . onPictureTaken )
92+ if ( this . props . onPictureTaken )
93+ DeviceEventEmitter . addListener ( 'onPictureTaken' , this . props . onPictureTaken )
94+ }
95+ if ( this . props . onProcessing !== prevProps . onProcessing ) {
96+ if ( prevProps . onProcessing )
97+ DeviceEventEmitter . removeListener ( 'onProcessingChange' , prevProps . onProcessing )
98+ if ( this . props . onProcessing )
99+ DeviceEventEmitter . addListener ( 'onProcessingChange' , this . props . onProcessing )
100+ }
101+ }
102+ }
103+
87104 componentWillUnmount ( ) {
88105 if ( Platform . OS === 'android' ) {
89106 const { onPictureTaken, onProcessing } = this . props
You can’t perform that action at this time.
0 commit comments