No Description

config.js 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. 'use strict';
  2. const autoHeightHtml0 = `<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>`;
  3. 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".`;
  4. const style0 = `
  5. p {
  6. font-family: sans-serif;
  7. padding: 50px;
  8. box-sizing: border-box;
  9. }
  10. `;
  11. const style1 = `
  12. p {
  13. font-size: 12px !important;
  14. box-sizing: border-box;
  15. }
  16. `;
  17. const inlineBodyStyle = `
  18. body {
  19. display: inline-block;
  20. }
  21. `;
  22. // https://medium.com/@elhardoum/opening-external-links-in-browser-in-react-native-webview-18fe6a66312a
  23. const autoDetectLinkScript = `
  24. (function() {
  25. var links = document.querySelectorAll('a[href]');
  26. if (links) {
  27. for (var index = 0; index < links.length; index++) {
  28. links[index].addEventListener('click', function(event) {
  29. event.preventDefault();
  30. window.ReactNativeWebView.postMessage(JSON.stringify({ url: this.href }));
  31. });
  32. }
  33. }
  34. })();
  35. `;
  36. const autoHeightScript = `
  37. var styleElement = document.createElement('style');
  38. styleElement.innerHTML = '${style1.replace(/\'/g, "\\'").replace(/\n/g, '\\n')}';
  39. document.head.appendChild(styleElement);
  40. document.body.style.background = 'cornflowerblue';
  41. `;
  42. const autoWidthHtml0 = `
  43. <html>
  44. <head>
  45. <meta name="viewport" content="target-densitydpi=device-dpi, initial-scale=1.0, user-scalable=no" />
  46. </head>
  47. <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>
  48. </html>
  49. `;
  50. const autoWidthHtml1 = `
  51. <p style="display: inline;background-color: transparent !important;">easy</p>
  52. `;
  53. const autoWidthScript = `
  54. var styleElement = document.createElement('style');
  55. styleElement.innerHTML = '${style1.replace(/\'/g, "\\'").replace(/\n/g, '\\n')}';
  56. document.head.appendChild(styleElement);
  57. `;
  58. export {
  59. autoHeightHtml0,
  60. autoHeightHtml1,
  61. style0,
  62. autoHeightScript,
  63. autoWidthHtml0,
  64. autoWidthHtml1,
  65. autoWidthScript,
  66. inlineBodyStyle,
  67. autoDetectLinkScript
  68. };