React native 优化

页面跳转优化

import CardStackStyleInterpolator from 'react-navigation/src/views/CardStack/CardStackStyleInterpolator';

const TransitionConfiguration = () => ({
  transitionSpec: {
    duration: 300, // 转场动画时间
  },
  screenInterpolator: (sceneProps) => {
    const { scene } = sceneProps;
    const { route } = scene;
    const params = route.params || {};
    const transition = params.transition || route.transition || 'forHorizontal';
    return CardStackStyleInterpolator[transition](sceneProps);
  },
});

const Configs = {
  headerMode: 'screen',   // 渐变效果
  initialRouteName: 'main',
  transitionConfig: TransitionConfiguration,
};

键盘弹出

android:android/app/src/main/AndroidManifest.xml中,添加
android:windowSoftInputMode="stateAlwaysHidden|adjustPan|adjustResize"
ios: IQKeyBoardManager。

你可能感兴趣的:(React native 优化)