react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[TextInput] Supply access to UITextView.inputAccessoryView attribute on <TextInput />

Open ghost opened this issue 11 years ago • 101 comments

It would be cool to have this to make sticky text inputs.

(t21661353)

ghost avatar Mar 27 '15 22:03 ghost

Yes definitely - this is how we built parts of the comment input in the Groups app. Hopefully we'll be able to clean it up soon and release it to you guys.

sahrens avatar Mar 28 '15 20:03 sahrens

@sahrens do you have code you could throw over the wall that I could take a pass at cleaning up?

ide avatar May 12 '15 07:05 ide

@sahrens - this would be great to see, this seems to be a highly requested feature

brentvatne avatar May 31 '15 18:05 brentvatne

I'll take a look at what we have.

On May 31, 2015, at 11:25 AM, Brent Vatne [email protected] wrote:

@sahrens - this would be great to see, this seems to be a highly requested feature

— Reply to this email directly or view it on GitHub.

sahrens avatar Jun 01 '15 16:06 sahrens

Was there any luck with this? @sahrens , @auser (https://github.com/facebook/react-native/issues/1190)?

irfaan avatar Jul 14 '15 18:07 irfaan

+1 for solving this

tpisto avatar Jul 28 '15 22:07 tpisto

Not yet, but would be a good idea to get back on this...

auser avatar Jul 30 '15 20:07 auser

I have an initial implementation in progress that is not quite ready yet. When I get it working, I'll gist it. I'm currently working on it as a component (outside of the main repo), but will plan on making it a pull req when it is functional. Also... the API might need some help...

auser avatar Aug 01 '15 22:08 auser

+1

LeoFidjeland avatar Aug 11 '15 16:08 LeoFidjeland

+1

OpakAlex avatar Aug 25 '15 12:08 OpakAlex

+1

alancmclean avatar Aug 31 '15 15:08 alancmclean

Sounds great, @auser - looking forward to that PR ;)

sahrens avatar Sep 04 '15 02:09 sahrens

I've been playing around with tying an inputAccessoryView with RN. One thing I immediately noticed is that when using the navigator component, keyboard dismissal isn't as clean as with UINavigationController. An example of the regular behavior:

keyboard-slideaway

Notice how the keyboard slides away in tandem with the view as the controller is popped? Using the navigator component, there's no direct correlation and so the keyboard stays in place (or slides downward if you preemptively dismiss). The reason why I bring this up is because when using an InputAccessoryView, this difference becomes much more amplified, because the content of the view is usually much more scene-specific than the generic keyboard.

Any suggestions? I looked all over the groups app, and couldn't find a place where the navigation slides in a way that would reveal this issue.

sjmueller avatar Sep 05 '15 05:09 sjmueller

cc @ericvicenti @hedgerwang @ide - interesting point raised above by @sjmueller

also cc @boourns - maybe your team could look at this too :)

brentvatne avatar Sep 10 '15 17:09 brentvatne

Great point and quite tricky I believe. Since we don't want to use UINavigationController and UIViewController we're going to need to move the keyboard ourselves. Should be possible by getting the UIWindow that contains the keyboard and applying a transform to it. Certainly yet another thing to consider for Navigator scenes.

ide avatar Sep 10 '15 20:09 ide

Agreed, this will be very tricky. Even if we have the ability to animate the keyboard from RN, the off-thread operation will cause the keyboard animation to lag.

@javache, any idea if we can add hooks to animate the keyboard from RN?

cc @sahrens for the main-thread animation concerns

ericvicenti avatar Sep 10 '15 21:09 ericvicenti

Yeah, messy. Native animations won't handle this any time soon. Might be worth some custom native hook to link the keyboard to a view based on react node handle? On Sep 10, 2015 2:13 PM, "Eric Vicenti" [email protected] wrote:

Agreed, this will be very tricky. Even if we have the ability to animate the keyboard from RN, the off-thread operation will cause the keyboard animation to lag.

@javache https://github.com/javache, any idea if we can add hooks to animate the keyboard from RN?

cc @sahrens https://github.com/sahrens for the main-thread animation concerns

— Reply to this email directly or view it on GitHub https://github.com/facebook/react-native/issues/371#issuecomment-139380634 .

sahrens avatar Sep 11 '15 05:09 sahrens

We have an inputAccessoryView prototype internally that would solve this problem, but there were some concerns about performance that have stopped us from shipping it. I'll see if we can revisit that.

nicklockwood avatar Sep 11 '15 12:09 nicklockwood

@nicklockwood, curious what approach is used with the fb prototype? Like @ide says, there's no UINavigationController and UIViewController with the Navigator component, so it'd be interesting to learn about the way you're currently solving the challenge.

sjmueller avatar Sep 11 '15 20:09 sjmueller

If it's easier to make it work with NavigatorIOS then let's have that first, please. It's a show stopper in apps that take numeric input for the user not to be able to signal "done" explicitly.

+1

Update: I just finished adding a nice co-animated 'done' button above the numeric keypad, but it took me two days to perfect it and make it work across all screen resolutions. It's a big hole in React Native's functionality. It's such a basic must have feature.

idibidiart avatar Sep 21 '15 19:09 idibidiart