@@ -100,7 +100,7 @@ class PSPDFKitView extends React.Component {
100100 if ( Platform . OS === "android" ) {
101101 UIManager . dispatchViewManagerCommand (
102102 findNodeHandle ( this . refs . pdfView ) ,
103- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . enterAnnotationCreationMode ,
103+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . enterAnnotationCreationMode ,
104104 [ ]
105105 ) ;
106106 } else if ( Platform . OS === "ios" ) {
@@ -117,7 +117,7 @@ class PSPDFKitView extends React.Component {
117117 if ( Platform . OS === "android" ) {
118118 UIManager . dispatchViewManagerCommand (
119119 findNodeHandle ( this . refs . pdfView ) ,
120- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . exitCurrentlyActiveMode ,
120+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . exitCurrentlyActiveMode ,
121121 [ ]
122122 ) ;
123123 } else if ( Platform . OS === "ios" ) {
@@ -134,7 +134,7 @@ class PSPDFKitView extends React.Component {
134134 if ( Platform . OS === "android" ) {
135135 UIManager . dispatchViewManagerCommand (
136136 findNodeHandle ( this . refs . pdfView ) ,
137- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . saveCurrentDocument ,
137+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . saveCurrentDocument ,
138138 [ ]
139139 ) ;
140140 } else if ( Platform . OS === "ios" ) {
@@ -165,7 +165,7 @@ class PSPDFKitView extends React.Component {
165165
166166 UIManager . dispatchViewManagerCommand (
167167 findNodeHandle ( this . refs . pdfView ) ,
168- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . getAnnotations ,
168+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . getAnnotations ,
169169 [ requestId , pageIndex , type ]
170170 ) ;
171171
@@ -188,7 +188,7 @@ class PSPDFKitView extends React.Component {
188188 if ( Platform . OS === "android" ) {
189189 UIManager . dispatchViewManagerCommand (
190190 findNodeHandle ( this . refs . pdfView ) ,
191- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . addAnnotation ,
191+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . addAnnotation ,
192192 [ annotation ]
193193 ) ;
194194 } else if ( Platform . OS === "ios" ) {
@@ -208,7 +208,7 @@ class PSPDFKitView extends React.Component {
208208 if ( Platform . OS === "android" ) {
209209 UIManager . dispatchViewManagerCommand (
210210 findNodeHandle ( this . refs . pdfView ) ,
211- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . removeAnnotation ,
211+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . removeAnnotation ,
212212 [ annotation ]
213213 ) ;
214214 } else if ( Platform . OS === "ios" ) {
@@ -236,7 +236,7 @@ class PSPDFKitView extends React.Component {
236236
237237 UIManager . dispatchViewManagerCommand (
238238 findNodeHandle ( this . refs . pdfView ) ,
239- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . getAllUnsavedAnnotations ,
239+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . getAllUnsavedAnnotations ,
240240 [ requestId ]
241241 ) ;
242242
@@ -257,7 +257,7 @@ class PSPDFKitView extends React.Component {
257257 if ( Platform . OS === "android" ) {
258258 UIManager . dispatchViewManagerCommand (
259259 findNodeHandle ( this . refs . pdfView ) ,
260- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . addAnnotations ,
260+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . addAnnotations ,
261261 [ annotations ]
262262 ) ;
263263 } else if ( Platform . OS === "ios" ) {
@@ -288,7 +288,7 @@ class PSPDFKitView extends React.Component {
288288
289289 UIManager . dispatchViewManagerCommand (
290290 findNodeHandle ( this . refs . pdfView ) ,
291- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . getFormFieldValue ,
291+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . getFormFieldValue ,
292292 [ requestId , fullyQualifiedName ]
293293 ) ;
294294
@@ -311,7 +311,7 @@ class PSPDFKitView extends React.Component {
311311 if ( Platform . OS === "android" ) {
312312 UIManager . dispatchViewManagerCommand (
313313 findNodeHandle ( this . refs . pdfView ) ,
314- UIManager . getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . setFormFieldValue ,
314+ this . _getViewManagerConfig ( 'RCTPSPDFKitView' ) . Commands . setFormFieldValue ,
315315 [ fullyQualifiedName , value ]
316316 ) ;
317317 } else if ( Platform . OS === "ios" ) {
@@ -396,6 +396,15 @@ class PSPDFKitView extends React.Component {
396396 ) ;
397397 }
398398 } ;
399+
400+ _getViewManagerConfig = viewManagerName => {
401+ const version = NativeModules . PlatformConstants . reactNativeVersion . minor
402+ if ( version >= 58 ) {
403+ return UIManager . getViewManagerConfig ( viewManagerName ) ;
404+ } else {
405+ return UIManager [ viewManagerName ] ;
406+ }
407+ } ;
399408}
400409
401410PSPDFKitView . propTypes = {
0 commit comments