Tomun/fixflow (#196)
* Fixed Flow, Lint, and Jest tests. Fixed broken macOS scroll key events. * Added ADO tests for jest, flow, lint, format-check * Rename yml file * Added displayName's to the yml steps * More flow fixes. macos specific files were being skipped in .flowconfig * Renamed e to event and event to nativeEvent * Fix lint errors
This commit is contained in:
Родитель
3707a293fa
Коммит
fe9ccbcbcf
|
@ -7,6 +7,14 @@ pr:
|
|||
- master
|
||||
|
||||
jobs:
|
||||
- job: JavaScriptRNPR
|
||||
displayName: JavaScript React Native PR
|
||||
pool:
|
||||
vmImage: macOS-10.14
|
||||
demands: ['xcode', 'sh', 'npm']
|
||||
steps:
|
||||
- template: templates/apple-job-javascript.yml
|
||||
|
||||
- job: AppleRNPR
|
||||
displayName: Apple React Native PR
|
||||
strategy:
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
steps:
|
||||
- script: 'brew bundle'
|
||||
displayName: 'brew bundle'
|
||||
|
||||
- script: brew link node@10 --overwrite --force
|
||||
displayName: 'ensure node 10'
|
||||
|
||||
- template: apple-xcode-select.yml
|
||||
|
||||
- script: 'yarn install'
|
||||
displayName: 'yarn install'
|
||||
|
||||
- script: 'yarn test-ci'
|
||||
displayName: 'yarn test-ci'
|
||||
|
||||
- script: 'yarn flow'
|
||||
displayName: 'yarn flow'
|
||||
|
||||
- script: 'yarn lint'
|
||||
displayName: 'yarn lint'
|
||||
|
||||
- script: 'yarn format-check'
|
||||
displayName: 'yarn format-check'
|
|
@ -1,7 +1,6 @@
|
|||
[ignore]
|
||||
; We fork some components by platform
|
||||
.*/*[.]android.js
|
||||
.*/*[.]macos.js
|
||||
|
||||
; Ignore templates for 'react-native init'
|
||||
<PROJECT_ROOT>/template/.*
|
||||
|
|
|
@ -31,7 +31,6 @@ import type {
|
|||
PressEvent,
|
||||
ScrollEvent,
|
||||
LayoutEvent,
|
||||
KeyboardEvent,
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
|
||||
import type {NativeMethodsMixinType} from '../../Renderer/shims/ReactNativeTypes';
|
||||
|
@ -883,58 +882,61 @@ class ScrollView extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
// [TODO(macOS ISS#2323203)
|
||||
_handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (this.props.onKeyDown) {
|
||||
this.props.onKeyDown(e);
|
||||
_handleKeyDown = (event: ScrollEvent) => {
|
||||
if (this.props.onScrollKeyDown) {
|
||||
this.props.onScrollKeyDown(event);
|
||||
} else {
|
||||
const event = e.nativeEvent;
|
||||
const key = event.key;
|
||||
const kMinScrollOffset = 10;
|
||||
|
||||
if (Platform.OS === 'macos') {
|
||||
const nativeEvent = event.nativeEvent;
|
||||
const key = nativeEvent.key;
|
||||
const kMinScrollOffset = 10;
|
||||
if (key === 'PAGE_UP') {
|
||||
this._handleScrollByKeyDown(event, {
|
||||
x: event.contentOffset.x,
|
||||
y: event.contentOffset.y + -event.layoutMeasurement.height,
|
||||
x: nativeEvent.contentOffset.x,
|
||||
y:
|
||||
nativeEvent.contentOffset.y +
|
||||
-nativeEvent.layoutMeasurement.height,
|
||||
});
|
||||
} else if (key === 'PAGE_DOWN') {
|
||||
this._handleScrollByKeyDown(event, {
|
||||
x: event.contentOffset.x,
|
||||
y: event.contentOffset.y + event.layoutMeasurement.height,
|
||||
x: nativeEvent.contentOffset.x,
|
||||
y:
|
||||
nativeEvent.contentOffset.y +
|
||||
nativeEvent.layoutMeasurement.height,
|
||||
});
|
||||
} else if (key === 'LEFT_ARROW') {
|
||||
this._handleScrollByKeyDown(event, {
|
||||
x:
|
||||
event.contentOffset.x +
|
||||
-(this.props.horizontalLineScroll === undefined
|
||||
nativeEvent.contentOffset.x +
|
||||
-(this.props.horizontalLineScroll !== undefined
|
||||
? this.props.horizontalLineScroll
|
||||
: kMinScrollOffset),
|
||||
y: event.contentOffset.y,
|
||||
y: nativeEvent.contentOffset.y,
|
||||
});
|
||||
} else if (key === 'RIGHT_ARROW') {
|
||||
this._handleScrollByKeyDown(event, {
|
||||
x:
|
||||
event.contentOffset.x +
|
||||
(this.props.horizontalLineScroll === undefined
|
||||
nativeEvent.contentOffset.x +
|
||||
(this.props.horizontalLineScroll !== undefined
|
||||
? this.props.horizontalLineScroll
|
||||
: kMinScrollOffset),
|
||||
y: event.contentOffset.y,
|
||||
y: nativeEvent.contentOffset.y,
|
||||
});
|
||||
} else if (key === 'DOWN_ARROW') {
|
||||
this._handleScrollByKeyDown(event, {
|
||||
x: event.contentOffset.x,
|
||||
x: nativeEvent.contentOffset.x,
|
||||
y:
|
||||
event.contentOffset.y +
|
||||
(this.props.verticalLineScroll === undefined
|
||||
nativeEvent.contentOffset.y +
|
||||
(this.props.verticalLineScroll !== undefined
|
||||
? this.props.verticalLineScroll
|
||||
: kMinScrollOffset),
|
||||
});
|
||||
} else if (key === 'UP_ARROW') {
|
||||
this._handleScrollByKeyDown(event, {
|
||||
x: event.contentOffset.x,
|
||||
x: nativeEvent.contentOffset.x,
|
||||
y:
|
||||
event.contentOffset.y +
|
||||
-(this.props.verticalLineScroll === undefined
|
||||
nativeEvent.contentOffset.y +
|
||||
-(this.props.verticalLineScroll !== undefined
|
||||
? this.props.verticalLineScroll
|
||||
: kMinScrollOffset),
|
||||
});
|
||||
|
@ -943,11 +945,13 @@ class ScrollView extends React.Component<Props, State> {
|
|||
}
|
||||
};
|
||||
|
||||
_handleScrollByKeyDown = (e: ScrollEvent, newOffset) => {
|
||||
_handleScrollByKeyDown = (event: ScrollEvent, newOffset) => {
|
||||
const maxX =
|
||||
e.nativeEvent.contentSize.width - e.nativeEvent.layoutMeasurement.width;
|
||||
event.nativeEvent.contentSize.width -
|
||||
event.nativeEvent.layoutMeasurement.width;
|
||||
const maxY =
|
||||
e.nativeEvent.contentSize.height - e.nativeEvent.layoutMeasurement.height;
|
||||
event.nativeEvent.contentSize.height -
|
||||
event.nativeEvent.layoutMeasurement.height;
|
||||
this.scrollTo({
|
||||
x: Math.max(0, Math.min(maxX, newOffset.x)),
|
||||
y: Math.max(0, Math.min(maxY, newOffset.y)),
|
||||
|
@ -1133,7 +1137,7 @@ class ScrollView extends React.Component<Props, State> {
|
|||
// Override the onContentSizeChange from props, since this event can
|
||||
// bubble up from TextInputs
|
||||
onContentSizeChange: null,
|
||||
onKeyDown: this._handleKeyDown, // TODO(macOS ISS#2323203)
|
||||
onScrollKeyDown: this._handleKeyDown, // TODO(macOS ISS#2323203)
|
||||
onLayout: this._handleLayout,
|
||||
onMomentumScrollBegin: this._scrollResponder
|
||||
.scrollResponderHandleMomentumScrollBegin,
|
||||
|
|
|
@ -14,7 +14,7 @@ import type {
|
|||
PressEvent,
|
||||
Layout,
|
||||
LayoutEvent,
|
||||
KeyboardEvent,
|
||||
ScrollEvent, // TODO(macOS ISS#2323203)
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
|
||||
import type {Node} from 'react';
|
||||
|
@ -58,10 +58,10 @@ type DirectEventProps = $ReadOnly<{|
|
|||
onDoubleClick?: ?(event: SyntheticEvent<{}>) => mixed, // TODO(macOS ISS#2323203)
|
||||
|
||||
/**
|
||||
* When `accessible` is true, the system will try to invoke this function
|
||||
* When `acceptsKeyboardFocus` is true, the system will try to invoke this function
|
||||
* when the user performs accessibility key down gesture.
|
||||
*/
|
||||
onKeyDown?: ?(event: KeyboardEvent) => mixed, // TODO(macOS ISS#2323203)
|
||||
onScrollKeyDown?: ?(event: ScrollEvent) => mixed, // TODO(macOS ISS#2323203)
|
||||
|
||||
onMouseEnter?: (event: SyntheticEvent<{}>) => mixed, // [TODO(macOS ISS#2323203)
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import type {
|
|||
ViewToken,
|
||||
ViewabilityConfigCallbackPair,
|
||||
} from './ViewabilityHelper';
|
||||
import type {ScrollEvent} from '../Types/CoreEventTypes'; // TODO(macOS ISS#2323203)
|
||||
|
||||
type Item = any;
|
||||
|
||||
|
@ -1098,7 +1099,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
_defaultRenderScrollComponent = props => {
|
||||
let keyEventHandler = this.props.onKeyDown; // [TODO(macOS ISS#2323203)
|
||||
let keyEventHandler = this.props.onScrollKeyDown; // [TODO(macOS ISS#2323203)
|
||||
if (!keyEventHandler) {
|
||||
keyEventHandler = this.props.enableSelectionOnKeyPress
|
||||
? this._handleKeyDown
|
||||
|
@ -1119,7 +1120,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
// $FlowFixMe Invalid prop usage
|
||||
<ScrollView
|
||||
{...props}
|
||||
onKeyDown={keyEventHandler} // TODO(macOS ISS#2323203)
|
||||
onScrollKeyDown={keyEventHandler} // TODO(macOS ISS#2323203)
|
||||
refreshControl={
|
||||
props.refreshControl == null ? (
|
||||
<RefreshControl
|
||||
|
@ -1135,7 +1136,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
);
|
||||
} else {
|
||||
// $FlowFixMe Invalid prop usage
|
||||
return <ScrollView {...props} onKeyDown={keyEventHandler} />; // TODO(macOS ISS#2323203)
|
||||
return <ScrollView {...props} onScrollKeyDown={keyEventHandler} />; // TODO(macOS ISS#2323203)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1280,7 +1281,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
|||
}
|
||||
};
|
||||
|
||||
_handleKeyDown = e => {
|
||||
_handleKeyDown = (e: ScrollEvent) => {
|
||||
if (this.props.onKeyDown) {
|
||||
this.props.onKeyDown(e);
|
||||
} else {
|
||||
|
|
|
@ -21,6 +21,7 @@ import type {
|
|||
Props as VirtualizedListProps,
|
||||
SelectedRowIndexPathType, // TODO(macOS ISS#2323203)
|
||||
} from './VirtualizedList';
|
||||
import type {ScrollEvent} from '../Types/CoreEventTypes'; // TODO(macOS ISS#2323203)
|
||||
|
||||
type Item = any;
|
||||
|
||||
|
@ -296,7 +297,7 @@ class VirtualizedSectionList<
|
|||
this._listRef.ensureItemAtIndexIsVisible(index);
|
||||
};
|
||||
|
||||
_handleKeyDown = e => {
|
||||
_handleKeyDown = (e: ScrollEvent) => {
|
||||
if (Platform.OS === 'macos') {
|
||||
const event = e.nativeEvent;
|
||||
const key = event.key;
|
||||
|
@ -339,7 +340,7 @@ class VirtualizedSectionList<
|
|||
}; // ]TODO(macOS ISS#2323203)
|
||||
|
||||
render() {
|
||||
let keyEventHandler = this.props.onKeyDown; // [TODO(macOS ISS#2323203)
|
||||
let keyEventHandler = this.props.onScrollKeyDown; // [TODO(macOS ISS#2323203)
|
||||
if (!keyEventHandler) {
|
||||
keyEventHandler = this.props.enableSelectionOnKeyPress
|
||||
? this._handleKeyDown
|
||||
|
@ -349,7 +350,7 @@ class VirtualizedSectionList<
|
|||
<VirtualizedList
|
||||
{...this.state.childProps}
|
||||
ref={this._captureRef}
|
||||
onKeyDown={keyEventHandler}
|
||||
onScrollKeyDown={keyEventHandler}
|
||||
{...this.state.selectedRowIndexPath}
|
||||
/> // TODO(macOS ISS#2323203)
|
||||
);
|
||||
|
|
|
@ -36,13 +36,13 @@ exports[`FlatList renders all the bells and whistles 1`] = `
|
|||
numColumns={2}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onRefresh={[MockFunction]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
refreshControl={
|
||||
<RefreshControlMock
|
||||
onRefresh={[MockFunction]}
|
||||
|
@ -140,12 +140,12 @@ exports[`FlatList renders empty list 1`] = `
|
|||
numColumns={1}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
removeClippedSubviews={false}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
|
@ -170,12 +170,12 @@ exports[`FlatList renders null list 1`] = `
|
|||
numColumns={1}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
removeClippedSubviews={false}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
|
@ -213,12 +213,12 @@ exports[`FlatList renders simple list 1`] = `
|
|||
numColumns={1}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
removeClippedSubviews={false}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
|
|
|
@ -26,12 +26,12 @@ exports[`SectionList rendering empty section headers is fine 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
renderSectionHeader={[Function]}
|
||||
rowIndex={-1}
|
||||
|
@ -109,12 +109,12 @@ exports[`SectionList renders a footer when there is no data 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
renderSectionFooter={[Function]}
|
||||
renderSectionHeader={[Function]}
|
||||
|
@ -178,12 +178,12 @@ exports[`SectionList renders a footer when there is no data and no header 1`] =
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
renderSectionFooter={[Function]}
|
||||
rowIndex={-1}
|
||||
|
@ -278,13 +278,13 @@ exports[`SectionList renders all the bells and whistles 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onRefresh={[MockFunction]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
refreshControl={
|
||||
<RefreshControlMock
|
||||
onRefresh={[MockFunction]}
|
||||
|
@ -516,12 +516,12 @@ exports[`SectionList renders empty list 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
|
|
|
@ -21,12 +21,12 @@ exports[`VirtualizedList handles nested lists 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -111,12 +111,12 @@ exports[`VirtualizedList handles nested lists 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -186,12 +186,12 @@ exports[`VirtualizedList handles separators correctly 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -268,12 +268,12 @@ exports[`VirtualizedList handles separators correctly 2`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -350,12 +350,12 @@ exports[`VirtualizedList handles separators correctly 3`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -445,13 +445,13 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onRefresh={[MockFunction]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
refreshControl={
|
||||
<RefreshControlMock
|
||||
onRefresh={[MockFunction]}
|
||||
|
@ -627,12 +627,12 @@ exports[`VirtualizedList renders empty list 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -658,12 +658,12 @@ exports[`VirtualizedList renders empty list with empty component 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -705,12 +705,12 @@ exports[`VirtualizedList renders list with empty component 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -741,12 +741,12 @@ exports[`VirtualizedList renders null list 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -781,12 +781,12 @@ exports[`VirtualizedList renders simple list 1`] = `
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
@ -840,12 +840,12 @@ exports[`VirtualizedList test getItem functionality where data is not an Array 1
|
|||
maxToRenderPerBatch={10}
|
||||
onContentSizeChange={[Function]}
|
||||
onEndReachedThreshold={2}
|
||||
onKeyDown={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
scrollEventThrottle={50}
|
||||
stickyHeaderIndices={Array []}
|
||||
|
|
|
@ -31,8 +31,11 @@ exports[`VirtualizedSectionList handles nested lists 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={
|
||||
Array [
|
||||
Object {
|
||||
|
@ -91,8 +94,11 @@ exports[`VirtualizedSectionList handles nested lists 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={
|
||||
Array [
|
||||
Object {
|
||||
|
@ -172,8 +178,11 @@ exports[`VirtualizedSectionList handles nested lists 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={
|
||||
Array [
|
||||
Object {
|
||||
|
@ -291,8 +300,11 @@ exports[`VirtualizedSectionList handles separators correctly 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={
|
||||
Array [
|
||||
Object {
|
||||
|
@ -448,8 +460,11 @@ exports[`VirtualizedSectionList handles separators correctly 2`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={
|
||||
Array [
|
||||
Object {
|
||||
|
@ -605,8 +620,11 @@ exports[`VirtualizedSectionList handles separators correctly 3`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={
|
||||
Array [
|
||||
Object {
|
||||
|
@ -776,6 +794,7 @@ exports[`VirtualizedSectionList renders all the bells and whistles 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
refreshControl={
|
||||
<RefreshControlMock
|
||||
onRefresh={[MockFunction]}
|
||||
|
@ -784,7 +803,9 @@ exports[`VirtualizedSectionList renders all the bells and whistles 1`] = `
|
|||
}
|
||||
refreshing={false}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={
|
||||
Array [
|
||||
Object {
|
||||
|
@ -1020,8 +1041,11 @@ exports[`VirtualizedSectionList renders empty list 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={Array []}
|
||||
stickyHeaderIndices={Array []}
|
||||
updateCellsBatchingPeriod={50}
|
||||
|
@ -1051,8 +1075,11 @@ exports[`VirtualizedSectionList renders empty list with empty component 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={Array []}
|
||||
stickyHeaderIndices={Array []}
|
||||
updateCellsBatchingPeriod={50}
|
||||
|
@ -1103,8 +1130,11 @@ exports[`VirtualizedSectionList renders list with empty component 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={
|
||||
Array [
|
||||
Object {
|
||||
|
@ -1158,8 +1188,11 @@ exports[`VirtualizedSectionList renders null list 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
stickyHeaderIndices={Array []}
|
||||
updateCellsBatchingPeriod={50}
|
||||
windowSize={21}
|
||||
|
@ -1202,8 +1235,11 @@ exports[`VirtualizedSectionList renders simple list 1`] = `
|
|||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollKeyDown={null}
|
||||
renderItem={[Function]}
|
||||
rowIndex={-1}
|
||||
scrollEventThrottle={50}
|
||||
sectionIndex={0}
|
||||
sections={
|
||||
Array [
|
||||
Object {
|
||||
|
|
|
@ -132,6 +132,7 @@ export type ScrollEvent = SyntheticEvent<
|
|||
|}>,
|
||||
zoomScale?: number,
|
||||
responderIgnoreScroll?: boolean,
|
||||
key?: string, // TODO(macOS)
|
||||
|}>,
|
||||
>;
|
||||
|
||||
|
@ -140,9 +141,3 @@ export type SwitchChangeEvent = SyntheticEvent<
|
|||
value: boolean,
|
||||
|}>,
|
||||
>;
|
||||
|
||||
export type KeyboardEvent = SyntheticEvent<
|
||||
$ReadOnly<{|
|
||||
key: string,
|
||||
|}>,
|
||||
>;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @providesModule Platform
|
||||
* @format
|
||||
* @flow
|
||||
*/
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class YellowBoxList extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
const listStyle = {
|
||||
width: Platform.OS === 'win32' ? '85%' : undefined,
|
||||
width: Platform.OS === 'win32' ? '85%' : undefined, // TODO(windows ISS)
|
||||
height:
|
||||
// Additional `0.5` so the (N + 1)th row can peek into view.
|
||||
Math.min(items.length, MAX_ITEMS + 0.5) *
|
||||
|
@ -130,7 +130,7 @@ const styles = StyleSheet.create({
|
|||
width: '100%',
|
||||
},
|
||||
dismissAll: {
|
||||
bottom: Platform.OS === 'win32' ? 0 : '100%',
|
||||
bottom: Platform.OS === 'win32' ? 0 : '100%', // TODO(windows ISS)
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-end',
|
||||
paddingBottom: 4,
|
||||
|
|
|
@ -561,6 +561,7 @@ if (global.nativeLoggingHook) {
|
|||
// the condition
|
||||
if (methodName === 'assert') {
|
||||
if (!arguments[0] && originalConsole.hasOwnProperty('assert')) {
|
||||
// TODO(macOS ISS#2323203)
|
||||
originalConsole.assert(...arguments);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -57,7 +57,7 @@ class RowComponent extends React.PureComponent<{
|
|||
onShowUnderlay={this.props.onShowUnderlay}
|
||||
onHideUnderlay={this.props.onHideUnderlay}
|
||||
onAccessibilityTap={this._onPress}
|
||||
acceptsKeyboardFocus={false}
|
||||
acceptsKeyboardFocus={false} // TODO(macOS ISS#2323203)
|
||||
onPress={this._onPress}>
|
||||
<View style={rowStyle}>
|
||||
<Text style={styles.rowTitleText}>{item.module.title}</Text>
|
||||
|
@ -109,6 +109,7 @@ class RNTesterExampleList extends React.Component<Props, $FlowFixMeState> {
|
|||
itemShouldUpdate={this._itemShouldUpdate}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
acceptsKeyboardFocus={true} // TODO(macOS ISS#2323203)
|
||||
onSelectionEntered={this._handleOnSelectionEntered} // TODO(macOS ISS#2323203)
|
||||
enableSelectionOnKeyPress={true} // TODO(macOS ISS#2323203)
|
||||
automaticallyAdjustContentInsets={false}
|
||||
keyboardDismissMode="on-drag"
|
||||
|
|
|
@ -10,11 +10,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
export type RNTesterExample = {
|
||||
key: string,
|
||||
module: Object,
|
||||
supportsTVOS: boolean,
|
||||
};
|
||||
import type {RNTesterExample} from './Shared/RNTesterTypes';
|
||||
|
||||
const ComponentExamples: Array<RNTesterExample> = [
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@ exports.examples = [
|
|||
// $FlowFixMe Invalid prop usage
|
||||
_scrollView = scrollView;
|
||||
}}
|
||||
acceptsKeyboardFocus={true} // TODO(macOS ISS#2323203)
|
||||
automaticallyAdjustContentInsets={false}
|
||||
onScroll={() => {
|
||||
console.log('onScroll!');
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
@property (nonatomic, copy) RCTDirectEventBlock onScrollEndDrag;
|
||||
@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollBegin;
|
||||
@property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollEnd;
|
||||
@property (nonatomic, copy) RCTDirectEventBlock onKeyDown; // TODO(macOS ISS#2323203)
|
||||
@property (nonatomic, copy) RCTDirectEventBlock onScrollKeyDown; // TODO(macOS ISS#2323203)
|
||||
|
||||
- (void)flashScrollIndicators; // TODO(macOS ISS#2323203)
|
||||
|
||||
|
|
|
@ -1408,7 +1408,7 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
|
|||
if (self == [[self window] firstResponder] &&
|
||||
theEvent.keyCode != 48) {
|
||||
NSString *keyCommand = [self keyCommandFromKeyCode:theEvent.keyCode];
|
||||
RCT_SEND_SCROLL_EVENT(onKeyDown, (@{ @"key": keyCommand}));
|
||||
RCT_SEND_SCROLL_EVENT(onScrollKeyDown, (@{ @"key": keyCommand}));
|
||||
} else {
|
||||
[super keyDown:theEvent];
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ RCT_EXPORT_VIEW_PROPERTY(onScrollEndDrag, RCTDirectEventBlock)
|
|||
RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollBegin, RCTDirectEventBlock)
|
||||
RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollEnd, RCTDirectEventBlock)
|
||||
RCT_EXPORT_VIEW_PROPERTY(DEPRECATED_sendUpdatedChildFrames, BOOL)
|
||||
RCT_EXPORT_OSX_VIEW_PROPERTY(onKeyDown, RCTDirectEventBlock) // TODO(macOS ISS#2323203)
|
||||
RCT_EXPORT_OSX_VIEW_PROPERTY(onScrollKeyDown, RCTDirectEventBlock) // TODO(macOS ISS#2323203)
|
||||
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
|
||||
RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior)
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче