Skip to content

Commit e06e591

Browse files
Merge pull request #1 from react-native-oh-library/sig_dev
sig_dev合入sig
2 parents f7280aa + 3c17126 commit e06e591

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

lib/NestedScrollView.js

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ const {
2222
requireNativeComponent,
2323
} = ReactNative;
2424

25-
const AnimatedImplementation = require('react-native/Libraries/Animated/src/AnimatedImplementation');
26-
const ScrollResponder = require('react-native/Libraries/Components/ScrollResponder');
25+
const AnimatedImplementation = require('react-native/Libraries/Animated/AnimatedImplementation');
2726
const ScrollViewStickyHeader = require('react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader');
28-
2927
const createReactClass = require('create-react-class');
3028
const dismissKeyboard = require('react-native/Libraries/Utilities/dismissKeyboard');
3129
const flattenStyle = require('react-native/Libraries/StyleSheet/flattenStyle');
@@ -34,14 +32,12 @@ const processDecelerationRate = require('react-native/Libraries/Components/Scrol
3432
const warning = require('fbjs/lib/warning');
3533
const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
3634

37-
import type {PressEvent} from 'CoreEventTypes';
38-
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
35+
import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes';
36+
import type {EdgeInsetsProp} from 'react-native/Libraries/StyleSheet/EdgeInsetsPropType';
3937
import type {NativeMethodsMixinType} from 'ReactNativeTypes';
40-
import type {ViewStyleProp} from 'StyleSheet';
41-
import type {ViewProps} from 'ViewPropTypes';
42-
import type {PointProp} from 'PointPropType';
43-
44-
import type {ColorValue} from 'StyleSheetTypes';
38+
import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
39+
import type {PointProp} from 'react-native/Libraries/StyleSheet/PointPropType';
40+
import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet';
4541

4642
let AndroidScrollView;
4743
let AndroidHorizontalScrollContentView;
@@ -553,8 +549,8 @@ type State = {|
553549
|};
554550
function createScrollResponder(
555551
node: React.ElementRef<typeof ScrollView>,
556-
): typeof ScrollResponder.Mixin {
557-
const scrollResponder = {...ScrollResponder.Mixin};
552+
): typeof View.props.onResponderGrant {
553+
const scrollResponder = {...View.props.onResponderGrant};
558554
for (const key in scrollResponder) {
559555
if (typeof scrollResponder[key] === 'function') {
560556
scrollResponder[key] = scrollResponder[key].bind(node);
@@ -611,7 +607,7 @@ class ScrollView extends React.Component<Props, State> {
611607
* component instance.
612608
* 3. Continued...
613609
*/
614-
_scrollResponder: typeof ScrollResponder.Mixin = createScrollResponder(this);
610+
_scrollResponder: typeof View.props.onResponderGrant = createScrollResponder(this);
615611
constructor(props: Props) {
616612
super(props);
617613
/**
@@ -625,13 +621,13 @@ class ScrollView extends React.Component<Props, State> {
625621
* Since the object returned from that method is the ScrollView instance,
626622
* we need to bind all mixin methods to the ScrollView instance.
627623
*/
628-
for (const key in ScrollResponder.Mixin) {
624+
for (const key in View.props.onResponderGrant) {
629625
if (
630-
typeof ScrollResponder.Mixin[key] === 'function' &&
626+
typeof View.props.onResponderGrant[key] === 'function' &&
631627
key.startsWith('scrollResponder')
632628
) {
633629
// $FlowFixMe - dynamically adding properties to a class
634-
(this: any)[key] = ScrollResponder.Mixin[key].bind(this);
630+
(this: any)[key] = View.props.onResponderGrant[key].bind(this);
635631
}
636632
}
637633
/**
@@ -640,11 +636,11 @@ class ScrollView extends React.Component<Props, State> {
640636
* 4. Mixins can initialize properties and use properties on the component
641637
* instance.
642638
*/
643-
Object.keys(ScrollResponder.Mixin)
644-
.filter(key => typeof ScrollResponder.Mixin[key] !== 'function')
639+
Object.keys(View.props.onResponderGrant)
640+
.filter(key => typeof View.props.onResponderGrant[key] !== 'function')
645641
.forEach(key => {
646642
// $FlowFixMe - dynamically adding properties to a class
647-
(this: any)[key] = ScrollResponder.Mixin[key];
643+
(this: any)[key] = View.props.onResponderGrant[key];
648644
});
649645
}
650646

@@ -658,7 +654,7 @@ class ScrollView extends React.Component<Props, State> {
658654

659655
state = {
660656
layoutHeight: null,
661-
...ScrollResponder.Mixin.scrollResponderMixinGetInitialState(),
657+
...View.props.onResponderGrant.scrollResponderMixinGetInitialState(),
662658
};
663659

664660
UNSAFE_componentWillMount() {
@@ -713,7 +709,7 @@ class ScrollView extends React.Component<Props, State> {
713709
* to the underlying scroll responder's methods.
714710
*/
715711
getScrollResponder(): ScrollResponderType {
716-
// $FlowFixMe - overriding type to include ScrollResponder.Mixin
712+
// $FlowFixMe - overriding type to include View.props.onResponderGrant
717713
return ((this: any): ScrollResponderType);
718714
}
719715

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-nested-scroll-view",
3-
"version": "9.0.0",
3+
"version": "9.0.0-0.0.1",
44
"description": "React Native ScrollView replacement with NestedScrollView",
55
"main": "index.js",
66
"keywords": [
@@ -9,5 +9,8 @@
99
"nested-scroll"
1010
],
1111
"author": "Cesar Augusto <cesardeazevedo@outlook.com>",
12-
"license": "MIT"
12+
"license": "MIT",
13+
"dependencies": {
14+
"fbjs": "^3.0.5"
15+
}
1316
}

0 commit comments

Comments
 (0)