react-navigation

React navigation ImageBackground displaying white screen

▼魔方 西西 提交于 2021-01-29 05:22:43
问题 Update: Its my AppNavigator thats causing the problem, if I remove it, it displays the background. How can I use ImageBackground with my AppNavigator : const config = { initialRouteName: "Home", contentOptions: { activeTintColor: "#e91e63", itemsContainerStyle: { // opacity: 1 }, iconContainerStyle: { // opacity: 1 }, itemStyle: { flexDirection: "row-reverse" } }, drawerWidth: 300, drawerPosition: "right", drawerBackgroundColor: "transperent" }; const withHeader = ( screen: Function,

<View> overlaps after navigation

流过昼夜 提交于 2021-01-28 22:43:48
问题 My react-native screen looks somewhat like this: export const JourneyResultScreen: React.FunctionComponent = () => { return ( <SafeAreaView style={styles.safeAreaViewContainer}> <View style={styles.container}> <Text>HELO</Text> </View> </SafeAreaView> ); }; const styles = StyleSheet.create({ safeAreaViewContainer: { flex: 1, backgroundColor: 'red'}, container: { flex: 1, backgroundColor: 'pink'}, }); The SafeAreaView (red coloured) works well on all screens except this one, even though I am

React Native app - crash/close on startup on Android 8 real device

江枫思渺然 提交于 2021-01-27 21:20:59
问题 I have a React Native project (not Expo) initialized with react native init myapp . I can run this application on Emulator and Real Device with Android 5, but cannot run the app on my Android Mobile with Android 8. Here's the package.json : { "name": "myapp", "version": "2.0.0", "private": true, "main": "lib/index.js", "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "axios": "^0.18.0", "formik": "^1.5.1", "iso-639-1": "^2.0.3"

Initial route params in React Navigation v5?

笑着哭i 提交于 2021-01-27 06:38:29
问题 React Navigation v3 was featuring an initialRouteParams property to pass initial values to this.navigation.props . Is there a way to set initial route params to be accessed via route.params in the React Navigation v5? function MainScreen({route, navigation}) { return ( // how to pass default values to route in here? // route.params.userParam ? ... ); } 回答1: It could be accomplished by passing initialParams to the Stack.Screen : <Stack.Screen name="Main" component={MainScreen} initialParams={{

Need to show Expandable list view inside navigation drawer

拥有回忆 提交于 2021-01-25 07:22:05
问题 I am an Android Application Developer. I have started working on React-Native. I am unable to find a way to show expandable list inside navigation drawer. Suggest a library if this functionality can be done in that. navigationOptions does not have a way to provide a list (refer code below). I want to show expandable view like item 4 My Code is :- import {DrawerNavigator} from 'react-navigation'; import React, {Component} from 'react'; import { Platform, StyleSheet, Text, Image, View,

TabNavigator extra padding

别说谁变了你拦得住时间么 提交于 2021-01-23 04:53:16
问题 How to style the TabNavigator Tab's height and padding? Im doing the following: import Icon from "react-native-vector-icons/MaterialIcons"; const tabNav = TabNavigator({ TabItem1: { screen: MainScreen, navigationOptions: { tabBarLabel:"Home", tabBarIcon: ({ tintColor }) => <Icon name={"home"} size={20} color={tintColor} /> } }, TabItem2: { screen: MainScreen, navigationOptions: { tabBarLabel:"Home", tabBarIcon: ({ tintColor }) => <Icon name={"home"} size={30} color={tintColor} /> } },

React Navigation 5 Hide Drawer Item

匆匆过客 提交于 2021-01-21 07:36:32
问题 I am trying to hide the ability to press one of my routes in the drawer navigator as it is another navigator and the default location in the app. I want the drawer to simply be used for navigating to extraneous routes that don't fit well into user flow elsewhere. Before React Navigation 5 I was able to achieve this by simply setting drawerLabel: () => null . However now with the changes I cannot figure out how to hide this in the same manner. Below is my current navigator code: const

Passing function as a param in react-navigation 5

只谈情不闲聊 提交于 2021-01-20 23:51:54
问题 NOTE: This query is for react-navigation 5. In react navigation 4 we could pass a function as a param while navigating but in react navigation 5, it throws a warning about serializing params. Basically, what I am trying to do is, navigate to a child screen from parent screen, get a new value and update the state of the parent screen. Following is the way I am currently implementing: Parent Screen _onSelectCountry = (data) => { this.setState(data); }; . . . <TouchableOpacity style={ styles

Passing function as a param in react-navigation 5

 ̄綄美尐妖づ 提交于 2021-01-20 23:51:23
问题 NOTE: This query is for react-navigation 5. In react navigation 4 we could pass a function as a param while navigating but in react navigation 5, it throws a warning about serializing params. Basically, what I am trying to do is, navigate to a child screen from parent screen, get a new value and update the state of the parent screen. Following is the way I am currently implementing: Parent Screen _onSelectCountry = (data) => { this.setState(data); }; . . . <TouchableOpacity style={ styles

How can I curve the top two corners of react-navigation-material-bottom-tabs?

佐手、 提交于 2021-01-20 08:08:01
问题 I am new to react native and I am using react-navigation & react-navigation-material-bottom-tabs . All I want to do is curve the top-right corner and top-left corner of bottom tab bar. My Code: const screen1 = createMaterialBottomTabNavigator( { Home: { screen: HomeScreen, style : { backgroundColor: 'black' } }, About: AboutScreen, Scan: ScanScreen, Fav: AllScreen }, { initialRouteName: "Home", activeColor: 'red', inactiveColor: 'blue', barStyle: { borderWidth: 0.5, borderBottomWidth: 1,