Skip to content

(Android) Allow disableOpenGesture right or left in the drawer#2189

Merged
guyca merged 4 commits into
wix:masterfrom
Fuhrmann:patch-2
Nov 22, 2017
Merged

(Android) Allow disableOpenGesture right or left in the drawer#2189
guyca merged 4 commits into
wix:masterfrom
Fuhrmann:patch-2

Conversation

@Fuhrmann
Copy link
Copy Markdown
Contributor

@Fuhrmann Fuhrmann commented Nov 19, 2017

Hello! This is my first pull request here so apologize if I made any mistakes. I'm working on my first React Native project and thought I could solve this problem that can happen to other people.

This pull request allows you to disable the open gesture only in one side of the drawer. In my current application, I want to have 2 drawers (on both sides). The left drawer is always enabled. The right drawer is only enabled in one screen.

This way I can startSingleScreenApp() and pass the two drawers, but only the left would be 'enabled':

Navigation.startSingleScreenApp({
      screen: initialScreen,
      drawer: {
        left: {
          screen: DRAWER_SCREEN,
          disableOpenGesture: false,
        },
        right: {
          screen: SIDEBAR_FILTER_SCREEN,
          disableOpenGesture: true,
        },
      },
    });

If we pass disableOpenGesture to the drawer root object, like this:

Navigation.startSingleScreenApp({
      screen: initialScreen,
      drawer: {
        left: {
          screen: DRAWER_SCREEN,
          disableOpenGesture: false,
        },
        right: {
          screen: SIDEBAR_FILTER_SCREEN,
          disableOpenGesture: true,
        },
        disableOpenGesture: true <======
      },
    });

Then the two drawer positions would be gesture disabled and the specific disableOpenGesture would be ignored.

What do you guys think?

Hello! This is my first pull request here so apologize if I made any mistakes. I'm working on my first React  Native project and thought I could solve this problem that can happen to other people.

This pull request allows you to disable the open gesture only in one side of the drawer. In my current application, I want to have 2 drawers (on both sides). The left drawer is always enabled. The right drawer is only enable in one screen.

This way I can startSingleScreenApp() and pass the two drawers, but only the left would be 'enabled':

```
Navigation.startSingleScreenApp({
      screen: initialScreen,
      drawer: {
        left: {
          screen: DRAWER_SCREEN,
          disableOpenGesture: false,
        },
        right: {
          screen: SIDEBAR_FILTER_SCREEN,
          disableOpenGesture: true,
        },
      },
    });
```

If we pass disableOpenGesture to the drawer root object, like this: 

```
Navigation.startSingleScreenApp({
      screen: initialScreen,
      drawer: {
        left: {
          screen: DRAWER_SCREEN,
          disableOpenGesture: false,
        },
        right: {
          screen: SIDEBAR_FILTER_SCREEN,
          disableOpenGesture: true,
        },
        disableOpenGesture: true <======
      },
    });
```

Then the two drawer positions would be gesture disabled and the specific disableOpenGesture would be ignored. This way we don`t introduce breaking changes.

What do you guys think?
@Fuhrmann Fuhrmann changed the title Allow disableOpenGesture right or left in the drawer (Android) Allow disableOpenGesture right or left in the drawer Nov 19, 2017
@guyca guyca self-assigned this Nov 21, 2017
@guyca
Copy link
Copy Markdown
Collaborator

guyca commented Nov 21, 2017

Thanks for the PR Ricardo, I'll get to it by the end of the week. Can you please update the docs as well?

@Fuhrmann
Copy link
Copy Markdown
Contributor Author

Hey @guyca, I`ve just updated the docs!

@guyca guyca merged commit 04a64d1 into wix:master Nov 22, 2017
thanhzusu pushed a commit to thanhzusu/react-native-navigation that referenced this pull request Nov 27, 2017
* master: (22 commits)
  setTabButton to change the label of the TabButton (wix#2215)
  3D Touch Preview API (wix#2186)
  Update android-specific-use-cases.md
  Update android-specific-use-cases.md
  Load props from props registry for redux screens
  Nav bar save props (wix#2211)
  Support passing unserializable props to custom navBar component
  Save buttons props for root screens
  Ensure that styles set on individual buttons are not overridden (wix#2200)
  Update top-level-api.md
  (Android) Allow disableOpenGesture right or left in the drawer (wix#2189)
  Revert "Support iOS 11 prefersLargeTitles #1643 (wix#2090)" (wix#2204)
  Support iOS 11 prefersLargeTitles #1643 (wix#2090)
  Support passing unserializable props to custom button (wix#2192)
  addOnNavigatorEvent improvements (wix#2175)
  Fix missing props (wix#2179)
  Revert "Don't custom button props over the bridge (wix#2174)" (wix#2177)
  Don't custom button props over the bridge (wix#2174)
  Set missing TopBar background color
  Register multiple navigatorEventListeners (wix#2173)
  ...
garrettm pushed a commit to Ginger-Labs/react-native-navigation that referenced this pull request Dec 19, 2017
)

This pull request allows you to disable the open gesture only in one side of the drawer.

```
Navigation.startSingleScreenApp({
      screen: initialScreen,
      drawer: {
        left: {
          screen: DRAWER_SCREEN,
          disableOpenGesture: false,
        },
        right: {
          screen: SIDEBAR_FILTER_SCREEN,
          disableOpenGesture: true,
        },
      },
    });
```

If we pass disableOpenGesture to the drawer root object, like this: 

```
Navigation.startSingleScreenApp({
      screen: initialScreen,
      drawer: {
        left: {
          screen: DRAWER_SCREEN,
          disableOpenGesture: false,
        },
        right: {
          screen: SIDEBAR_FILTER_SCREEN,
          disableOpenGesture: true,
        },
        disableOpenGesture: true <======
      },
    });
```

Then the two drawer positions would be gesture disabled and the specific disableOpenGesture would be ignored. This way we don`t introduce breaking changes.
garrettm pushed a commit to Ginger-Labs/react-native-navigation that referenced this pull request Dec 19, 2017
)

This pull request allows you to disable the open gesture only in one side of the drawer.

```
Navigation.startSingleScreenApp({
      screen: initialScreen,
      drawer: {
        left: {
          screen: DRAWER_SCREEN,
          disableOpenGesture: false,
        },
        right: {
          screen: SIDEBAR_FILTER_SCREEN,
          disableOpenGesture: true,
        },
      },
    });
```

If we pass disableOpenGesture to the drawer root object, like this: 

```
Navigation.startSingleScreenApp({
      screen: initialScreen,
      drawer: {
        left: {
          screen: DRAWER_SCREEN,
          disableOpenGesture: false,
        },
        right: {
          screen: SIDEBAR_FILTER_SCREEN,
          disableOpenGesture: true,
        },
        disableOpenGesture: true <======
      },
    });
```

Then the two drawer positions would be gesture disabled and the specific disableOpenGesture would be ignored. This way we don`t introduce breaking changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants