mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-09 22:43:10 +08:00
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:
committed by
facebook-github-bot-7
parent
9ae3714f4b
commit
ec173b1a17
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user