Skip to content

Commit 674ac69

Browse files
Naturalclarfacebook-github-bot
authored andcommitted
fix: resolve Require Cycle warning (#27851)
Summary: When I was testing React Native 0.62-rc.1, I noticed that console was showing a warning for Require Cycle as shown in image below ![Screen Shot 2020-01-24 at 12 22 38](https://user-images.githubusercontent.com/6936373/73042467-998dff00-3ea4-11ea-911c-955d55fd0743.png) This is because ScrollResponder was importing `ScrollView` to get the `typeof ScrollView`. I've made an export for ScrollView type in `ScrollView` so that Require cycle warning will not show up. ## Changelog [General] [Fixed] - Remove Require cycle warning. Pull Request resolved: #27851 Differential Revision: D19577644 Pulled By: cpojer fbshipit-source-id: 257b9421a91244d69394375102cfbe683326bba2
1 parent 56dfc86 commit 674ac69

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Libraries/Components/ScrollResponder.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ const ReactNative = require('../Renderer/shims/ReactNative');
1818
const TextInputState = require('./TextInput/TextInputState');
1919
const UIManager = require('../ReactNative/UIManager');
2020
const Platform = require('../Utilities/Platform');
21-
const ScrollView = require('./ScrollView/ScrollView');
2221
import Commands from './ScrollView/ScrollViewCommands';
2322

2423
const invariant = require('invariant');
2524
const performanceNow = require('fbjs/lib/performanceNow');
2625

2726
import type {PressEvent, ScrollEvent} from '../Types/CoreEventTypes';
27+
import typeof ScrollView from './ScrollView/ScrollView';
2828
import type {Props as ScrollViewProps} from './ScrollView/ScrollView';
2929
import type {KeyboardEvent} from './Keyboard/Keyboard';
3030
import type EmitterSubscription from '../vendor/emitter/EmitterSubscription';
@@ -468,7 +468,7 @@ const ScrollResponderMixin = {
468468
({x, y, animated} = x || {});
469469
}
470470

471-
const that: React.ElementRef<typeof ScrollView> = (this: any);
471+
const that: React.ElementRef<ScrollView> = (this: any);
472472
invariant(
473473
that.getNativeScrollRef != null,
474474
'Expected scrollTo to be called on a scrollViewRef. If this exception occurs it is likely a bug in React Native',
@@ -492,7 +492,7 @@ const ScrollResponderMixin = {
492492
// Default to true
493493
const animated = (options && options.animated) !== false;
494494

495-
const that: React.ElementRef<typeof ScrollView> = (this: any);
495+
const that: React.ElementRef<ScrollView> = (this: any);
496496
invariant(
497497
that.getNativeScrollRef != null,
498498
'Expected scrollToEnd to be called on a scrollViewRef. If this exception occurs it is likely a bug in React Native',
@@ -531,7 +531,7 @@ const ScrollResponderMixin = {
531531
);
532532
}
533533

534-
const that: React.ElementRef<typeof ScrollView> = this;
534+
const that: React.ElementRef<ScrollView> = this;
535535
invariant(
536536
that.getNativeScrollRef != null,
537537
'Expected zoomToRect to be called on a scrollViewRef. If this exception occurs it is likely a bug in React Native',
@@ -547,7 +547,7 @@ const ScrollResponderMixin = {
547547
* Displays the scroll indicators momentarily.
548548
*/
549549
scrollResponderFlashScrollIndicators: function() {
550-
const that: React.ElementRef<typeof ScrollView> = (this: any);
550+
const that: React.ElementRef<ScrollView> = (this: any);
551551
invariant(
552552
that.getNativeScrollRef != null,
553553
'Expected flashScrollIndicators to be called on a scrollViewRef. If this exception occurs it is likely a bug in React Native',

0 commit comments

Comments
 (0)