Description
Current behavior
I've tried anything from RN 73, Reanimated 2 and 3
import * as React from 'react'
import { View, useWindowDimensions } from 'react-native'
import { TabView, SceneMap } from 'react-native-tab-view'
const FirstRoute = () => (
<View style={{ flex: 1, backgroundColor: '#ff4081' }} />
)
const SecondRoute = () => (
<View style={{ flex: 1, backgroundColor: '#673ab7' }} />
)
const renderScene = SceneMap({
first: FirstRoute,
second: SecondRoute,
})
export default function TabViewExample() {
const layout = useWindowDimensions()
const [index, setIndex] = React.useState(0)
const [routes] = React.useState([
{ key: 'first', title: 'First' },
{ key: 'second', title: 'Second' },
])
return (
<TabView
navigationState={{ index, routes }}
renderScene={renderScene}
onIndexChange={setIndex}
initialLayout={{ width: layout.width }}
/>
)
}
Expected behavior
Render the tab view without crashing
Reproduction
Can't produce
Platform
- Android
- iOS
- Web
- Windows
- MacOS
Packages
- @react-navigation/bottom-tabs
- @react-navigation/drawer
- @react-navigation/material-top-tabs
- @react-navigation/stack
- @react-navigation/native-stack
- react-native-tab-view
Environment
- [] I've removed the packages that I don't use
package | version |
---|---|
"@react-navigation/bottom-tabs": "^6.5.20", | |
"@react-navigation/native": "^6.1.17", | |
"@react-navigation/stack": "^6.3.29", | |
"react-native-safe-area-context": "4.10.1", | |
"react-native-screens": "^3.31.1", | |
"react-native-gesture-handler": "^2.14.0", | |
"react-native-reanimated": "^3.11.0", | |
"react-native-tab-view": "3.5.2", | |
"react-native-pager-view": "^6.3.1", | |
"react-native": "0.74.1", | |
"yarn": "^1.22.4" |