无法在具有反应导航液过渡的屏幕之间导航

时间:2019-09-08 15:04:59

标签: reactjs react-native react-navigation expo

我正在用本机创建一个应用程序,并发现FluidTransitions库具有一些动画等。而且我还需要react-navigation在屏幕之间导航。我的问题是我无法在具有过渡的2个屏幕之间导航,出现此错误:

TypeError: TypeError: undefined is not an object (evaluating 'this._callListeners.bind')
- node_modules\react-native\Libraries\Animated\src\AnimatedEvent.js:94:46 in AnimatedEvent
- node_modules\react-native\Libraries\Animated\src\AnimatedImplementation.js:504:42 in event
- ... 37 more stack frames from framework internals

但是在“正常”屏幕(无过渡)和具有过渡的屏幕之间导航是没有问题的。

App.tsx

import { FluidNavigator } from 'react-navigation-fluid-transitions';
import { createSwitchNavigator, createAppContainer } from 'react-navigation';

import Test1 from "./views/TestOne"
import Test2 from "./views/TestTwo"

const store = createStore()
configure({ enforceActions: "always" })

export default observer(() => {
    const [state, setState] = useState({ isReady: false })

    const AppSwitchNavigator = FluidNavigator({
        screen1: { screen: Test1 },
        screen2: { screen: Test2 },
    })

    const AppContainer = createAppContainer(AppSwitchNavigator);

    return (
        <StoreContext.Provider value={store}>
            <AppContainer />
        </StoreContext.Provider>
    )
})

TestOne.tsx

<TouchableOpacity
    activeOpacity={1}
    style={styles.container}
    onPress={() => props.navigation.navigate('screen2')}>
    <Transition shared='paper'>
        <View style={styles.paper} />
    </Transition>
    <Transition appear='horizontal'>
        <View style={styles.headerContainer}>
            <Text style={styles.header}>THE TEN</Text>
            <Text style={styles.subheader}>AIR JORDAN I</Text>
        </View>
    </Transition>
    <Transition shared='shoe'>
        <Image style={styles.shoe} source={require('../../assets/img/shoe.png')} />
    </Transition>
</TouchableOpacity>

package.json

"react-navigation": "^3.0.0",
"react-navigation-fluid-transitions": "^0.3.2",

0 个答案:

没有答案