Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to change colour of selected icon in the BottomNavigation component of React Native Paper?

$
0
0

I have the next page that uses BottomNavigation:

import React from 'react'import {  BottomNavigation,  DefaultTheme,  Provider as PaperProvider,} from 'react-native-paper'import ChatScreen from './presentation/screens/ChatScreen'import HomeScreen from './presentation/screens/HomeScreen'import MapScreen from './presentation/screens/MapScreen'import PostScreen from './presentation/screens/PostScreen'import ProfileScreen from './presentation/screens/ProfileScreen'const App = () => {  const [index, setIndex] = React.useState(0)  const [routes] = React.useState([    {key: 'home', icon: 'home'},    {key: 'map', icon: 'compass'},    {key: 'post', icon: 'plus-box'},    {key: 'profile', icon: 'account'},    {key: 'chat', icon: 'forum'},  ])  const renderScene = BottomNavigation.SceneMap({    home: HomeScreen,    map: MapScreen,    post: PostScreen,    profile: ProfileScreen,    chat: ChatScreen,  })  return (<PaperProvider theme={lightTheme}><BottomNavigation        labeled={false}        navigationState={{index, routes}}        onIndexChange={setIndex}        renderScene={renderScene}      /></PaperProvider>  )}export default App

This code uses a default icon tint colour from the theme. However, how to use a different colour for every icon?

Screenshots


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>