Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Conversation

guarani
Copy link

@guarani guarani commented Aug 5, 2021

Description

Sync with latest from upstream repository to keep fork up-to-date.

Test plan

This PR simply updates our master branch with the upstream repo's master branch. Testing will occur in a follow up PR.
After merging this PR, the next steps will be:

  • Create a feature branch off of this repo's master branch
  • Create a PR to merge the feature branch into this repo's wp-fork branch
  • Test this change using the Gutenberg Mobile app (point it to the changes on the feature branch)
  • Merge the PR which will result in wp-fork being up-to-date with the upstream repo
  • Tag the head of the wp-fork branch
  • Update the Gutenberg Mobile repo to point to the new tag

Andarius and others added 30 commits July 5, 2021 10:39
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.23.0 to 1.24.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](PrismJS/prism@v1.23.0...v1.24.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
On web, there are cases now in React 18 where componentWillUnmount gets called twice in a row. I think it is related to reactwg/react-18#31. This causes a No handler for tag error since the handler was cleaned up already in the first componentWillUnmount call.

To workaround the issue I added a check to no-op of the handler tag is not found. I think this is fine in that case and simpler than tracking whether the handler was cleaned up in the createHandler component.
Description

Added duration property to the LongPressGestureHandler events. This change allows checking how long the entire event lasted.

Test code

```js
import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';

import {
  LongPressGestureHandler,
  LongPressGestureHandlerStateChangeEvent,
} from 'react-native-gesture-handler';

export class PressBox extends Component {
  private onHandlerStateChange = (
    event: LongPressGestureHandlerStateChangeEvent
  ) => {
    console.log(`Duration: ${event.nativeEvent.duration}`);
  };

  render() {
    return (
      <LongPressGestureHandler
        onHandlerStateChange={this.onHandlerStateChange}
        minDurationMs={600}>
          <View style={styles.box} />
      </LongPressGestureHandler>
    );
  }
}

export default class Example extends Component {
  render() {
    return (
      <PressBox />
    );
  }
}

const styles = StyleSheet.create({
  box: {
    width: 150,
    height: 150,
    alignSelf: 'center',
    backgroundColor: 'plum',
    margin: 10,
    zIndex: 200,
  },
});
```
## Description

The change that this PR reverts was made to fix [this issue](osdnk/react-native-reanimated-bottom-sheet#15) ([which seems to be fixed already](osdnk/react-native-reanimated-bottom-sheet#150)). But by allowing the `PanGestureHandler` to transition from `BEGAN` to the `END` state it introduced a new problem: when a `TapGestureHandler` has a `waitFor` property set with a reference to a `PanGestureHandler` the `TapGestureHandler` will not activate.

Here is a quick summary of why it happens:

1. User touches the screen, `ACTION_DOWN` event is sent
2. Both `TapGestureHandler` and `PanGestureHandler` go to `BEGAN` state
3. User lifts the finger, `ACTION_UP` event is sent
4. `TapGestureHandler` tries to become active but has to wait for the `PanGestureHandler` to resolve
5. `PanGestureHandler` transitions to the `END` state
6. Because `PanGestureHandler` did not fail it is assumed it was recognized and all handlers waiting for it are cancelled

With this change at step 5. `PanGestureHandler` transitions to the `FAILED` state, and `TapGestureHandler` becomes active, which is expected behavior.

Besides that, [the original problem seems to be fixed in another way](osdnk/react-native-reanimated-bottom-sheet#150).

## Test plan

This code sample demonstrates the problem and allows to check the solution:
```js
import React, { Component } from 'react';
import { createRef } from 'react';
import { StyleSheet, View } from 'react-native';

import {
  TapGestureHandler,
  PanGestureHandler,
} from 'react-native-gesture-handler';

function getState(s: number) {
  switch (s) {
    case 0: return "Undetermined";
    case 1: return "Failed";
    case 2: return "Began";
    case 3: return "Cancelled";
    case 4: return "Active";
    case 5: return "End";
  }
  return s;
}
export default class Example extends Component {
  constructor(props: Record<string, never>) {
    super(props);

    this.panHandler = createRef<PanGestureHandler>();
  }

  render() {

    return (
      <PanGestureHandler
        onHandlerStateChange={(e) => console.log(`Pan: ${getState(e.nativeEvent.state)}`)}
        ref={this.panHandler}>
        
        <View style={styles.home}>
          <TapGestureHandler
            onHandlerStateChange={(e) => console.log(`Tap: ${getState(e.nativeEvent.state)}`)}
            waitFor={this.panHandler}>
            <View 
              style={styles.button} />
          </TapGestureHandler>
        </View>

      </PanGestureHandler>
    );
  }
}

const styles = StyleSheet.create({
  home: {
    width: '100%',
    height: '100%',
    alignSelf: 'center',
    backgroundColor: 'plum',
  },
  button: {
    width: 100,
    height: 100,
    backgroundColor: 'green',
    alignSelf: 'center',
  },
});
```
- Bump react-native from 0.61.2 to 0.62.3 in /ci/e2e (#1511)
- Bump react-native from 0.64.0 to 0.64.1 in /examples/Example (#1510)
- Bump react-native from 0.64.0 to 0.64.1 (#1509)
- Bump color-string from 1.5.3 to 1.5.5 in /docs (#1499)
- Bump y18n from 4.0.0 to 4.0.3 (#1498)
- Bump y18n from 3.2.1 to 3.2.2 in /ci/e2e (#1497)
- Bump postcss from 7.0.32 to 7.0.36 in /docs (#1485)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
`index of` was reading properties and indexes instead of reading only indexes which made the next line `const [key, value] = argMapping[index]` crash
react-native-gesture-handler doesn't work with react-native-windows 0.64+

The reason for this is that react-native-windows runs UIManager as a TurboModule internally, rather than a native module, so the way that react-native-gesture-handler attempts to get the UIManager ends up with an empty object.
Bumps [tar](https://github.com/npm/node-tar) from 6.0.5 to 6.1.4.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v6.0.5...v6.1.4)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Convert RootHelper to Kotlin

* Fix type errors

* Use template strings

* Move init block to the top

* Remove null checks

* Use apply

* Move context into ctor

* Rename members

* Refine scope functions

* Convert ViewConfigurationHelper to Kotlin

* Convert ConfigurationHelper to Kotlin

* Fix type errors in RootHelper

* Join declaration with assignment

* Make Views non-nullable

* Remove obsolete version checkk

* Gather when block

* Fix return type of overriden function

* Convert GestureUtils to Kotlin

* Use ranges

* Make ViewConfigurationHelper methods' returns non-nullable

* Invert condition
dependabot bot added 2 commits August 5, 2021 11:57
Bumps [tar](https://github.com/npm/node-tar) from 4.4.8 to 4.4.15.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v4.4.8...v4.4.15)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@guarani guarani changed the base branch from master to wp-fork August 5, 2021 22:55
@guarani guarani changed the base branch from wp-fork to master August 6, 2021 00:02
@guarani guarani marked this pull request as ready for review August 6, 2021 18:41
@twstokes twstokes self-requested a review August 6, 2021 18:50
@twstokes
Copy link

twstokes commented Aug 6, 2021

LGTM @guarani.

@guarani guarani merged commit 806472f into wordpress-mobile:master Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants