如何在屏幕上导入defaultNavigationOptions属性?

时间:2019-04-11 15:20:51

标签: react-native react-navigation

我正在尝试将react-navigation属性导入到我的屏幕中,问题是我总是为不同的Stack导入相同的defaultNavigationOptions,然后优化要创建为一种函数的代码,所以我只导入它在每个屏幕上显示一次,而无需像我一样多次编写,然后在我的代码中阅读,这样他们就可以了解更多信息。

    const BloquesStack = createStackNavigator(
  {
    BLOQUES: {
      screen: ScreenBloquesRedux,
      navigationOptions: ({ navigation }) => {
        return {
          headerLeft: <ButtonMenu navigation={navigation} />,
          headerRight: <ButtonHome navigation={navigation} />
        };
      }
    },
    DetalleBloques: {
      screen: DetalleBloque
    },
    IntegrantesBloque: {
      screen: IntegrantesBloque
    }
  },
  {
    defaultNavigationOptions: {
      headerBackTitle: "Atras",
      headerTitleStyle: {
        fontFamily: "RobotoCondensed-Regular",
        fontWeight: "100",
        fontSize: 20,
        textAlign: "center",
        color: white,
        flex: 1
      },
      headerStyle: { backgroundColor: blue, height: 60 },
      headerTintColor: white
    }
  }
);
export { BloquesStack };

const ComisionesStack = createStackNavigator(
  {
    COMISIONES: {
      screen: ComisionesRedux,
      navigationOptions: ({ navigation }) => {
        return {
          headerLeft: <ButtonMenu navigation={navigation} />,
          headerRight: <ButtonHome navigation={navigation} />
        };
      }
    }
  },
  {
    defaultNavigationOptions: {
      headerBackTitle: "Atras",
      headerTitleStyle: {
        fontFamily: "RobotoCondensed-Regular",
        fontWeight: "100",
        fontSize: 20,
        textAlign: "center",
        color: white,
        flex: 1
      },
      headerStyle: { backgroundColor: blue, height: 60 },
      headerTintColor: white
    }
  }
export { ComisionesStack };

const DrawerNavigator = createDrawerNavigator(
  {
    Diputados: { screen: DiputadosStack },
    Bloques: { screen: BloquesStack },
    Interbloques: { screen: InterBloquesStack },
    Comisiones: { screen: ComisionesStack },
    Autoridades: { screen: AutoridadesStack },
    "Sesion En Vivo": { screen: SesionEnVivoStack },
    "Diputados TV": { screen: DiputadosTVStack },
    "Reglamentos HCDN": { screen: PDFReglamentosStack }
  },
  {
    contentComponent: CustomDrawerContentComponent,
    drawerWidth: width / 2,
    contentOptions: {
      activeTintColor: white,
      activeBackgroundColor: Gris_Drawer,
      inactiveTintColor: "rgb(105,105,104)",
      itemsContainerStyle: {
        textAlign: "center"
      },
      labelStyle: {
        fontFamily: "RobotoCondensed-Regular",
        fontWeight: "100",
        fontSize: 17,
        marginTop: 8,
        marginLeft: 10
      }
    },
    iconContainerStyle: {
      opacity: 1
    }
  }
);

我只想导入默认的导航选项,我不想修改导航,只想知道是否可以完成。非常感谢您

1 个答案:

答案 0 :(得分:0)

使用SELECT u.*, COUNT(DISTINCT m.message_id) FROM users AS u LEFT JOIN events AS e ON u.user_id = e.user_id AND e.event_type = 'Collection' LEFT JOIN messages AS m ON u.user_id = m.user_id AND m.msg_type = 'Collection Reminder' WHERE u.admin = 0 AND e.event_id IS NULL -- No event of type collection GROUP BY u.user_id -- Note: you should group on all selected fields, and -- some configuration of MySQL will require you do so. HAVING COUNT(DISTINCT m.message_id) < 3 -- Less than 3 collection reminder messages -- distinct is optional, but -- if you were to remove the "no event" condition, -- multiple events could multiply the message count. ;

创建一个单独的对象
defaultNavigationOptions