如何在react-native中淡入以打开其他屏幕?

时间:2019-06-12 13:17:37

标签: react-native react-native-android

我在场景中有5个屏幕。我想要的是,当我在屏幕之间移动时,我想淡入淡出地打开下一页。可以吗?

这些是我的屏幕:

  <Scene key="Main" duration={0}  hideNavBar >
              <Scene key="user" component={UserScreen}  initial/>
              <Scene key="selectRota" component={ChooseRota} />
              <Scene key="passengerScreenOne" component={passengerScreenOne}/>
              <Scene key="passengerScreenTwo"  component={passengerScreenTwo}  />
              <Scene key="passengerScreenThree" component={passengerScreenThree} />
  </Scene> 

1 个答案:

答案 0 :(得分:0)

使用React Native导航和react native navigation transition

import { createStackNavigator } from 'react-navigation';
import { fadeIn } from 'react-navigation-transitions';
import ScreenA from './ScreenA';
import ScreenB from './ScreenB';

const appStack = createStackNavigator(
{
ScreenA: {
  screen: ScreenA,
},
ScreenB: {
  screen: ScreenB,
},
},
{
  initialRouteName: 'ScreenA',
  transitionConfig: () => fadeIn(),
},
);