MaterialPageRoute |
| Material 디자인 스타일로 페이지 전환하는 라우트 객체 |
MaterialPageRoute |
| Material 디자인 스타일로 페이지 전환하는 라우트 객체 |
Mobile-First Approach: With over 59.5% of web traffic originating from mobile devices, designing for mobile-first is no longer an option but a necessity. Responsive layouts, meta viewport tags, and layout simplifiers like Flexbox are pivotal to success in web development.
Page Speed Optimization: In today's fast-paced digital world, users expect websites to load instantly. Google's ranking algorithms prioritize fast-loading websites. Techniques like image compression, code minification, and content delivery networks (CDNs) are vital for optimal page loading times.
Voice Search Integration: Voice assistants are becoming integral to accessing information. Developers are optimizing websites for voice search, ensuring accessibility and adaptability to changing user preferences.
Gradient Colors and Glassmorphism: Gradient colors and glassmorphism design elements are enhancing visual appeal. Gradient designs bring creativity and personality to web interfaces, while glassmorphism adds depth and texture.
Progressive Web Applications (PWAs): PWAs combine web and mobile app features, offering seamless offline functionality and app-like experiences. They are gaining traction as versatile web solutions.
AI Chatbots: AI chatbots are improving customer service with round-the-clock support and streamlined interactions. They are employed for user engagement, answering queries, and initiating sales conversations.
Interconnected Web Applications: API-first development is fostering interconnected web applications. This trend enables seamless data sharing between apps, creating a more cohesive web experience.
As we enter 2023, web development's evolution is marked by these seven trends. Adapting to this dynamic landscape will be pivotal for web developers and businesses aiming to succeed in the digital realm. The web's future is exciting, and those who embrace these innovations will lead the way.
In the realm of mobile app development, React Native emerges as a prominent open-source framework created by Facebook. This powerful tool allows developers to craft mobile applications for iOS, Android, Web, and UWP simultaneously, all while writing code in JavaScript.
Understanding Cross-Platform Development
To fully grasp React Native's significance, it's crucial to understand the concept of cross-platform development. This approach enables developers to create applications that can run on multiple platforms, saving time and resources. React Native, alongside frameworks like Flutter, serves as a prime example of a cross-platform solution.
1. React Native Development Methods
React Native development can be approached in two primary ways: Expo CLI and React Native CLI.
A. Expo CLI
Pros:
Ease of Initial Setup: Expo CLI simplifies the setup process, making it incredibly straightforward for beginners.
Abundance of Libraries and Plugins: The Expo ecosystem offers a rich selection of libraries and plugins, enhancing development efficiency.
Cons:
App Size: Apps developed with Expo tend to have larger file sizes.
Build Speed: The build process might be slower compared to React Native CLI.
Limited Native Module Support: Expo restricts the usage of native modules, limiting certain functionalities.
B. React Native CLI
Pros:
Fast Build Speed: React Native CLI offers a quicker build speed compared to Expo.
High Freedom with Native Modules: Developers have greater freedom to use native modules.
Interaction with OS Layer: It enables direct interaction with the operating system layer.
Cons:
Complex Setup: Setting up a project with React Native CLI can be complex and time-consuming.
Platform-Specific Setup: You need to install Android Studio and Xcode for building and deploying on Android and iOS.
Mac OS Dependency: Building iOS apps requires a Mac OS environment.
2. Expo CLI Quickstart
To start with Expo CLI, follow these steps:
Create a React Native project using Expo: $ expo init [project name]
Install Expo globally: $ npm install -g expo-cli or $ yarn global add expo-cli
3. React Native CLI Quickstart
For React Native CLI, follow these steps:
Create a React Native project: $ npx react-native init [project name]
Optionally specify a version: $ npx react-native init [project name] --version X.XX.X
For TypeScript-based projects: $ npx react-native init [project name] --template react-native-template-typescript
Install types for React and React Native: $ yarn add @types/react @types/react-native --dev
In Conclusion
React Native is a game-changing framework that facilitates cross-platform mobile app development. Whether you opt for Expo CLI for its simplicity or React Native CLI for more advanced, platform-specific development, React Native provides a versatile toolkit for crafting efficient, responsive, and visually appealing mobile applications. Understanding your project's requirements and your own development expertise will help you choose the right approach. Happy coding!
1. pyinstall.exe -F main.py 실행해서 spec파일 생성
2. spec 파일에 아래와 같이 추가
datas=[
[
"C:\\Python311\\Lib\\site-packages\\autoit\\lib\\AutoItX3_x64.dll",
"autoit\\lib"
]
],
hiddenimports=["autoit.init", "autoit.autoit", "autoit.control",
"autoit.process", "autoit.win"],
3. pyinstall.exe main.spec 실행
참조
https://stackoverflow.com/questions/59190771/pyinstaller-oserror-cannot-load-autoitx-from-path
1. 클로저
x = 10 # 전역변수
def foo():
global x
x = 11
print(x)
foo()
print(x) # 출력
파이썬은 그냥 바로 선언하면 전역변수임
그 전역변수를 함수에서 사용하려면 global 로 지정해야됨
2. 언더바 사용
값을 무시하고 싶을때
x,_,y = 1,2,3
이렇게 선언하면 중간의 2 값은 무시하고
x는 1, y는 3으로 선언됨
x,*_,y = 1,2,3,4,5
이렇게하면 중간 값들은 다 생략하고 1, 5 만 선언됨
for을 사용할때 index가 필요 없을떄
for _ in range(10):
-> 인덱스가 필요없고 그냥 10번 반복하고 싶을때
메소드에 _가 붙을때
-> 외부 사용자가 사용하지 말라는 권유의 문법 / 만약 import * 를 하면 _가 앞에붙어있는 변수나 메소드는 호출이 되지 않음
-> 매직 메소드 / 클래스를 작성할때 __init__ , __str__ 등의 사용
3. dfs , bfs 파이썬으로 구현
def bfs(v):
q = deque()
q.append(v)
visit_list[v] = 1
while q:
v = q.popleft()
print(v, end = " ")
for i in range(1, n + 1):
if visit_list[i] == 0 and graph[v][i] == 1:
q.append(i)
visit_list[i] = 1
#스택
def dfs(v):
q = deque()
q.append(v)
while q:
v = q.pop()
if visit_list2[v] == 0:
visit_list2[v] = 1
print(v, end = " ")
temp = deque()
for i in range(1, n + 1):
if visit_list2[i] == 0 and graph[v][i] == 1:
temp.append(i)
temp.reverse()
q = q + temp
노드 버전
node --version
-> https://nodejs.org/ko/ 에서 최신 버전 다운
https://dev-pengun.tistory.com/entry/%EB%94%94%EB%8D%B0%EC%9D%B4-%EC%95%B1-%EB%94%B0%EB%9D%BC-%EB%A7%8C%EB%93%A4%EB%A9%B0-%EB%B0%B0%EC%9A%B0%EB%8A%94-React-Native-3-%EB%A0%88%EC%9D%B4%EC%95%84%EC%9B%83-%EA%B5%AC%EC%84%B1%ED%95%98%EA%B8%B0?category=888305
TouchableOpacity
- 이미지를 터치할 수 있게함
<TouchableOpacity>
<Image source={require('./icon/setting.png')}/>
</TouchableOpacity>
flexDirection
- 정렬방식 변경
const styles = StyleSheet.create({ container: { flex: 1, }, settingView: { flex: 1, backgroundColor: 'red', }, ddayView: { flex: 6, backgroundColor: 'green', flexDirection: 'row', }, chatView: { flex: 6, backgroundColor: 'blue', }, });
justifyContent
- 컨텐츠를 어떻게 배치할건지
const styles = StyleSheet.create({ container: { flex: 1, },- settingView: { flex: 1, backgroundColor: 'red', justifyContent: 'center', }, ddayView: { flex: 6, backgroundColor: 'green', justifyContent: 'center', }, chatView: { flex: 6, backgroundColor: 'blue', }, });
alignSelf는 alignItem과 같은 효과를 가지지만, 자식 컴포넌트에게 작성하여, 그 자식컴포넌트만 따로 지정해줄 수 있는 옵션입니다.
borderRadius
- 모서리 둥글
backgroundColor: 'rgba(201,201,201,0.7)',
- 투명하게
onPress={()=>this.props.titleHandler(this.state.title,this.state.date)}>
onPress={this.props.modalHandler}/>
이벤트 핸들러에 화살표 함수를 사용하여 감싼 다음에 매개변수를 넘겨줄 수 있습니다.
<button onClick={() => this.handleClick(id)} />.bind를 호출한 것과 같습니다.
<button onClick={this.handleClick.bind(this, id)} />주의
Function.prototype.bind를 render 메서드에서 사용하면 컴포넌트가 렌더링할 때마다 새로운 함수를 생성하기 때문에 성능에 영향을 줄 수 있습니다.
따라서 해당 정보들을 저장할 필요가 있는데. AsyncStorage를 이용해서 기기내에 저장하겠습니다.
react-native-async-storage.github.io/async-storage/docs/install/
그리고 UNSAGE_componentWillMount()라는 함수를 작성해줍니다.
react native는 컴포넌트가 mount, update, unmount라는 크게 세가지의 상태가 있습니다.
componentWillMount라는 함수의 이름에서 볼 수 있듯이, 마운트가 되기전 호출되는 함수입니다.
마운트는 렌더링을 포함하는 단계인데 쉽게말해 렌더링되기 전에 호출되는 함수라고 생각하시면 됩니다.
async에 대해서 아직 잘 모르시는분은 developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/async_function를 읽어보시면 좋을 것 같습니다.
asyncStorage작업이 실패할 수 있기 때문에 try, catch문으로 감싸게됩니다.
navigate - go to another screen, figures out the action it needs to take to do it
goBack - close active screen and move back in the stack
addListener - subscribe to updates to navigation lifecycle
isFocused - function that returns true if the screen is focused and false otherwise.
state - current state/routes
setParams - make changes to route's params
getParam - get a specific param with fallback
dispatch - send an action to router
dangerouslyGetParent - function that returns the parent navigator, if any
const {navigation}=this.props;
navigation.navigate("screens","{parameters}")
state ={ id:"" }; handle=text=>{ this.setState({id:text}); };
state={ id:"", pass:"" } setIdPass=data=>{ this.setState(data); } onPress=()=>{ this.props.navigation.navigate("Register",{setIdPass:this.setIdPass}) }
goBack=(data)=>{ const {navigation}=this.props; navigation.state.params.setIdPass(data) navigation.goBack(); }parameter로 받은 메소드를 navigation.state.params.setIdPass()로 실행시킨다.
import { createBottomTabNavigator } from 'react-navigation-tabs'; import { createAppContainer } from 'react-navigation'; // 하단 탭에 들어갈 컴포넌트들 import HomeTab from '../screens/tab/HomeTab' import SecondTab from '../screens/tab/SecondTab' // 하단 탭 네비게이터 생성 const AppTabNavigator = createBottomTabNavigator({ HomeTab: { screen: HomeTab }, SecondTab: { screen: SecondTab }, }); const AppTabContainet = createAppContainer(AppTabNavigator); export default AppTabContainet;
import React, { Component } from 'react'; import { View, Text, StyleSheet } from 'react-native'; export default class HomeTab extends Component { render() { return ( <View style={style.container}> <Text>HomeTab</Text> </View> ); } } const style = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', } });
return ( <AppTabContainet/> );
import React, {Component} from 'react'; import {StyleSheet, Text, View, Image} from 'react-native'; import CustomButton from './CustomButton'; type Props = {}; export default class App extends Component<Props> { render() { return ( <View style={styles.container}> <View style={styles.header} /> <View style={styles.title}> <Text style={{fontSize:35,color:'white'}}>새로운 일상의 시작{'\n'}지금 카카오미니를{'\n'}연결해보세요.</Text> </View> <View style={styles.content}> <Image style={{height:'100%',width:'100%',resizeMode:'contain'}} source={require('./img.png')}/> </View> <View style={styles.footer}> <CustomButton buttonColor={'#444'} title={'회원가입'} onPress={() => alert('회원가입 버튼')}/> <CustomButton buttonColor={'#023e73'} title={'로그인'} onPress={() => alert('로그인 버튼')}/> </View> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, padding: 10, backgroundColor: 'black', }, header: { width:'100%', height:'5%', backgroundColor: 'black', }, title: { width:'100%', height:'18%', justifyContent: 'center', backgroundColor: 'black', }, content: { flex: 1, justifyContent: 'center', alignItems: 'center', paddingBottom:30, backgroundColor: '#d6ca1a', }, footer: { width:'100%', height:'20%', //backgroundColor: '#1ad657', }, });
import React, { Component } from 'react'; import { TouchableOpacity, Text, StyleSheet, } from 'react-native'; export default class CustomButton extends Component{ static defaultProps = { title: 'untitled', buttonColor: '#000', titleColor: '#fff', onPress: () => null, } constructor(props){ super(props); } render(){ return ( <TouchableOpacity style={[ styles.button, {backgroundColor: this.props.buttonColor} ]} onPress={this.props.onPress}> <Text style={[ styles.title, {color: this.props.titleColor} ]}>{this.props.title}</Text> </TouchableOpacity> ) } } const styles = StyleSheet.create({ button: { flex: 1, alignItems: 'center', justifyContent: 'center', marginBottom: 10, borderRadius: 5, }, title: { fontSize: 15, }, });
Scaffold - 화면 뼈대 역할 - 기본적으로 AppBar body floatingActionButton 같은걸 배치해줌 return Scaffold ( appBar : AppBar ( title : const Text ...