Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
El formato de cadena/n no funciona React Native/webview

Uso webview para agregar un editor a mi aplicación. El contenido se guarda dentro de la variable Contenido:

 <script> function update() { var idoc = document.getElementById('iframe').contentWindow.document; idoc.open(); idoc.write(editor.getValue()); idoc.close(); } let Content= ""; ...

Empujo el texto predeterminado a la variable de editor/Contenido a través de JavaScript inyectado:

 <WebView ref={(r) => (webref = r)} androidHardwareAccelerationDisabled={true} scalesPageToFit={false} scrollEnabled={false} source={{ html }} injectedJavaScript={props.defaultContent} onMessage={(event) => { console.log("EVENT-DATA:", event); Content(event.nativeEvent.data); }} />

JavaScript inyectado obtiene el contenido predeterminado del editor de accesorios, que se ve así:

 let defaultEditorContent = `Content += "I am a super long string and I love it!" editor.setValue(Content , 1); `;

Todo lo anterior funciona bien. Sin embargo, no puedo formatear la cadena "¡Soy una cadena súper larga y me encanta!".

Si agrego manualmente el formato de esta manera, no se muestra ningún texto:

 "I am a super long string and I love it!"

Si uso \n \n\ tampoco se muestra texto:

 "I am a super long string /n/ and I love it!"

¿Algunas ideas?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Esto ayudará a su respuesta,

 let defaultEditorContent = ` Content = \`<h1 id ="ali">Hello World! \n </h1>\`; editor.setValue(Content , 1); `;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!