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

221
Views
El cambio de tamaño de fuente de la vista web nativa de React hace que el texto se propague fuera

Estoy creando una vista de resumen donde importo texto y uri dentro de un anuncio de vista web. Inyecto js para cambiar el tamaño, pero cuando lo hago, el texto sale de la vista web.

Así es como se carga el uri en la vista web:

Así es como se carga el uri en la vista web

y esto es lo que obtengo cuando cambio el tamaño de fuente:

ingrese la descripción de la imagen aquí

esta es la vista web:

 <WebView key={this.state.value} ref={webview => this.setState({WebViewRef:webview})} javaScriptEnabled={true} domStorageEnabled={true} scalesPageToFit={false} onLoadEnd={ this.setState({ visibleBack:false }) } automaticallyAdjustContentInsets={false} source={{ uri: `http://backend.iferu.com/cleanbook.php?idbook=${this.props.product.id}` }} style={{paddingLeft:15,height:this.state.webViewHeight ,width: Dimensions.get('window').width - 50}} key={this.state.key} injectedJavaScript={jsBeforeLoad} onMessage={this.onMessage} scrollEnabled={false} style={{ height : this.state.webViewHeight}} />

y este es el js que estoy inyectando para cambiar el tamaño de fuente:

 sendDataToWebView(){ let injectedData = ` // document.getElementsByTagName("body")[0].style.fontSize = '${this.state.fontSizeState}px'; $('#takeAways').css({ 'font-size':${this.state.fontSizeState}, }); $('#recomClass').css({ 'font-size':${this.state.fontSizeState} }); $('#summaryTitle').css({ 'font-size':${this.state.fontSizeState} }); $('#summaryText').css({ 'font-size':${this.state.fontSizeState} }); $('#auteurTitle').css({ 'font-size':${this.state.fontSizeState} }); $('#auteurText').css({ 'font-size':${this.state.fontSizeState} }); window.ReactNativeWebView.postMessage(Math.max(document.body.offsetHeight, document.body.scrollHeight)); `; this.state.WebViewRef.injectJavaScript(injectedData); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Solo sucede en Android (estoy trabajando en lo contrario, en realidad, para aumentar el tamaño de fuente de la vista web en iOS)

Pero si desea bloquear el tamaño de la fuente, puede usar la propiedad textZoom.

https://github.com/react-native-webview/react-native-webview/blob/master/docs/Reference.md#textZoom

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!