wix-incubator / react-native-zss-rich-text-editor

React Native rich text editor based on ZSSRichTextEditor
Other
841 stars 310 forks source link

Can't focus on Android #108

Closed ethanyuwang closed 5 years ago

ethanyuwang commented 6 years ago

I initialized a fresh react native project ("react-native": "0.55.4",) and copied the example code. However on Android focusTitle and focusContent both don't work

---------------------------Update--------------------------------

focusContent would not work initially. However, after I actually tap the editor to focus and then programmatically blur it, focusContent would work as expected.

rasselll commented 6 years ago

if your targetSDKVersion is greater than 24, seems like it wont work

cherniv commented 6 years ago

Doesnt work for me even with targetSDKVersion = 24

jeffie commented 6 years ago

have a solution now?

ethanyuwang commented 6 years ago

@rasselll I have targetSdkVersion = 22 and it doesn't work

ethanyuwang commented 6 years ago

Any updates?

saurabhabh commented 5 years ago

Any Updates?

saurabhabh commented 5 years ago

Just a quick update I noticed that because of my other styles this was not working properly. I made changes to them and it worked. Hint: Check your styling.

ethanyuwang commented 5 years ago

@saurabhabh what styling changes did you make?

saurabhabh commented 5 years ago

https://github.com/wix/react-native-zss-rich-text-editor/issues/138#issuecomment-441521534 - @ethanyuwang Check this comment. Check your flex direction. It only works for me if the parent container's flex direction is set to column.

eladgel commented 5 years ago

Here is our solution: @ethanyuwang

win

ethanyuwang commented 5 years ago

@eladgel Can I ask you what changes you made in your fork?

eladgel commented 5 years ago

@ethanyuwang just go to the fork and view the changed files

ethanyuwang commented 5 years ago

@eladgel Thanks a lot I have made mine working, but it seems like you only need to change WebViewBridgeManager.java in react-native-webview-bridge though? This is what I did:

  1. Add new prop requestFocus in react-native-webview-bridge:

    screen shot 2019-01-22 at 4 58 07 pm
  2. Add the prop in where you render RichTextEditor as you mentioned:

    screen shot 2019-01-22 at 4 59 38 pm
ethanyuwang commented 5 years ago

@eladgel I have added the RNKeyboard module from your reply but I found having it or not, focusing works properly on Android with just the two steps in my previous post.