mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Merge pull request #29125 from Esemesek/master
[react-native ]Changed event handler types
This commit is contained in:
commit
adf4e18eef
15
types/react-native/index.d.ts
vendored
15
types/react-native/index.d.ts
vendored
@ -13,6 +13,7 @@
|
||||
// Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Alexander T. <https://github.com/a-tarasyuk>
|
||||
// Martin van Dam <https://github.com/mvdam>
|
||||
// Kacper Wiszczuk <https://github.com/esemesek>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@ -4810,7 +4811,7 @@ export interface ModalPropsIOS {
|
||||
* The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed.
|
||||
* The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation.
|
||||
*/
|
||||
onOrientationChange?: (event?: NativeSyntheticEvent<any>) => void;
|
||||
onOrientationChange?: (event: NativeSyntheticEvent<any>) => void;
|
||||
}
|
||||
|
||||
export interface ModalPropsAndroid {
|
||||
@ -6301,27 +6302,27 @@ export interface ScrollViewProps
|
||||
* Fires at most once per frame during scrolling.
|
||||
* The frequency of the events can be contolled using the scrollEventThrottle prop.
|
||||
*/
|
||||
onScroll?: (event?: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
|
||||
/**
|
||||
* Fires if a user initiates a scroll gesture.
|
||||
*/
|
||||
onScrollBeginDrag?: (event?: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
onScrollBeginDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
|
||||
/**
|
||||
* Fires when a user has finished scrolling.
|
||||
*/
|
||||
onScrollEndDrag?: (event?: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
onScrollEndDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
|
||||
/**
|
||||
* Fires when scroll view has finished moving
|
||||
*/
|
||||
onMomentumScrollEnd?: (event?: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
onMomentumScrollEnd?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
|
||||
/**
|
||||
* Fires when scroll view has begun moving
|
||||
*/
|
||||
onMomentumScrollBegin?: (event?: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
onMomentumScrollBegin?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||
|
||||
/**
|
||||
* When true the scroll view stops on multiples of the scroll view's size
|
||||
@ -8484,7 +8485,7 @@ export namespace Animated {
|
||||
|
||||
type Mapping = { [key: string]: Mapping } | AnimatedValue;
|
||||
interface EventConfig<T> {
|
||||
listener?: (event?: NativeSyntheticEvent<T>) => void;
|
||||
listener?: (event: NativeSyntheticEvent<T>) => void;
|
||||
useNativeDriver?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@ -63,6 +63,7 @@ import {
|
||||
InputAccessoryView,
|
||||
StatusBar,
|
||||
NativeSyntheticEvent,
|
||||
NativeScrollEvent,
|
||||
GestureResponderEvent,
|
||||
TextInputScrollEventData,
|
||||
TextInputSelectionChangeEventData,
|
||||
@ -388,7 +389,14 @@ export class CapsLockComponent extends React.Component<TextProps> {
|
||||
}
|
||||
}
|
||||
|
||||
class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListViewDataSource }> {
|
||||
class ScrollerListComponentTest extends React.Component<
|
||||
{},
|
||||
{ dataSource: ListViewDataSource }
|
||||
> {
|
||||
eventHandler = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
||||
console.log(event);
|
||||
};
|
||||
|
||||
render() {
|
||||
const scrollViewStyle1 = StyleSheet.create({
|
||||
scrollView: {
|
||||
@ -406,11 +414,27 @@ class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListVi
|
||||
throw new Error("Expected scroll to be enabled.");
|
||||
}
|
||||
|
||||
return <ScrollView horizontal={true} nestedScrollEnabled={true} contentOffset={{x: 0, y: 0}} {...props} style={[scrollViewStyle1.scrollView, scrollViewStyle2]} />;
|
||||
return (
|
||||
<ScrollView
|
||||
horizontal={true}
|
||||
nestedScrollEnabled={true}
|
||||
contentOffset={{ x: 0, y: 0 }}
|
||||
{...props}
|
||||
style={[
|
||||
scrollViewStyle1.scrollView,
|
||||
scrollViewStyle2
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
renderRow={({ type, data }, _, row) => {
|
||||
return <Text>Filler</Text>;
|
||||
}}
|
||||
onScroll={this.eventHandler}
|
||||
onScrollBeginDrag={this.eventHandler}
|
||||
onScrollEndDrag={this.eventHandler}
|
||||
onMomentumScrollBegin={this.eventHandler}
|
||||
onMomentumScrollEnd={this.eventHandler}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user