mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[@types/react-native] Add setNativeProps to ScrollView (#46242)
* Add setNativeProps to ScrollView * Update setNativeProps type and doc * Add test for ScrollView's setNativeProps * Add test for View.setNativeProps
This commit is contained in:
parent
c45d5b3a96
commit
9f8ff98dd1
12
types/react-native/index.d.ts
vendored
12
types/react-native/index.d.ts
vendored
@ -352,9 +352,9 @@ export interface NativeMethods {
|
||||
* This function sends props straight to native. They will not participate in
|
||||
* future diff process - this means that if you do not include them in the
|
||||
* next render, they will remain active (see [Direct
|
||||
* Manipulation](docs/direct-manipulation.html)).
|
||||
* Manipulation](https://reactnative.dev/docs/direct-manipulation)).
|
||||
*/
|
||||
setNativeProps(nativeProps: Object): void;
|
||||
setNativeProps(nativeProps: object): void;
|
||||
|
||||
/**
|
||||
* Requests focus for the given input or view. The exact behavior triggered
|
||||
@ -6810,6 +6810,14 @@ export class ScrollView extends ScrollViewBase {
|
||||
* @deprecated Use scrollTo instead
|
||||
*/
|
||||
scrollWithoutAnimationTo?: (y: number, x: number) => void;
|
||||
|
||||
/**
|
||||
* This function sends props straight to native. They will not participate in
|
||||
* future diff process - this means that if you do not include them in the
|
||||
* next render, they will remain active (see [Direct
|
||||
* Manipulation](https://reactnative.dev/docs/direct-manipulation)).
|
||||
*/
|
||||
setNativeProps(nativeProps: object): void;
|
||||
}
|
||||
|
||||
export interface NativeScrollRectangle {
|
||||
|
||||
@ -310,10 +310,9 @@ class Welcome extends React.Component<ElementProps<View> & { color: string }> {
|
||||
};
|
||||
|
||||
testNativeMethods() {
|
||||
// this.setNativeProps({});
|
||||
|
||||
const { rootView } = this.refs;
|
||||
|
||||
rootView.setNativeProps({});
|
||||
rootView.measure((x: number, y: number, width: number, height: number) => {});
|
||||
}
|
||||
|
||||
@ -597,6 +596,12 @@ class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListVi
|
||||
console.log(event);
|
||||
};
|
||||
|
||||
scrollView: ScrollView | null = null;
|
||||
|
||||
testNativeMethods() {
|
||||
this.scrollView && this.scrollView.setNativeProps({ scrollEnabled: false });
|
||||
}
|
||||
|
||||
render() {
|
||||
const scrollViewStyle1 = StyleSheet.create({
|
||||
scrollView: {
|
||||
@ -616,6 +621,7 @@ class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListVi
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
ref={ref => (this.scrollView = ref)}
|
||||
horizontal={true}
|
||||
nestedScrollEnabled={true}
|
||||
invertStickyHeaders={true}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user