Add setNextFocus support (#22082)

Summary:
Add properties to be able to set the nextFocus. It can be very useful with Android TV.

New android View properties :

* nextFocusDown binded to [setNextFocusDownId](https://developer.android.com/reference/android/view/View.html#setNextFocusDownId(int))
* nextFocusForward binded to [setNextFocusForwardId](https://developer.android.com/reference/android/view/View.html#setNextFocusForwardId(int))
* nextFocusLeft binded to [setNextFocusLeftId](https://developer.android.com/reference/android/view/View.html#setNextFocusLeftId(int))
* nextFocusRight binded to [setNextFocusRightId](https://developer.android.com/reference/android/view/View.html#setNextFocusRightId(int))
* nextFocusUp binded to [setNextFocusUpId](https://developer.android.com/reference/android/view/View.html#setNextFocusUpId(int))

Can be used to fix :

* Fixes #20593
* Fixes #20100

Same PR as #22080 but accorded to changes on master
Pull Request resolved: https://github.com/facebook/react-native/pull/22082

Differential Revision: D14162740

Pulled By: cpojer

fbshipit-source-id: 9a13a185d4e8307ce67014fb076c62d135c487c3
This commit is contained in:
Grégoire Rit
2019-02-20 23:34:39 -08:00
committed by Facebook Github Bot
parent f8a4d281e2
commit c416b40542
6 changed files with 231 additions and 1 deletions
@@ -65,6 +65,31 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
}
}
@ReactProp(name = "nextFocusDown", defaultInt = View.NO_ID)
public void nextFocusDown(ReactViewGroup view, int viewId) {
view.setNextFocusDownId(viewId);
}
@ReactProp(name = "nextFocusForward", defaultInt = View.NO_ID)
public void nextFocusForward(ReactViewGroup view, int viewId) {
view.setNextFocusForwardId(viewId);
}
@ReactProp(name = "nextFocusLeft", defaultInt = View.NO_ID)
public void nextFocusLeft(ReactViewGroup view, int viewId) {
view.setNextFocusLeftId(viewId);
}
@ReactProp(name = "nextFocusRight", defaultInt = View.NO_ID)
public void nextFocusRight(ReactViewGroup view, int viewId) {
view.setNextFocusRightId(viewId);
}
@ReactProp(name = "nextFocusUp", defaultInt = View.NO_ID)
public void nextFocusUp(ReactViewGroup view, int viewId) {
view.setNextFocusUpId(viewId);
}
@ReactPropGroup(names = {
ViewProps.BORDER_RADIUS,
ViewProps.BORDER_TOP_LEFT_RADIUS,