Skip to content

Commit

Permalink
add flow types
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Jul 2, 2024
1 parent d5ddbe8 commit ffb06f8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,14 @@ export type NativeProps = $ReadOnly<{|
* TODO: differentiate between onChange and onChangeText
*/
onChange?: ?BubblingEventHandler<
$ReadOnly<{|target: Int32, eventCount: Int32, text: string|}>,
$ReadOnly<{|
target: Int32,
eventCount: Int32,
text: string,
start: Int32,
count: Int32,
before: Int32,
|}>,
>,

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export type ChangeEvent = SyntheticEvent<
eventCount: number,
target: number,
text: string,
start: number,
count: number,
before: number,
|}>,
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export type ChangeEvent = SyntheticEvent<
eventCount: number,
target: number,
text: string,
start: number,
count: number,
before: number,
|}>,
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'use strict';

import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
import type {ChangeEvent} from 'react-native/Libraries/Components/TextInput/TextInput';
import type {TextStyle} from 'react-native/Libraries/StyleSheet/StyleSheet';

import RNTesterButton from '../../components/RNTesterButton';
Expand Down Expand Up @@ -816,7 +817,7 @@ function MultilineStyledTextInput({
function PartialUpdatesTextInput() {
const [value, setValue] = useState('');

const onChange = ({nativeEvent}) => {
const onChange = ({nativeEvent}: ChangeEvent) => {
console.log('onChange', nativeEvent);
setValue((previousValue) => {
const {count, start, before, text: fullNewText} = nativeEvent;
Expand Down

0 comments on commit ffb06f8

Please sign in to comment.