App.tsx 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
  3. *
  4. * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  5. * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  6. * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  7. * This notice may not be removed from this file.
  8. */
  9. import React, { Component } from 'react';
  10. import { Image, TouchableOpacity } from 'react-native';
  11. import { ComPDFKit } from '@compdfkit_pdf_sdk/react_native';
  12. import { NavigationContainer } from '@react-navigation/native';
  13. import { createNativeStackNavigator } from '@react-navigation/native-stack';
  14. import HomeScreen from './src/screens/HomeScreen';
  15. import CPDFReaderViewExampleScreen from './src/CPDFReaderViewExample';
  16. import SettingScreen from './src/screens/SettingScreen';
  17. const Stack = createNativeStackNavigator();
  18. type Props = {
  19. navigation: any;
  20. };
  21. export default class App extends Component<Props> {
  22. constructor(props: Props) {
  23. super(props)
  24. this.initialize()
  25. }
  26. async initialize() {
  27. // Online certification, Fill in your online license
  28. // Returns true if initialization is successful, otherwise returns false.
  29. // var result = await ComPDFKit.initialize('NjYzODcyYTMxOWQzMA==', 'NjYzODcyYTgxM2YwNg==')
  30. // console.log("ComPDFKitRN", "initialize:", result)
  31. // Offline authentication, Fill in your offline license
  32. var result = await ComPDFKit.init_('jkqgDbjmu/wZnFWVRjEjvZ97oJE65uEurW3WqNaVyhFj1HXmeFsxUATQn4p0HYABrjJkvsZ8lbP1w/h/XpNuEHBYscDEUOdJO4wvY9/rKRb6Cizo1016AAzPEkY5m9l+nF4sfx1xf6VTCjhBEwHjo8uu+804VbZSIskn58mcHg0RcsydGYfQyYGf2ec7ZgSRa6Af+rd7De833kbPx2XI8G1YtXCltFfuQSXgYhE48o8BrAIwRLUMxXtMiVvzOBsR7YpYWNmZopopr5Gl9bLsvOK/VNDzHxGaDUg3CspTydlcJqangWZwi/i/SAdyHAVEZDmx8yshp4ts7fM2ore1m2u0lH1oY17eVN2TRW5amzqSj1QR5Q0MX/v2nFNCjvJImeroTsMiyvSO5KjU5Zrs50NckPDhF4Jmjsjb0LXK/bRpxkkuyEYFaz4564aaZEovVo8qwJUkIDPadcRz3j1bMwrqiQMhyGL/CLyGlIiYGkjTdTyNMMHpYPUwPldrVMX4inb9KYdgJggKiH4aXNda34I5yuEfzFxlh8twdPhV7TyiUlFC5mg1ZXVW4rENlJxGheVfNI+5KOfueczv6umprFKusrOsv3g1BSw+mmRndsOcha/6QKMJHwnrDE1N2OTENH0a2YGMI+IdylVlk9Belz0e7qXSW2p6XVnGIzVa12xNGYjQV4tC0mUG8KeUljNpyqd6jdpA0bccj7S1aoN5ky53LuaWx/EZdW9UM3uuB/gJwbizOgM1HWwN4k+xh/zqL3M8AoJo5yXAPiYfIQoS3E1LqRj/dyR3uQhMlfCCGsA=')
  33. console.log("ComPDFKitRN", "init_:", result)
  34. }
  35. render() {
  36. return (
  37. <NavigationContainer>
  38. <Stack.Navigator>
  39. <Stack.Screen name="Home" component={HomeScreen} options={({ navigation }) => ({
  40. title: 'ComPDFKit PDF SDK for ReactNative',
  41. headerStyle: {
  42. backgroundColor: '#FAFCFF',
  43. },
  44. headerTitleStyle: { fontSize: 16 },
  45. headerRight: () => (
  46. <TouchableOpacity onPress={() => navigation.navigate('Settings')}>
  47. <Image source={require('./assets/ic_setting.png')} style={{ width: 24, height: 24 }} />
  48. </TouchableOpacity>
  49. ),
  50. })} />
  51. <Stack.Screen name='Settings' component={SettingScreen} options={{
  52. headerStyle: {
  53. backgroundColor: '#FAFCFF',
  54. },
  55. }}/>
  56. <Stack.Screen name='CPDFReaderViewExample' component={CPDFReaderViewExampleScreen} options={{
  57. headerShadowVisible: false,
  58. headerTitleStyle: { fontSize: 16 },
  59. headerStyle: {
  60. backgroundColor: '#FAFCFF',
  61. },
  62. }} />
  63. </Stack.Navigator>
  64. </NavigationContainer>
  65. );
  66. }
  67. }