wxik / react-native-rich-editor

Lightweight React Native (JavaScript, H5) rich text editor
https://wxik.github.io/react-native-rich-editor/web
MIT License
803 stars 303 forks source link

Crash on android #225

Open khanh21011999 opened 2 years ago

khanh21011999 commented 2 years ago

App crash when i navigate to android from flatlist, i tried androidHardwareAccelerationDisabled but not work, please help

Version detail

   "react-native-webview": "^11.17.1",
   "react-native-pell-rich-editor": "^1.8.8",
   "react-native": "^0.67.1",

The code

 <RichEditor
            androidHardwareAccelerationDisabled
            editorInitializedCallback={() => {
              richText?.current?.setFontName("Montserrat");
            }}
            ref={richText}
            editorStyle={{
              cssText: fontEditor,
              contentCSSText: editorCss,
              // backgroundColor: color.backgroundGrey,
            }}
            onChange={(descriptionText) => {
              console.log("descriptionText:", descriptionText);
            }}
          />

Behavior

https://user-images.githubusercontent.com/37074707/151480856-bae059ae-c50f-432d-843f-2ae2c882d8dc.mov

zchbndcc9 commented 2 years ago

I recently started experiencing the same issue as well

anishmjn3 commented 2 years ago

I am also facing same issue

accompso-ltd commented 2 years ago

Same issue - was working this morning now stopped

mlecoq commented 2 years ago

I had the same issue, looking into sentry I have the following stack trace

Application Specific Information:
Segfault

Thread 0 Crashed:
0   libhwui.so                      0x732f63aadc        SkSurface::getCanvas
1   libhwui.so                      0x732f72a6bc        android::MinikinFontSkia::GetSkTypeface
2   libhwui.so                      0x732f60bd10        SkCanvas::onDrawDrawable
3   libhwui.so                      0x732f5f964c        SkPath::addRect
4   libhwui.so                      0x732f60bcac        SkCanvas::onDrawDrawable
5   libhwui.so                      0x732f5f964c        SkPath::addRect
6   libhwui.so                      0x732f60bcac        SkCanvas::onDrawDrawable
7   libhwui.so                      0x732f5f964c        SkPath::addRect
8   libhwui.so                      0x732f60bcac        SkCanvas::onDrawDrawable
9   libhwui.so                      0x732f5f964c        SkPath::addRect
10  libhwui.so                      0x732f60bcac        SkCanvas::onDrawDrawable
11  libhwui.so                      0x732f5f964c        SkPath::addRect
12  libhwui.so                      0x732f62cf90        SkCanvas::concat
13  libhwui.so                      0x732f63d1e8        GrRenderTargetContext::internalClear
14  libhwui.so                      0x732f63a5cc        GrBackendRenderTarget::~GrBackendRenderTarget
15  libhwui.so                      0x732f63a238        SkCanvas::drawPaint
16  libhwui.so                      0x732f68d0d0        SkString::appendf
17  libhwui.so                      0x732f68c28c        SkString::appendf

There is a known hack adding opacity: 0.99 to the style of the WebView. I have tried it and it works.

gabrielbuzziv commented 2 years ago
bhunaapandian commented 2 years ago

Add android:hardwareAccelerated="false" in AndroidManifest.xml

it worked for me!

KazakovVS commented 2 years ago

Instead of switching off the hardware acceleration globally, just passed 2 additional params to the component:

davidwico commented 2 years ago

Like @KazakovVS suggests, you can pass androidLayerType prop with software value to underlying web view:

<RichEditor
  androidLayerType="software"
  ...
/>

androidHardwareAccelerationDisabled is deprecated according to react-native-webview documentation, so there is no need to use it

Vigneshwaran-crypto commented 1 year ago

Thank You So Much @davidwico well worked On android 12

tyawei commented 7 months ago

Instead of switching off the hardware acceleration globally, just passed 2 additional params to the component:

  • androidLayerType="software"
  • androidHardwareAccelerationDisabled

this way may cause the rich text abnormally displays...especially you have a large amount of rich texts. for example, rich text may lose some or disappears

tyawei commented 7 months ago

you can try add this to WebView as a prop: style={[otherStyleObj, {opacity: 0.99}]}

starball5 commented 5 months ago

Related on Stack Overflow: React native react-native-pell-rich-editor crash on Android navigation to screen