Ei kuvausta

config.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. 'use strict';
  2. import newsletter from "./newsletter";
  3. const autoHeightHtml0 = newsletter; //`<p style="font-weight: 400;font-style: normal;font-size: 21px;line-height: 1.58;letter-spacing: -.003em;"><a href="https://github.com/iou90/react-native-autoheight-webview">Tags</a> are great for describing the essence of your story in a single word or phrase, but stories are rarely about a single thing. <span style="background-color: transparent !important;background-image: linear-gradient(to bottom, rgba(146, 249, 190, 1), rgba(146, 249, 190, 1));">If I pen a story about moving across the country to start a new job in a car with my husband, two cats, a dog, and a tarantula, I wouldn't only tag the piece with "moving". I’d also use the <a href="http://x-squad.com">tags</a> "pets", "marriage", "career change", and "travel tips".</span></p>`;
  4. const autoHeightHtml1 = `Tags are great for describing the essence of your story in a single word or phrase, but stories are rarely about a single thing. If I pen a story about moving across the country to start a new job in a car with my husband, two cats, a dog, and a tarantula, I wouldn’t only tag the piece with "moving".`;
  5. const style0 = `
  6. p {
  7. font-family: sans-serif;
  8. padding: 50px;
  9. box-sizing: border-box;
  10. }
  11. `;
  12. const style1 = `
  13. p {
  14. font-size: 12px !important;
  15. box-sizing: border-box;
  16. }
  17. `;
  18. const inlineBodyStyle = `
  19. @font-face {
  20. font-family: ae_AlArabiya;
  21. src:url("ae_AlArabiya.ttf");
  22. }
  23. body {
  24. font-family: ae_AlArabiya;
  25. display: inline-block;
  26. }
  27. `;
  28. // https://medium.com/@elhardoum/opening-external-links-in-browser-in-react-native-webview-18fe6a66312a
  29. const autoDetectLinkScript = `
  30. (function() {
  31. var links = document.querySelectorAll('a[href]');
  32. if (links) {
  33. for (var index = 0; index < links.length; index++) {
  34. links[index].addEventListener('click', function(event) {
  35. event.preventDefault();
  36. window.ReactNativeWebView.postMessage(JSON.stringify({ url: this.href }));
  37. });
  38. }
  39. }
  40. })();
  41. `;
  42. const autoHeightScript = `
  43. var styleElement = document.createElement('style');
  44. styleElement.innerHTML = '${style1.replace(/\'/g, "\\'").replace(/\n/g, '\\n')}';
  45. document.head.appendChild(styleElement);
  46. document.body.style.background = 'cornflowerblue';
  47. `;
  48. const autoWidthHtml0 = `
  49. <html>
  50. <head>
  51. <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  52. </head>
  53. <p class="localStyle" style="display: inline;background-color: transparent !important;background-image: linear-gradient(to bottom, rgba(146, 249, 190, 1), rgba(146, 249, 190, 1));font-style: normal;font-size: 21px;line-height: 1.58;letter-spacing: -.003em;padding-top:0;padding-bottom:0;">hey</p>
  54. </html>
  55. `;
  56. const autoWidthHtml1 = `
  57. <p style="display: inline;background-color: transparent !important;">easy</p>
  58. `;
  59. const autoWidthScript = `
  60. var styleElement = document.createElement('style');
  61. styleElement.innerHTML = '${style1.replace(/\'/g, "\\'").replace(/\n/g, '\\n')}';
  62. document.head.appendChild(styleElement);
  63. `;
  64. export {
  65. autoHeightHtml0,
  66. autoHeightHtml1,
  67. style0,
  68. autoHeightScript,
  69. autoWidthHtml0,
  70. autoWidthHtml1,
  71. autoWidthScript,
  72. inlineBodyStyle,
  73. autoDetectLinkScript
  74. };