| 26 | import com.facebook.react.viewmanagers.RNPDFPdfViewManagerInterface; |
| 27 | |
| 28 | @ReactModule(name = PdfManager.REACT_CLASS) |
| 29 | public class PdfManager extends SimpleViewManager<PdfView> implements RNPDFPdfViewManagerInterface<PdfView> { |
| 30 | public static final String REACT_CLASS = "RNPDFPdfView"; |
| 31 | private Context context; |
| 32 | private PdfView pdfView; |
| 33 | private final ViewManagerDelegate<PdfView> mDelegate; |
| 34 | |
| 35 | @Nullable |
| 36 | @Override |
| 37 | protected ViewManagerDelegate<PdfView> getDelegate() { |
| 38 | return mDelegate; |
| 39 | } |
| 40 | |
| 41 | public PdfManager() { |
| 42 | mDelegate = new RNPDFPdfViewManagerDelegate<>(this); |
| 43 | } |
| 44 | |
| 45 | public PdfManager(ReactApplicationContext reactContext){ |
| 46 | this.context = reactContext; |
| 47 | mDelegate = new RNPDFPdfViewManagerDelegate<>(this); |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public String getName() { |
| 52 | return REACT_CLASS; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public PdfView createViewInstance(ThemedReactContext context) { |
| 57 | this.pdfView = new PdfView(context,null); |
| 58 | return pdfView; |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | public void onDropViewInstance(PdfView pdfView) { |
| 63 | pdfView = null; |
| 64 | } |
| 65 | |
| 66 | @ReactProp(name = "path") |
| 67 | public void setPath(PdfView pdfView, String path) { |
| 68 | pdfView.setPath(path); |
| 69 | } |
| 70 | |
| 71 | // page start from 1 |
| 72 | @ReactProp(name = "page") |
| 73 | public void setPage(PdfView pdfView, int page) { |
| 74 | pdfView.setPage(page); |
| 75 | } |
| 76 | |
| 77 | @ReactProp(name = "scale") |
| 78 | public void setScale(PdfView pdfView, float scale) { |
| 79 | pdfView.setScale(scale); |
| 80 | } |
| 81 | |
| 82 | @ReactProp(name = "minScale") |
| 83 | public void setMinScale(PdfView pdfView, float minScale) { |
| 84 | pdfView.setMinScale(minScale); |
| 85 | } |
nothing calls this directly
no outgoing calls
no test coverage detected