ScrollView and TextInput ViewConfig refactor

This commit is contained in:
Saad Najmi 2023-01-13 11:54:04 -08:00
Родитель 58360a8fa1
Коммит ee77d4879e
4 изменённых файлов: 72 добавлений и 70 удалений

Просмотреть файл

@ -370,20 +370,6 @@ type IOSProps = $ReadOnly<{|
| 'never' | 'never'
| 'always' | 'always'
), ),
/**
* Experimental: specifies how much to adjust the content view by when using
* the keyboard to scroll. This value adjusts the content's horizontal offset.
*
* @platform macos
*/
horizontalLineScroll?: number, // [macOS]
/**
* Experimental: specifies how much to adjust the content view by when using
* the keyboard to scroll. This value adjusts the content's vertical offset.
*
* @platform macos
*/
verticalLineScroll?: number, // [macOS]
|}>; |}>;
type AndroidProps = $ReadOnly<{| type AndroidProps = $ReadOnly<{|
@ -500,7 +486,7 @@ export type Props = $ReadOnly<{|
*/ */
invertStickyHeaders?: ?boolean, invertStickyHeaders?: ?boolean,
/** /**
* Reverses the direction of scroll. Uses native inversion on macOS and scale transforms of -1 elsewhere * Reverses the direction of scroll. Uses native inversion on macOS and scale transforms of -1 elsewhere // [macOS]
*/ */
inverted?: ?boolean, // [macOS] inverted?: ?boolean, // [macOS]
/** /**

Просмотреть файл

@ -146,6 +146,10 @@ const RCTScrollViewViewConfig =
onMomentumScrollBegin: true, onMomentumScrollBegin: true,
onScrollToTop: true, onScrollToTop: true,
onScroll: true, onScroll: true,
// [macOS
onInvertedDidChange: true,
onPreferredScrollerStyleDidChange: true,
// macOS]
}), }),
}, },
}; };

Просмотреть файл

@ -131,7 +131,6 @@ const RCTTextInputViewConfig = {
blurOnSubmit: true, blurOnSubmit: true,
mostRecentEventCount: true, mostRecentEventCount: true,
scrollEnabled: true, scrollEnabled: true,
hideVerticalScrollIndicator: true,
selectionColor: {process: require('../../StyleSheet/processColor')}, selectionColor: {process: require('../../StyleSheet/processColor')},
contextMenuHidden: true, contextMenuHidden: true,
secureTextEntry: true, secureTextEntry: true,
@ -143,13 +142,20 @@ const RCTTextInputViewConfig = {
autoCapitalize: true, autoCapitalize: true,
keyboardAppearance: true, keyboardAppearance: true,
passwordRules: true, passwordRules: true,
grammarCheck: true, // [macOS]
spellCheck: true, spellCheck: true,
selectTextOnFocus: true, selectTextOnFocus: true,
text: true, text: true,
clearTextOnFocus: true, clearTextOnFocus: true,
showSoftInputOnFocus: true, showSoftInputOnFocus: true,
autoFocus: true, autoFocus: true,
// [macOS
clearTextOnSubmit: true,
grammarCheck: true,
hideVerticalScrollIndicator: true,
pastedTypes: true,
submitKeyEvents: true,
tooltip: true,
// macOS]
...ConditionallyIgnoredEventHandlers({ ...ConditionallyIgnoredEventHandlers({
onChange: true, onChange: true,
onSelectionChange: true, onSelectionChange: true,
@ -158,6 +164,12 @@ const RCTTextInputViewConfig = {
onChangeSync: true, onChangeSync: true,
onKeyPressSync: true, onKeyPressSync: true,
onTextInput: true, onTextInput: true,
// [macOS
onPaste: true,
onAutoCorrectChange: true,
onSpellCheckChange: true,
onGrammarCheckChange: true,
// macOS]
}), }),
}, },
}; };

Просмотреть файл

@ -327,21 +327,6 @@ type IOSProps = $ReadOnly<{|
*/ */
scrollEnabled?: ?boolean, scrollEnabled?: ?boolean,
// [macOS
/**
* If `true`, hide vertical scrollbar on the underlying multiline scrollview
* The default value is `false`.
* @platform macos
*/
hideVerticalScrollIndicator?: ?boolean,
/**
* If `false`, disables grammar-check.
* @platform macos
*/
grammarCheck?: ?boolean,
// macOS]
/** /**
* If `false`, disables spell-check style (i.e. red underlines). * If `false`, disables spell-check style (i.e. red underlines).
* The default value is inherited from `autoCorrect`. * The default value is inherited from `autoCorrect`.
@ -370,10 +355,26 @@ export type SubmitKeyEvent = $ReadOnly<{|
type MacOSProps = $ReadOnly<{| type MacOSProps = $ReadOnly<{|
/** /**
* If `true`, clears the text field synchronously before `onSubmitEditing` is emitted. * If `true`, clears the text field synchronously before `onSubmitEditing` is emitted.
*
* @platform macos * @platform macos
*/ */
clearTextOnSubmit?: ?boolean, clearTextOnSubmit?: ?boolean,
/**
* If `false`, disables grammar-check.
*
* @platform macos
*/
grammarCheck?: ?boolean,
/**
* If `true`, hide vertical scrollbar on the underlying multiline scrollview
* The default value is `false`.
*
* @platform macos
*/
hideVerticalScrollIndicator?: ?boolean,
/** /**
* Fired when a supported element is pasted * Fired when a supported element is pasted
* *
@ -381,6 +382,36 @@ type MacOSProps = $ReadOnly<{|
*/ */
onPaste?: (event: PasteEvent) => void, onPaste?: (event: PasteEvent) => void,
/**
* Callback that is called when the text input's autoCorrect setting changes.
* This will be called with
* `{ nativeEvent: { enabled } }`.
* Does only work with 'multiline={true}'.
*
* @platform macos
*/
onAutoCorrectChange?: ?(e: SettingChangeEvent) => mixed,
/**
* Callback that is called when the text input's spellCheck setting changes.
* This will be called with
* `{ nativeEvent: { enabled } }`.
* Does only work with 'multiline={true}'.
*
* @platform macos
*/
onSpellCheckChange?: ?(e: SettingChangeEvent) => mixed,
/**
* Callback that is called when the text input's grammarCheck setting changes.
* This will be called with
* `{ nativeEvent: { enabled } }`.
* Does only work with 'multiline={true}'.
*
* @platform macos
*/
onGrammarCheckChange?: ?(e: SettingChangeEvent) => mixed,
/** /**
* Enables Paste support for certain types of pasted types * Enables Paste support for certain types of pasted types
* *
@ -399,6 +430,13 @@ type MacOSProps = $ReadOnly<{|
* @platform macos * @platform macos
*/ */
submitKeyEvents?: ?$ReadOnlyArray<SubmitKeyEvent>, submitKeyEvents?: ?$ReadOnlyArray<SubmitKeyEvent>,
/**
* Specifies the tooltip.
*
* @platform macos
*/
tooltip?: ?string,
|}>; |}>;
// macOS] // macOS]
@ -717,38 +755,6 @@ export type Props = $ReadOnly<{|
*/ */
onChangeText?: ?(text: string) => mixed, onChangeText?: ?(text: string) => mixed,
// [macOS
/**
* Callback that is called when the text input's autoCorrect setting changes.
* This will be called with
* `{ nativeEvent: { enabled } }`.
* Does only work with 'multiline={true}'.
*
* @platform macos
*/
onAutoCorrectChange?: ?(e: SettingChangeEvent) => mixed,
/**
* Callback that is called when the text input's spellCheck setting changes.
* This will be called with
* `{ nativeEvent: { enabled } }`.
* Does only work with 'multiline={true}'.
*
* @platform macos
*/
onSpellCheckChange?: ?(e: SettingChangeEvent) => mixed,
/**
* Callback that is called when the text input's grammarCheck setting changes.
* This will be called with
* `{ nativeEvent: { enabled } }`.
* Does only work with 'multiline={true}'.
*
* @platform macos
*/
onGrammarCheckChange?: ?(e: SettingChangeEvent) => mixed,
// macOS]
/** /**
* DANGER: this API is not stable and will change in the future. * DANGER: this API is not stable and will change in the future.
* *
@ -921,12 +927,6 @@ export type Props = $ReadOnly<{|
*/ */
style?: ?TextStyleProp, style?: ?TextStyleProp,
// [macOS
/*
* Specifies the tooltip.
*/
tooltip?: ?string, // macOS ]
/** /**
* The value to show for the text input. `TextInput` is a controlled * The value to show for the text input. `TextInput` is a controlled
* component, which means the native value will be forced to match this * component, which means the native value will be forced to match this