Skip to content

Commit

Permalink
fix(types): ensure types are compatible with React 19
Browse files Browse the repository at this point in the history
release-npm
  • Loading branch information
tobua committed Dec 15, 2024
1 parent f31e502 commit c12fa23
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const useCurrentScreen = () => {

// Register a screen.
export const register = (
Component: JSX.Element,
Component: React.JSX.Element,
name: string,
configuration: { transition?: TransitionInput; background?: string; initial?: boolean } = {
transition: Transition.regular,
Expand Down Expand Up @@ -231,7 +231,7 @@ const renderScreen = (screen: Screen, state: State) => {
)
}

function orderScreens(existingScreens: JSX.Element[], state: State) {
function orderScreens(existingScreens: React.JSX.Element[], state: State) {
existingScreens.sort((firstScreen, secondScreen) => {
const firstName = firstScreen.props['aria-label']
const secondName = secondScreen.props['aria-label']
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@
"types": "tsc && tsc --noEmit --project ./test/tsconfig.json"
},
"devDependencies": {
"@react-native-community/cli": "^14.1.1",
"@react-native/babel-preset": "^0.75.4",
"@react-native/eslint-config": "^0.75.4",
"@react-native/typescript-config": "^0.75.4",
"@types/bun": "^1.1.11",
"@types/jest": "^29.5.13",
"@types/node": "^22.7.5",
"@types/react": "^18.3.11",
"@react-native-community/cli": "^15.1.3",
"@react-native/babel-preset": "^0.76.5",
"@react-native/eslint-config": "^0.76.5",
"@react-native/typescript-config": "^0.76.5",
"@types/bun": "^1.1.14",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.2",
"@types/react": "^19.0.1",
"@types/react-native": "^0.73.0",
"@types/react-test-renderer": "^18.3.0",
"@types/react-test-renderer": "^19.0.0",
"babel-jest": "^29.7.0",
"cpx": "^1.5.0",
"eslint": "8.57.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"react": "^18.3.1",
"react-native": "^0.75.4",
"react-test-renderer": "^18.3.1",
"typescript": "^5.6.3"
"prettier": "^3.4.2",
"react": "18.3.1",
"react-native": "^0.76.5",
"react-test-renderer": "18.3.1",
"typescript": "^5.7.2"
},
"peerDependencies": {
"react": ">= 18",
Expand Down
3 changes: 2 additions & 1 deletion test/utils/render-to-tree.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-env jest */
import type React from 'react'
import renderer, { ReactTestRenderer, act } from 'react-test-renderer'

export default (Navigation: JSX.Element) => {
export default (Navigation: React.JSX.Element) => {
let rendered: ReactTestRenderer | null = null
// act to ensure effects are flushed in initial render.
act(() => {
Expand Down
5 changes: 3 additions & 2 deletions types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type React from 'react'
import type { Animated } from 'react-native'

export type AnimationHandler = (state: State, done: () => void, reverse?: boolean) => (() => void) | null
Expand All @@ -23,7 +24,7 @@ export type TransitionInput = Transition | TransitionString | Animation

export type Screen = {
name: string
Component: JSX.Element
Component: React.JSX.Element
transition: TransitionInput
background: string
props?: Object
Expand All @@ -41,5 +42,5 @@ export type State = {
Top: Screen
Bottom?: Screen
reverse?: boolean
renderedScreens: { [key: string]: { screen: Screen; props: Props; view?: JSX.Element } }
renderedScreens: { [key: string]: { screen: Screen; props: Props; view?: React.JSX.Element } }
}

0 comments on commit c12fa23

Please sign in to comment.