-
Notifications
You must be signed in to change notification settings - Fork 274
feat: User Event type()
#1396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: User Event type()
#1396
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1391c34
feat: userEvent type()
mdjastrzebski 5a39b8e
chore: update snapshots
mdjastrzebski 43545bb
chore: do not expose User Event docs yet
mdjastrzebski d918d62
refactor: simplify dispatchEvent code
mdjastrzebski 1308cff
refactor: press
mdjastrzebski 844bbe5
refactor: move warn method up
mdjastrzebski 1897463
refactor: finishing touches
mdjastrzebski 8284dbb
docs: correct typos
mdjastrzebski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { CommonEventBuilder } from './common'; | ||
import { TextInputEventBuilder } from './text-input'; | ||
|
||
export const EventBuilder = { | ||
Common: CommonEventBuilder, | ||
TextInput: TextInputEventBuilder, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { ContentSize } from '../utils/content-size'; | ||
import { TextRange } from '../utils/text-range'; | ||
|
||
export const TextInputEventBuilder = { | ||
/** | ||
* Experimental values: | ||
* - iOS: `{"eventCount": 4, "target": 75, "text": "Test"}` | ||
* - Android: `{"eventCount": 6, "target": 53, "text": "Tes"}` | ||
*/ | ||
change: (text: string) => { | ||
return { | ||
nativeEvent: { text, target: 0, eventCount: 0 }, | ||
}; | ||
}, | ||
|
||
/** | ||
* Experimental values: | ||
* - iOS: `{"eventCount": 3, "key": "a", "target": 75}` | ||
* - Android: `{"key": "a"}` | ||
*/ | ||
keyPress: (key: string) => { | ||
return { | ||
nativeEvent: { key }, | ||
}; | ||
}, | ||
|
||
/** | ||
* Experimental values: | ||
* - iOS: `{"eventCount": 4, "target": 75, "text": "Test"}` | ||
* - Android: `{"target": 53, "text": "Test"}` | ||
*/ | ||
submitEditing: (text: string) => { | ||
return { | ||
nativeEvent: { text, target: 0 }, | ||
}; | ||
}, | ||
|
||
/** | ||
* Experimental values: | ||
* - iOS: `{"eventCount": 4, "target": 75, "text": "Test"}` | ||
* - Android: `{"target": 53, "text": "Test"}` | ||
*/ | ||
endEditing: (text: string) => { | ||
return { | ||
nativeEvent: { text, target: 0 }, | ||
}; | ||
}, | ||
|
||
/** | ||
* Experimental values: | ||
* - iOS: `{"selection": {"end": 4, "start": 4}, "target": 75}` | ||
* - Android: `{"selection": {"end": 4, "start": 4}}` | ||
*/ | ||
selectionChange: ({ start, end }: TextRange) => { | ||
return { | ||
nativeEvent: { selection: { start, end } }, | ||
}; | ||
}, | ||
|
||
/** | ||
* Experimental values: | ||
* - iOS: `{"eventCount": 2, "previousText": "Te", "range": {"end": 2, "start": 2}, "target": 75, "text": "s"}` | ||
* - Android: `{"previousText": "Te", "range": {"end": 2, "start": 0}, "target": 53, "text": "Tes"}` | ||
*/ | ||
textInput: (text: string, previousText: string) => { | ||
return { | ||
nativeEvent: { | ||
text, | ||
previousText, | ||
range: { start: text.length, end: text.length }, | ||
target: 0, | ||
}, | ||
}; | ||
}, | ||
|
||
/** | ||
* Experimental values: | ||
* - iOS: `{"contentSize": {"height": 21.666666666666668, "width": 11.666666666666666}, "target": 75}` | ||
* - Android: `{"contentSize": {"height": 61.45454406738281, "width": 352.7272644042969}, "target": 53}` | ||
*/ | ||
contentSizeChange: ({ width, height }: ContentSize) => { | ||
return { | ||
nativeEvent: { contentSize: { width, height }, target: 0 }, | ||
}; | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { press, longPress } from './press'; | ||
export { PressOptions, press, longPress } from './press'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.