목록React,React-Native (27)
YESHTML5

맥북과 iMac의 작업환경이 조금 차이가 있다보니, 왔다갔다 하며 업무를 진행한다. Homebrew를 이용해서 업데이트 설치시 문제가 생긴 현황 화면에서도 오류 명령어를 알려주긴 하지만, 알아두면 좋을것 같아 기록해둔다. 참고블로그: https://yoshikixdrum.tistory.com/229 [Homebrew] homebrew-core is a shallow clone 에러 해결하기. Homebrew를 이용해 패키지를 설치하려고 하는 도중에 나온 문제로 homebrew-core is a shallow clone. 와 homebrew-cask is a shallow clone. 같이 에러가 나오면서 패키지를 업데이트를 할 수 없다.. yoshikixdrum.tistory.com
pod install 중에 다음과 같은 에러가 발생했다. [!] Error installing NMapsMap [!] /usr/bin/git clone https://github.com/navermaps/NMapsMap.git /var/folders/np/kql39mdx7576fmh_nzsm58240000gn/T/d20220526-76914-19amcn --template= --single-branch --depth 1 --branch release/3.15.0 Cloning into '/var/folders/np/kql39mdx7576fmh_nzsm58240000gn/T/d20220526-76914-19amcn'... Note: switching to 'b7ba615aa9d87c5b985b73e1a48..
CocoaPods 제거 및 인스톨 rm -rf ~/Library/Caches/CocoaPods. rm -rf Pods. rm -rf ~/Library/Developer/Xcode/DerivedData/* pod deintegrate. pod setup. pod install. 참고페이지 https://eunjin3786.tistory.com/112 [Cocoapod] Cocoapod 명령어 모음 [1] Podfile.lock을 여는 명렁어 open podfile.lock [2] cocoapod 버전 업그레이드 아래 명령어로 현재 버전을 확인하고 pod --version 원하는 버전으로 업데이트 시켜주세요 sudo gem install cocoapods -v 1.9.. eunjin3786.tistory.com
useState에서 Object 즉 JSON형태로 저장한다. 이전에 값이 있는경우 대체되어버리기때문에, 기존의값 그대로 뒤에로 override형태로 덮어쓴다. const [json, setJson] = useObject({ title: 'test' }) 형태로 사용하고 싶어서, 만든 코드 올려본다. /** * @name useObject * @description */ import {useCallback, useState} from 'react' // Hook export const useObject = (initialState: {} = {}): any => { // Initialize the state const [state, setState] = useState(initialState) const ..
RestAPI 를 할때 axios를 많이 사용한다. 조금더 유용하게 사용하기위해 hooks 기반으로 만들었고, loading, error 로 같이 받을수 있게 해두었다. 코드는 다음과 같다. /** * @name useAxios * @description hooks기반 fetch */ import {useState} from 'react' import axios from 'axios' export const useAxios = (_url?: string, _options = {}) => { const [result, setResult] = useState('') // *-------------- result const [loading, setLoading] = useState(null) // *-----..
boolean 형태의 true, false 는 useState형태로 금방 만들수는 있겠지만 hooks로 공통으로 해두면 추후 GA 이벤트나 로깅할때 공통처리해서도 사용할수 있다. 코드올려본다. /** * @name useToggle * @description 사용법 */ import {useCallback, useState} from 'react' export const useToggle = (initialState: boolean = false): [boolean, any] => { // hooks const [state, setState] = useState(initialState) const toggle = useCallback((): void => setState(state => !state), ..

ReactNative에서 Image를 할때 불러들이는 이미지 크기가 다양하다. 이미지의 가로형, 세로형에 맞춰서 컨트롤이 필요한데, resizeMode가 있긴하지만, hook로 이미지의 크기에 맞게 보여주고자한다. 코드는 아래와 같다. 사용하면서 더 추가기능이 필요하겠지만, 우선 당장 개발중인 "unsplash' 이미지 갤러이에는 적용될수 있을거 같다. /** * @name useImage * @description */ import React, {useEffect, useState} from 'react' import {StyleSheet, StyleProp, View, Image, ViewStyle, Dimensions} from 'react-native' // *--------------------..

아직 앱에 넣지는 않고, 스터디 차원에서 서칭을 해보았다. 위의 내용으로 스터디이후 앱에다 심어서 봐야겠다. GPS 및 지도도 hooks로 만들면 다음에 유용할듯 싶다. https://dev.to/cecheverri4/google-maps-geolocation-and-unit-test-on-react-native-4eim Google Maps, Geolocation and Unit Test on React Native In this tutorial, we will build a Taxi App for both iOS & Android using React Native CLI. Also,... dev.to
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory. 빌드가 되지않아 pod install 다시해보고, 이 조차 안되어서 sudo gem install cocoapods 작동되지 않았다. 그냥 다시 ruby2.6 버젼때 설치해주었다. rbenv global 2.6.3 그리고 나니 Error: Running Homebrew as root is extremely dangerous and no longer supported. As..

현재 운영중인 서비스에 버젼정보에 v3.1.x 형태를 "설정" 쪽에 보여준다. 이값으로 firebase의 config 설정이나, 다른 서버에서 값을 받아서 특정버젼보다 낮으면 강제업데이트를 시킨다. 가장기본이 되는 버젼정보를 표시하는 모듈 "react-native-device-info" 많이 사용하는것 같다. https://github.com/react-native-device-info/react-native-device-info GitHub - react-native-device-info/react-native-device-info: Device Information for React Native iOS and Android Device Information for React Native iOS and..