No Description

config.js 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. function isUrl(str){
  26. return str.startsWith('http');
  27. }
  28. var e=function(e,n,t){if(n=n.replace(/^on/g,""),"addEventListener"in window)e.addEventListener(n,t,!1);else if("attachEvent"in window)e.attachEvent("on"+n,t);else{var o=e["on"+n];e["on"+n]=o?function(e){o(e),t(e)}:t}return e},n=document.querySelectorAll("a[href]");if(n)for(var t in n)n.hasOwnProperty(t)&&e(n[t],"onclick",function(e){!isUrl(this.href)||(e.preventDefault(),window.postMessage(JSON.stringify({url:this.href})))})
  29. }();
  30. `;
  31. const autoHeightScript = `
  32. var styleElement = document.createElement('style');
  33. styleElement.innerHTML = '${style1
  34. .replace(/\'/g, "\\'")
  35. .replace(/\n/g, '\\n')}';
  36. document.head.appendChild(styleElement);
  37. document.body.style.background = 'cornflowerblue';
  38. `;
  39. const autoWidthHtml0 = `
  40. <html>
  41. <head>
  42. <meta name="viewport" content="target-densitydpi=device-dpi, initial-scale=1.0, user-scalable=no" />
  43. </head>
  44. <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;zoom:1;font-size: 21px;line-height: 1.58;letter-spacing: -.003em;">hey</p>
  45. </html>
  46. `;
  47. const autoWidthHtml1 = `
  48. <p style="display: inline;background-color: transparent !important;">easy</p>
  49. `;
  50. const autoWidthScript = `
  51. var styleElement = document.createElement('style');
  52. styleElement.innerHTML = '${style1
  53. .replace(/\'/g, "\\'")
  54. .replace(/\n/g, '\\n')}';
  55. document.head.appendChild(styleElement);
  56. `;
  57. export {
  58. autoHeightHtml0,
  59. autoHeightHtml1,
  60. style0,
  61. autoHeightScript,
  62. autoWidthHtml0,
  63. autoWidthHtml1,
  64. autoWidthScript,
  65. inlineBodyStyle,
  66. autoDetectLinkScript
  67. };