Add drawerLockMode prop to DrawerLayoutAndroid

Summary:Closes #5270.
Closes https://github.com/facebook/react-native/pull/5534

Differential Revision: D2970771

fb-gh-sync-id: 36a814032283df7d4c469964f803b8d20d1b0c93
shipit-source-id: 36a814032283df7d4c469964f803b8d20d1b0c93
This commit is contained in:
Andreas Drivenes
2016-02-24 03:24:50 -08:00
committed by facebook-github-bot-7
parent 9ae3714f4b
commit ec173b1a17
2 changed files with 27 additions and 0 deletions

View File

@@ -76,6 +76,19 @@ public class ReactDrawerLayoutManager extends ViewGroupManager<ReactDrawerLayout
view.setDrawerWidth(widthInPx);
}
@ReactProp(name = "drawerLockMode")
public void setDrawerLockMode(ReactDrawerLayout view, @Nullable String drawerLockMode) {
if (drawerLockMode == null || "unlocked".equals(drawerLockMode)) {
view.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
} else if ("locked-closed".equals(drawerLockMode)) {
view.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
} else if ("locked-open".equals(drawerLockMode)) {
view.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
} else {
throw new JSApplicationIllegalArgumentException("Unknown drawerLockMode " + drawerLockMode);
}
}
@Override
public boolean needsCustomLayoutForChildren() {
// Return true, since DrawerLayout will lay out it's own children.