Advertisement
Guest User

ELMO

a guest
May 18th, 2022
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.04 KB | None | 0 0
  1. // Package.json
  2.  
  3. {
  4. "name": "elvismobile",
  5. "version": "0.0.1",
  6. "private": true,
  7. "scripts": {
  8. "android": "react-native run-android",
  9. "ios": "react-native run-ios",
  10. "start": "react-native start",
  11. "test": "jest",
  12. "lint": "eslint ."
  13. },
  14. "dependencies": {
  15. "@react-native-async-storage/async-storage": "^1.17.4",
  16. "@react-native-community/datetimepicker": "^6.1.3",
  17. "@react-native-community/push-notification-ios": "^1.10.1",
  18. "@react-native-firebase/app": "^14.9.4",
  19. "@react-native-firebase/messaging": "^14.9.4",
  20. "@react-native-picker/picker": "^2.4.1",
  21. "@react-navigation/bottom-tabs": "^6.3.1",
  22. "@react-navigation/native": "^6.0.10",
  23. "@react-navigation/native-stack": "^6.6.2",
  24. "axios": "^0.27.2",
  25. "formik": "^2.2.9",
  26. "moment": "^2.29.3",
  27. "react": "17.0.2",
  28. "react-native": "0.68.2",
  29. "react-native-actions-sheet": "^0.6.0",
  30. "react-native-animatable": "^1.3.3",
  31. "react-native-banner-carousel": "^1.0.3",
  32. "react-native-blob-util": "^0.14.0",
  33. "react-native-calendars": "^1.1274.0",
  34. "react-native-collapsible": "^1.6.0",
  35. "react-native-currency-input": "^1.0.1",
  36. "react-native-customisable-alert": "^0.1.20",
  37. "react-native-document-picker": "^7.1.3",
  38. "react-native-easy-grid": "^0.2.2",
  39. "react-native-element-dropdown": "^1.5.9",
  40. "react-native-flash-message": "^0.2.0",
  41. "react-native-geolocation-service": "^5.3.0-beta.4",
  42. "react-native-gesture-handler": "^2.1.0",
  43. "react-native-image-zoom-viewer-fixed": "^3.2.5",
  44. "react-native-keyboard-aware-scroll-view": "^0.9.5",
  45. "react-native-modal": "^13.0.1",
  46. "react-native-modal-datetime-picker": "^13.0.1",
  47. "react-native-month-year-picker": "^1.8.0",
  48. "react-native-pdf": "^6.4.0",
  49. "react-native-push-notification": "^8.1.1",
  50. "react-native-ratings-fix": "^6.5.8",
  51. "react-native-responsive-fontsize": "^0.5.1",
  52. "react-native-responsive-screen": "^1.4.2",
  53. "react-native-safe-area-context": "^3.3.2",
  54. "react-native-screens": "^3.12.0",
  55. "react-native-select-two": "^1.1.0",
  56. "react-native-signature-canvas": "^4.3.0",
  57. "react-native-svg": "^12.1.1",
  58. "react-native-svg-transformer": "^0.14.3",
  59. "react-native-text-input-mask": "^3.1.4",
  60. "react-native-unlock-slider": "^1.0.6",
  61. "react-native-vector-icons": "^9.0.0",
  62. "react-native-webview": "^11.16.0",
  63. "react-redux": "^7.2.6",
  64. "redux": "^4.1.2",
  65. "redux-persist": "^6.0.0",
  66. "redux-thunk": "^2.4.1",
  67. "rn-fetch-blob": "^0.12.0",
  68. "rn-select-date-range": "^3.2.2",
  69. "yup": "^0.32.11"
  70. },
  71. "devDependencies": {
  72. "@babel/core": "^7.12.9",
  73. "@babel/runtime": "^7.12.5",
  74. "@react-native-community/eslint-config": "^2.0.0",
  75. "babel-jest": "^26.6.3",
  76. "eslint": "^7.32.0",
  77. "jest": "^26.6.3",
  78. "metro-react-native-babel-preset": "^0.67.0",
  79. "react-test-renderer": "17.0.2"
  80. },
  81. "jest": {
  82. "preset": "react-native"
  83. }
  84. }
  85.  
  86.  
  87.  
  88. // App.js
  89.  
  90. // In App.js in a new project
  91.  
  92. import React, {useEffect} from 'react';
  93. import {Provider} from 'react-redux';
  94. import {store, persistor} from './redux/helpers/store';
  95. import {PersistGate} from 'redux-persist/integration/react';
  96. import {NavigationContainer} from '@react-navigation/native';
  97. import {Platform, StatusBar, Text, View} from 'react-native';
  98. import FlashMessage from 'react-native-flash-message';
  99. import Router from './router';
  100. import PushNotification from 'react-native-push-notification';
  101. import {notifAlert} from './utils';
  102. import AsyncStorage from '@react-native-async-storage/async-storage';
  103.  
  104. function App() {
  105. const storeData = async token => {
  106. try {
  107. await AsyncStorage.setItem('device_token', token);
  108. } catch (error) {}
  109. };
  110.  
  111. useEffect(() => {
  112. StatusBar.setBarStyle('light-content');
  113. if (Platform.OS === 'android') {
  114. StatusBar.setBackgroundColor('rgba(0,0,0,0.1)');
  115. StatusBar.setTranslucent(true);
  116. }
  117.  
  118. PushNotification.configure({
  119. // (optional) Called when Token is generated (iOS and Android)
  120. onRegister: function (token) {
  121. storeData(token.token);
  122. },
  123.  
  124. // (required) Called when a remote is received or opened, or local notification is opened
  125. onNotification: function (notification) {
  126. console.log('NOTIFICATION:', notification);
  127. if (notification.hasOwnProperty('channelId')) {
  128. notifAlert(notification.data.title, notification.data.body);
  129. }
  130. },
  131.  
  132. // (optional) Called when Registered Action is pressed and invokeApp is false, if true onNotification will be called (Android)
  133. onAction: function (notification) {
  134. console.log('ACTION:', notification.action);
  135. console.log('NOTIFICATION:', notification);
  136.  
  137. // process the action
  138. },
  139.  
  140. // (optional) Called when the user fails to register for remote notifications. Typically occurs when APNS is having issues, or the device is a simulator. (iOS)
  141. onRegistrationError: function (err) {
  142. console.error(err.message, err);
  143. },
  144.  
  145. // IOS ONLY (optional): default: all - Permissions to register.
  146. permissions: {
  147. alert: true,
  148. badge: true,
  149. sound: true,
  150. },
  151.  
  152. senderID: '916470534384',
  153. popInitialNotification: true,
  154. requestPermissions: true,
  155. });
  156.  
  157. PushNotification.createChannel(
  158. {
  159. channelId: 'approval-notification', // (required)
  160. channelName: 'Approval Notification', // (required)
  161. channelDescription: 'A Notification for Approval', // (optional) default: undefined.
  162. },
  163. () => {}, // (optional) callback returns whether the channel was created, false means it already existed.
  164. );
  165. }, []);
  166.  
  167. return (
  168. <NavigationContainer>
  169. <StatusBar />
  170. <Provider store={store}>
  171. <PersistGate loading={null} persistor={persistor}>
  172. <Router />
  173. </PersistGate>
  174. </Provider>
  175. <FlashMessage position="top" />
  176. </NavigationContainer>
  177. );
  178. }
  179.  
  180. export default App;
  181.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement