diff --git a/JSDemos/Demos/ScrollView/Overview/React/App.tsx b/JSDemos/Demos/ScrollView/Overview/React/App.tsx
index dc36ecda271..d436a00c725 100644
--- a/JSDemos/Demos/ScrollView/Overview/React/App.tsx
+++ b/JSDemos/Demos/ScrollView/Overview/React/App.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import ScrollView, { ScrollViewTypes } from 'devextreme-react/scroll-view';
-import SelectBox, { SelectBoxTypes } from 'devextreme-react/select-box';
+import SelectBox from 'devextreme-react/select-box';
import CheckBox, { CheckBoxTypes } from 'devextreme-react/check-box';
import service from './data.ts';
@@ -17,10 +17,6 @@ const App = () => {
const scrollViewRef = React.useRef(null);
- const getInstance = (ref: { instance: any; }) => {
- scrollViewRef.current = ref.instance;
- };
-
const updateContent = React.useCallback((args: UpdateContentArgs, eventName: string) => {
const updateContentText = `\n Content has been updated on the ${eventName} event.\n\n`;
if (updateContentTimer) {
@@ -45,26 +41,14 @@ const App = () => {
}, [setPullDown]);
const reachBottomValueChanged = React.useCallback((args: CheckBoxTypes.ValueChangedEvent) => {
- scrollViewRef.current.option('onReachBottom', args.value ? updateBottomContent : null);
+ scrollViewRef.current.instance.option('onReachBottom', args.value ? updateBottomContent : null);
}, [updateBottomContent]);
- const scrollbarModelValueChanged = React.useCallback((args: SelectBoxTypes.ValueChangedEvent) => {
- setShowScrollBarMode(args.value);
- }, [setShowScrollBarMode]);
-
- const scrollByContentValueChanged = React.useCallback((args: CheckBoxTypes.ValueChangedEvent) => {
- setScrollByContent(args.value);
- }, [setScrollByContent]);
-
- const scrollByThumbValueChanged = React.useCallback((args: CheckBoxTypes.ValueChangedEvent) => {
- setScrollByThumb(args.value);
- }, [setScrollByThumb]);
-
return (
{
inputAttr={showScrollBarModeLabel}
displayExpr="text"
value={showScrollBarMode}
- onValueChanged={scrollbarModelValueChanged}
+ onValueChange={setShowScrollBarMode}
/>
@@ -106,14 +90,14 @@ const App = () => {
diff --git a/JSDemos/Demos/ScrollView/Overview/ReactJs/App.js b/JSDemos/Demos/ScrollView/Overview/ReactJs/App.js
index f57faf409b0..688966786dd 100644
--- a/JSDemos/Demos/ScrollView/Overview/ReactJs/App.js
+++ b/JSDemos/Demos/ScrollView/Overview/ReactJs/App.js
@@ -13,9 +13,6 @@ const App = () => {
const [scrollByThumb, setScrollByThumb] = React.useState(true);
const [content, setContent] = React.useState(service.getContent());
const scrollViewRef = React.useRef(null);
- const getInstance = (ref) => {
- scrollViewRef.current = ref.instance;
- };
const updateContent = React.useCallback(
(args, eventName) => {
const updateContentText = `\n Content has been updated on the ${eventName} event.\n\n`;
@@ -51,33 +48,18 @@ const App = () => {
);
const reachBottomValueChanged = React.useCallback(
(args) => {
- scrollViewRef.current.option('onReachBottom', args.value ? updateBottomContent : null);
+ scrollViewRef.current.instance.option(
+ 'onReachBottom',
+ args.value ? updateBottomContent : null,
+ );
},
[updateBottomContent],
);
- const scrollbarModelValueChanged = React.useCallback(
- (args) => {
- setShowScrollBarMode(args.value);
- },
- [setShowScrollBarMode],
- );
- const scrollByContentValueChanged = React.useCallback(
- (args) => {
- setScrollByContent(args.value);
- },
- [setScrollByContent],
- );
- const scrollByThumbValueChanged = React.useCallback(
- (args) => {
- setScrollByThumb(args.value);
- },
- [setScrollByThumb],
- );
return (
{
inputAttr={showScrollBarModeLabel}
displayExpr="text"
value={showScrollBarMode}
- onValueChanged={scrollbarModelValueChanged}
+ onValueChange={setShowScrollBarMode}
/>
@@ -119,14 +101,14 @@ const App = () => {