Skip to content

Commit

Permalink
Revert "Migrate scrollResponderScrollNativeHandleToKeyboard function …
Browse files Browse the repository at this point in the history
…to take nativeRef"

This reverts commit 09c4e7c.
  • Loading branch information
grabbou committed Oct 29, 2019
1 parent 6f98e77 commit 43593c7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 52 deletions.
28 changes: 8 additions & 20 deletions Libraries/Components/ScrollResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

'use strict';

const React = require('react');
const Dimensions = require('../Utilities/Dimensions');
const FrameRateLogger = require('../Interaction/FrameRateLogger');
const Keyboard = require('./Keyboard/Keyboard');
Expand Down Expand Up @@ -552,30 +551,19 @@ const ScrollResponderMixin = {
* @param {bool} preventNegativeScrolling Whether to allow pulling the content
* down to make it meet the keyboard's top. Default is false.
*/
scrollResponderScrollNativeHandleToKeyboard: function<T>(
nodeHandle:
| number
| React.ElementRef<Class<ReactNative.NativeComponent<T>>>,
scrollResponderScrollNativeHandleToKeyboard: function(
nodeHandle: number,
additionalOffset?: number,
preventNegativeScrollOffset?: boolean,
) {
this.additionalScrollOffset = additionalOffset || 0;
this.preventNegativeScrollOffset = !!preventNegativeScrollOffset;

if (typeof nodeHandle === 'number') {
UIManager.measureLayout(
nodeHandle,
ReactNative.findNodeHandle(this.getInnerViewNode()),
this.scrollResponderTextInputFocusError,
this.scrollResponderInputMeasureAndScrollToKeyboard,
);
} else {
nodeHandle.measureLayout(
this.getInnerViewRef(),
this.scrollResponderInputMeasureAndScrollToKeyboard,
this.scrollResponderTextInputFocusError,
);
}
UIManager.measureLayout(
nodeHandle,
ReactNative.findNodeHandle(this.getInnerViewNode()),
this.scrollResponderTextInputFocusError,
this.scrollResponderInputMeasureAndScrollToKeyboard,
);
},

/**
Expand Down
27 changes: 5 additions & 22 deletions Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export type ScrollResponderType = {
// issue by specifying them manually.
getScrollableNode: $PropertyType<ScrollView, 'getScrollableNode'>,
getInnerViewNode: $PropertyType<ScrollView, 'getInnerViewNode'>,
getInnerViewRef: $PropertyType<ScrollView, 'getInnerViewRef'>,
getNativeScrollRef: $PropertyType<ScrollView, 'getNativeScrollRef'>,

setNativeProps: $PropertyType<ScrollView, 'setNativeProps'>,
Expand Down Expand Up @@ -769,15 +768,7 @@ class ScrollView extends React.Component<Props, State> {
return ReactNative.findNodeHandle(this._innerViewRef);
}

getInnerViewRef(): ?React.ElementRef<
Class<ReactNative.NativeComponent<mixed>>,
> {
return this._innerViewRef;
}

getNativeScrollRef(): ?React.ElementRef<
Class<ReactNative.NativeComponent<mixed>>,
> {
getNativeScrollRef(): ?ScrollView {
return this._scrollViewRef;
}
Expand Down Expand Up @@ -950,21 +941,13 @@ class ScrollView extends React.Component<Props, State> {
this.props.onContentSizeChange(width, height);
};

_scrollViewRef: ?React.ElementRef<
Class<ReactNative.NativeComponent<mixed>>,
> = null;
_setScrollViewRef = (
ref: ?React.ElementRef<Class<ReactNative.NativeComponent<mixed>>>,
) => {
_scrollViewRef: ?ScrollView = null;
_setScrollViewRef = (ref: ?ScrollView) => {
this._scrollViewRef = ref;
};

_innerViewRef: ?React.ElementRef<
Class<ReactNative.NativeComponent<mixed>>,
> = null;
_setInnerViewRef = (
ref: ?React.ElementRef<Class<ReactNative.NativeComponent<mixed>>>,
) => {
_innerViewRef: ?NativeMethodsMixinType = null;
_setInnerViewRef = (ref: ?NativeMethodsMixinType) => {
this._innerViewRef = ref;
};

Expand Down
10 changes: 0 additions & 10 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -904,12 +904,6 @@ const TextInput = createReactClass({
this._inputRef = ref;
},

getNativeRef: function(): ?React.ElementRef<
Class<ReactNative.NativeComponent<mixed>>,
> {
return this._inputRef;
},

_renderIOSLegacy: function() {
let textContainer;

Expand Down Expand Up @@ -1233,10 +1227,6 @@ const TextInput = createReactClass({
class InternalTextInputType extends ReactNative.NativeComponent<Props> {
clear() {}

getNativeRef(): ?React.ElementRef<
Class<ReactNative.NativeComponent<mixed>>,
> {}

// $FlowFixMe
isFocused(): boolean {}
}
Expand Down

0 comments on commit 43593c7

Please sign in to comment.