V0.66/naman/android scrollview fix#1
Open
urbanclap-admin wants to merge 126 commits into
Open
Conversation
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,
},
});
```
…oftware-mansion#1508) ## 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 (software-mansion#1511) - Bump react-native from 0.64.0 to 0.64.1 in /examples/Example (software-mansion#1510) - Bump react-native from 0.64.0 to 0.64.1 (software-mansion#1509) - Bump color-string from 1.5.3 to 1.5.5 in /docs (software-mansion#1499) - Bump y18n from 4.0.0 to 4.0.3 (software-mansion#1498) - Bump y18n from 3.2.1 to 3.2.2 in /ci/e2e (software-mansion#1497) - Bump postcss from 7.0.32 to 7.0.36 in /docs (software-mansion#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
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>
Change onEnd callback to be called only when the gesture finishes in the ACTIVE state. Add onFinalize callback to all gestures. It's called whenever the gestures finishes, if the gesture transitions from ACTIVE state, it will be called after onEnd. This allows for simpler logic in callbacks, as onEnd can rely on logic in onStart, and onFinalize can rely on logic in onBegin.
Bump version to 2.1.0 Create docs for 2.1.0
This PR renames all occurrences of master to main in order to achieve a smooth default branch rename. Only changes in .github/workflows are necessary but I've also changed the documentation to make all the links consistent with the new naming.
Use path relative to the directory of Reanimated when checking its version.
…oftware-mansion#1768) Also check major version of Reanimated alongside minor to avoid missing interface declaration with Reanimated 1.
Correct spelling in quickstart.md
Remove onTouchesChange callback from documentation. Update arguments for touch events callbacks.
Update last step to make use of `onFinalize`. Update link to the example in Quick Start to point at the main branch. Fix a typo.
Update names of configuration methods to match those in code.
…1795) On Android when a handler is waiting for failure of another it activates as without this restriction but is prevented from sending updates and receiving touch stream until the other handler fails. Because of this, there may be a large difference between the event that caused activation, and the event delivered after failure of other handler, which is visible in the events sent by the handler. This PR adds logic responsible for resetting the progress of a handler after the "fake" activation when waiting ends, making the behavior consistent with iOS.
At the moment some types from Gesture Handler 2.0 are exported using export keyword, which causes warnings on web since the types are stripped. This PR replaces it with export type which should fix the problem.
This PR adds `onChange` callback to continuous gestures. This callback is called just after `onUpdate` and carries additional information - change of value since the last event: For PanGesture: `changeX`, `changeY` - additive difference in translation For PinchGesture: `scaleChange` - multiplicative difference in scale For RotationGesture: `rotationChange` - additive difference in rotation For ForceTouchGesture: `forceChange` - additive difference in force
…screen (software-mansion#1812) This PR changes how absolute position of events is calculated to be relative to the window instead of the screen. This makes it consistent with iOS and takes status bar and split-screen mode into account when calculating it.
This PR changes Orchestrator in a way that the `UNDETERMINED` -> `CANCELLED` state change event would not be sent. Before introduction of touch events such change couldn't occur, but now it's possible to activate the gesture at the moment the finger touches the screen. Events are delivered to handlers sequentially, so it may happen that handlers next in line would get cancelled before receiving the first event (thus before they can initialize). If this doesn't result in a crash, then the `UNDETERMINED` to `CANCELLED` state change event will be sent, triggering `onFinalize` callback without calling `onBegin` first.
Call `onChange` in `eventReceiver` just after `onUpdate` to make it work without Reanimated.
On Android when a handler awaiting another one tries to activate its state is changed to ACTIVE but event with that change is delayed until the other finishes. If the awaiting handler were to fail before that happens, state change event with information about its failure would not be sent. This PR adds a workaround that sends state change event when the handler is active internally but still awaiting another one.
On Android touch events are sent before other events. This causes problems when the gesture is activated in the onTouchesDown callback. The gesture then goes from UNDETERMINED state to ACTIVE before it has a change to process the first event. For example, if done with PanGesture, the translation would start with values equal to the coordinates of the pointer. This PR adds a workaround that sends the first touch event (which would be TOUCH_DOWN) only after the handler has processed the event (making sure the handler is initialized correctly, and UNDETERMINED -> BEGAN state change event is sent).
* Add version 2.1.1 in docs * Bump version to 2.2.0
…mpileIssues fix sdk33 Kotlin compiler issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Test plan