Commit b57c613d authored by Choi Ga Young's avatar Choi Ga Young
Browse files

초기 환경 설정 - DB

parent c7106918
...@@ -35,6 +35,8 @@ node_modules/ ...@@ -35,6 +35,8 @@ node_modules/
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
package-lock.json
# BUCK # BUCK
buck-out/ buck-out/
\.buckd/ \.buckd/
......
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
const Analy =() =>{
return(
<View>
<Text style={style.Font}>여기는 분석 페이지</Text>
</View>
)
}
const style = StyleSheet.create({
Font: {
fontSize:24
}
});
export default Analy;
\ No newline at end of file
/** import * as React from 'react';
* Sample React Native App import { StyleSheet, View, Text, TextInput, Button } from 'react-native';
* https://github.com/facebook/react-native import { NavigationContainer } from '@react-navigation/native';
* import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
* @format import Ionicons from 'react-native-vector-icons/Ionicons';
* @flow strict-local import Monthly from './Monthly';
*/ import Analy from './Analy';
import MoneyDB from './MoneyDB';
import React from 'react'; function MainScreen({ navigation }) {
import type {Node} from 'react'; const [number, onChangeNumber] = React.useState(null);
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';
import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
const Section = ({children, title}): Node => {
const isDarkMode = useColorScheme() === 'dark';
return ( return (
<View style={styles.sectionContainer}> <>
<Text <View>
style={[ <Text style={style.Font}>여기는 메인 페이지 입니다.</Text>
styles.sectionTitle, <Text style={style.Font}>아래는 input 테스트를 위한 것입니다.</Text>
{ <TextInput
color: isDarkMode ? Colors.white : Colors.black, style={style.TextInput}
}, onChangeText={onChangeNumber}
]}> keyboardType="numeric"
{title} />
</Text> <Text>입력한 숫자 보기: {number} </Text>
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? Colors.light : Colors.dark,
},
]}>
{children}
</Text>
</View> </View>
); <Button
}; title="월별 페이지로 이동"
onPress={() => navigation.navigate('Monthly')}
const App: () => Node = () => { />
const isDarkMode = useColorScheme() === 'dark'; <MoneyDB />
</>
)
}
const backgroundStyle = { const Tab = createBottomTabNavigator();
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
function App() {
return ( return (
<SafeAreaView style={backgroundStyle}> <NavigationContainer>
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> <Tab.Navigator screenOptions={({ route }) => ({
<ScrollView tabBarIcon: ({ focused, color, size }) => {
contentInsetAdjustmentBehavior="automatic" let iconName;
style={backgroundStyle}>
<Header /> if (route.name === 'Main') {
<View iconName = focused
style={{ ? 'home'
backgroundColor: isDarkMode ? Colors.black : Colors.white, : 'home-outline';
} else if (route.name === 'Monthly') {
iconName = focused ? 'calendar' : 'calendar-outline';
} else if (route.name === 'Analy') {
iconName = focused ? 'bar-chart':'bar-chart-outline';
}
// You can return any component that you like here!
return <Ionicons name={iconName} size={size} color={color} />;
},
})}
tabBarOptions={{
activeTintColor: 'tomato',
inactiveTintColor: 'gray',
}}> }}>
<Section title="Step One"> <Tab.Screen name="Main" component={MainScreen} />
Edit <Text style={styles.highlight}>App.js</Text> to change this <Tab.Screen name="Monthly" component={Monthly} />
screen and then come back to see your edits. <Tab.Screen name="Analy" component={Analy} />
</Section> </Tab.Navigator>
<Section title="See Your Changes"> </NavigationContainer>
<ReloadInstructions />
</Section>
<Section title="Debug">
<DebugInstructions />
</Section>
<Section title="Learn More">
Read the docs to discover what to do next:
</Section>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
); );
}; }
const styles = StyleSheet.create({ const style = StyleSheet.create({
sectionContainer: { TextInput: {
marginTop: 32, borderColor: 'skyblue',
paddingHorizontal: 24, height: 40,
}, margin: 12,
sectionTitle: { borderWidth: 1
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
}, },
Font: {
fontSize: 24
}
}); });
export default App; export default App;
import SQLite from 'react-native-sqlite-storage';
import { View, Text, StyleSheet } from 'react-native';
import React, { useEffect } from 'react';
SQLite.DEBUG(true);
SQLite.enablePromise(false);
const database_name = "MyMoney.db";
const database_version = "1.0"
const database_displayname = "SQLite Test Database";
const database_size = 200000;
let db;
function MoneyDB() {
console.log('money db')
const loadAndQueryDB = () => {
db = SQLite.openDatabase(database_name, database_version, database_displayname, database_size, () => { console.log('load db') }, error => console.log(error.message));
};
useEffect(() => {
loadAndQueryDB()
}, [])
return (
<>
<View>
<Text>DB</Text>
</View>
</>
)
}
export default MoneyDB
\ No newline at end of file
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
const Montly =() =>{
return(
<View>
<Text style={style.Font}>여기는 월별 페이지</Text>
<Text style={style.Font}>달력을 추가할 예정입니다.</Text>
</View>
)
}
const style = StyleSheet.create({
Font: {
fontSize:24
}
});
export default Montly;
\ No newline at end of file
...@@ -190,6 +190,9 @@ dependencies { ...@@ -190,6 +190,9 @@ dependencies {
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation project(':react-native-sqlite-storage')
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni' exclude group:'com.facebook.fbjni'
} }
......
...@@ -7,6 +7,7 @@ buildscript { ...@@ -7,6 +7,7 @@ buildscript {
compileSdkVersion = 29 compileSdkVersion = 29
targetSdkVersion = 29 targetSdkVersion = 29
ndkVersion = "20.1.5948944" ndkVersion = "20.1.5948944"
supportLibVersion = "27.0.0"
} }
repositories { repositories {
google() google()
......
rootProject.name = 'rich_maker' rootProject.name = 'rich_maker'
include ':react-native-sqlite-storage'
project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/src/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app' include ':app'
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment