Repository navigation
refactor: fix types for the React Native strict TypeScript API - #7846
diegolmello wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Component ref and prop types app/containers/ActionSheet/*, app/containers/CustomFields/index.tsx, app/containers/GestureButtons/types.ts, app/containers/InAppNotification/IncomingCallNotification/index.tsx, app/containers/NativeButton/index.tsx, app/containers/RoomTypeIcon/*, app/containers/TextInput/*, app/definitions/ILivechatEditView.ts, app/views/E2EEncryptionSecurityView/ChangePassword.tsx, app/views/ProfileView/index.tsx, app/views/RegisterView/index.tsx, app/views/CategoryView/components/SectionPills.tsx, app/views/RoomView/components/JoinCode.tsx |
Input refs now use the shared TextInputInstance type. Other component refs and style props use React Native component and style types. NativeButton now accepts INativeButtonProps. |
React Native API typing and imports app/containers/Touch.tsx, app/containers/message/components/Touchable/Touch.tsx, app/containers/message/hooks/useMessageAccessibilityActions.ts, app/lib/services/voip/MediaCallEvents.ts, app/views/RoomView/List/components/InvertedScrollView.tsx, app/views/RoomView/List/hooks/useFloatingDate.ts, patches/react-native-easy-grid+0.2.2.patch, tsconfig.json |
Accessibility, event subscription, and viewability declarations now use React Native API types. The message touchable wraps each platform-specific component with withKeyboardFocus. The codegen import, grid declarations, and TypeScript custom condition are also updated. |
Event and submission handling app/containers/UIKit/DatePicker.tsx, app/views/ForgotPasswordView.tsx, app/views/LoginView/UserForm.tsx, app/views/SetUsernameView.tsx, app/views/RoomsListView/components/SectionHeader.tsx |
Date and Android picker updates run without unstable_batchedUpdates. Submit-editing callbacks invoke the handlers returned by handleSubmit. SectionHeader skips measurement when event.currentTarget is numeric. |
List and input rendering props app/views/CannedResponsesListView/index.tsx, app/views/DirectoryView/index.tsx, app/views/DiscussionsView/index.tsx, app/views/MessagesView/index.tsx, app/views/SearchMessagesView/index.tsx, app/views/SelectedUsersView/index.tsx, app/views/ShareListView/index.tsx, app/views/ThreadMessagesView/index.tsx, app/containers/MessageComposer/components/ComposerInput.tsx, app/views/ShareView/* |
List footer fallbacks use undefined when no footer is rendered. The composer placeholder receives pointerEvents: 'none' through its style, and the ShareView text alignment moves to its style definition. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Refactor
Suggested labels: type: chore
Suggested reviewers: otaviostasiak, rohit3523
Merge Risk: 
Minimal · up to 3a162
-
No identified issue blocks merging after the normal checks.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 38 files. (2 skipped: 2 unsupported.)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Errors were encountered while retrieving linked issues.
Errors: 1
-
- JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Android Build Available Rocket.Chat 4.78.0.110102 Internal App Sharing: https://play.google.com/apps/test/RQQ8k09hlnQ/ahAO29uNSCKwiPdabpKY_yJ4Pfn0QOCC6iLXyF3_t0tks_HtXGwA56aDiAlWk8U-1gPyRJPCACr4rPVTCWHM0cMjMl |
|
iOS Build Available Rocket.Chat 4.78.0.110104 |
Proposed changes
React Native 0.87 makes the strict TypeScript API (
types_generated) the default. On 0.86 it is opt-in through thereact-native-strict-apicustom condition. This PR turns it on intsconfig.jsonand fixes the 69 type errors it reports. Every fix also compiles against the default types, sotscpasses in both modes.ComponentRef<typeof X>. Under the strict API, the component name is no longer an instance type. TextInput refs share a newTextInputInstancetype fromcontainers/TextInput.ListFooterComponentgetsundefinedinstead ofnull.handleSubmitis wrapped ononSubmitEditing, since its handler type no longer matches the strict event type.ViewTokenis now derived fromFlatListProps.AccessibilityActionInfobecomesAccessibilityProps['accessibilityActions'].measureInWindowis guarded against a numeric press target.addListenershape shared byNativeEventEmitterandDeviceEventEmitter.codegenNativeCommandsis imported fromreact-nativeinstead of a deep import.pointerEventson the composer placeholderTextandtextAlignVerticalon the ShareView input move into their StyleSheets. The strict types only accept them as styles.styleto a plain view style.unstable_batchedUpdates. React 19 already batches these updates.react-native-easy-grid's typings referenced the removedViewPropertiestype. A typings-only patch switches it toViewProps.No runtime behaviour change is intended. On 0.86 the strict API reports no InteractionManager or react-native-webview errors, so this PR does not depend on the PRs that handle those.
Issue(s)
https://rocketchat.atlassian.net/browse/NATIVE-1828
How to test or reproduce
pnpm tscand confirm it passescustomConditionsfromtsconfig.json, runpnpm tscagain, and confirm it still passesScreenshots
Types of changes
Checklist
Further comments
app/flatListStrictMode.d.tsstays because the default FlatList types on 0.86 don't includestrictMode.Summary by CodeRabbit