728x90
반응형
import React, { Component } from 'react';
import { View, Text, FlatList,TouchableOpacity } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
const Tab = createBottomTabNavigator();
class App extends Component {
render() {
return (
<NavigationContainer>
<Tab.Navigator
tabBarOptions = {
{
/* style: {
elevation: 4,
marginBottom:10,
marginTop:10
} */
// 탭바 위의 쉐도우
style: { borderTopWidth: 2, elevation: 8 ,}
}
}
>
<Tab.Screen
name="Home"
component={HomeScreen}
options ={
{
// 아이콘 적용하기 (focused 된 경우 아이콘의 source 를 변경 해주면된다. )
/* tabBarIcon: ({ focused }) => {
return (
<View
style={{
height: 30,
width: 30,
backgroundColor: focused ? 'green' : 'red'
}}>
</View>)
}, */
// 탭바에서 숨기기
// tabBarButton: (props) => {return(<View></View>)}
}
}
/>
<Tab.Screen name="Settings" component={SettingsScreen} />
</Tab.Navigator>
</NavigationContainer>
)
}
}
class HomeScreen extends Component {
render(){
return(
<View style = {{flex:1, justifyContent:'center' , alignItems:'center'}}>
<Text>home Screen </Text>
</View>
)
}
}
class SettingsScreen extends Component {
render(){
return(
<View style = {{flex:1, justifyContent:'center' , alignItems:'center'}}>
<Text>SettingsScreen</Text>
</View>
)
}
}
export default App;
728x90
반응형
'React Native' 카테고리의 다른 글
react native 인디케이터 중앙 배치 (0) | 2020.07.10 |
---|---|
애니메니션 - slide up (0) | 2020.07.08 |
ref 사용법 (0) | 2020.06.24 |
react native android windowSoftInputMode (0) | 2020.06.17 |
업데이트 로그박스 (0) | 2020.06.16 |