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 { return (
SafeAreaView, <>
ScrollView, <View>
StatusBar, <Text style={style.Font}>여기는 메인 페이지 입니다.</Text>
StyleSheet, <Text style={style.Font}>아래는 input 테스트를 위한 것입니다.</Text>
Text, <TextInput
useColorScheme, style={style.TextInput}
View, onChangeText={onChangeNumber}
} from 'react-native'; keyboardType="numeric"
/>
<Text>입력한 숫자 보기: {number} </Text>
</View>
<Button
title="월별 페이지로 이동"
onPress={() => navigation.navigate('Monthly')}
/>
<MoneyDB />
</>
)
}
import { const Tab = createBottomTabNavigator();
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
const Section = ({children, title}): Node => { function App() {
const isDarkMode = useColorScheme() === 'dark';
return ( return (
<View style={styles.sectionContainer}> <NavigationContainer>
<Text <Tab.Navigator screenOptions={({ route }) => ({
style={[ tabBarIcon: ({ focused, color, size }) => {
styles.sectionTitle, let iconName;
{
color: isDarkMode ? Colors.white : Colors.black,
},
]}>
{title}
</Text>
<Text
style={[
styles.sectionDescription,
{
color: isDarkMode ? Colors.light : Colors.dark,
},
]}>
{children}
</Text>
</View>
);
};
const App: () => Node = () => {
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = { if (route.name === 'Main') {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, iconName = focused
}; ? 'home'
: 'home-outline';
} else if (route.name === 'Monthly') {
iconName = focused ? 'calendar' : 'calendar-outline';
} else if (route.name === 'Analy') {
iconName = focused ? 'bar-chart':'bar-chart-outline';
}
return ( // You can return any component that you like here!
<SafeAreaView style={backgroundStyle}> return <Ionicons name={iconName} size={size} color={color} />;
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} /> },
<ScrollView })}
contentInsetAdjustmentBehavior="automatic" tabBarOptions={{
style={backgroundStyle}> activeTintColor: 'tomato',
<Header /> inactiveTintColor: 'gray',
<View }}>
style={{ <Tab.Screen name="Main" component={MainScreen} />
backgroundColor: isDarkMode ? Colors.black : Colors.white, <Tab.Screen name="Monthly" component={Monthly} />
}}> <Tab.Screen name="Analy" component={Analy} />
<Section title="Step One"> </Tab.Navigator>
Edit <Text style={styles.highlight}>App.js</Text> to change this </NavigationContainer>
screen and then come back to see your edits.
</Section>
<Section title="See Your Changes">
<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
...@@ -189,7 +189,10 @@ dependencies { ...@@ -189,7 +189,10 @@ dependencies {
implementation "com.facebook.react:react-native:+" // From node_modules implementation "com.facebook.react:react-native:+" // From node_modules
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