React Native에서 그라데이션 만들기
react-native-linear-gradient
import LinearGradient from 'react-native-linear-gradient';
<LinearGradient
colors={['rgb(236, 153, 255)', 'rgb(63, 86, 226)']}
start={{x: 0.5, y: 0}}
end={{x: 0, y: 1.0}}
style={styles.background}
/>
해당 라이브러리를 설치하면 그라데이션도 가능하다. 색상만 지정해주면 기본적으로 상하 그라데이션이 나오는데, start와 end를 조절하여 그라데이션 각도를 바꿀 수 있다.
- RN(React Native) 프로젝트에서 react-native-linear-gradient을 사용해서 그라데이션(Gradient) 백그라운드(background)를 만들어 보자. https://dev-yakuza.posstree.com/ko/react-native/react-native-linear-gradient/
- https://github.com/react-native-linear-gradient/react-native-linear-gradient
AsyncStorage.multiSet
if (result.access) {
AsyncStorage.multiSet([
['token', result.access],
['refresh', result.refresh],
]);
if (result.access) {
AsyncStorage.setItem('token', JSON.stringify(result));
}
multiGet도 가능하다. 기본적으로 배열로 여러 개의 key와 value를 넘긴다. get일 때는 여러 개의 key를 넘긴다.
위의 방법은 access_token과 refresh_token을 각각의 key와 value로 나누어 storage에 저장하는 방식이고, 아래의 방법은 객체를 stringify하여 token이라는 하나의 key의 value로 저장하는 방식이다.
Bearer 타입 토큰 보내기
fetch(API.idcheck, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + token,
},
body: JSON.stringify({
identification: idText,
}),
})
에러 - tink 설치
☁ ~ pip3 install tink
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting tink
Using cached tink-1.6.1.tar.gz (174 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
running egg_info
creating /private/var/folders/35/4d74c4fs3m701br9th9wf9lh0000gn/T/pip-pip-egg-info-0b39elqd/tink.egg-info
writing /private/var/folders/35/4d74c4fs3m701br9th9wf9lh0000gn/T/pip-pip-egg-info-0b39elqd/tink.egg-info/PKG-INFO
writing dependency_links to /private/var/folders/35/4d74c4fs3m701br9th9wf9lh0000gn/T/pip-pip-egg-info-0b39elqd/tink.egg-info/dependency_links.txt
writing requirements to /private/var/folders/35/4d74c4fs3m701br9th9wf9lh0000gn/T/pip-pip-egg-info-0b39elqd/tink.egg-info/requires.txt
writing top-level names to /private/var/folders/35/4d74c4fs3m701br9th9wf9lh0000gn/T/pip-pip-egg-info-0b39elqd/tink.egg-info/top_level.txt
writing manifest file '/private/var/folders/35/4d74c4fs3m701br9th9wf9lh0000gn/T/pip-pip-egg-info-0b39elqd/tink.egg-info/SOURCES.txt'
error: Could not find bazel executable. Please install bazel to compile the Tink Python package.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Defaulting to user installation because normal site-packages is not writeable
버전의 문제?
path의 문제?
python setup.py egg_info did not run successfully.
'TIL' 카테고리의 다른 글
[TIL-160] React Native (0) | 2022.04.07 |
---|---|
[TIL-159] React Native (0) | 2022.04.06 |
[TIL-157] React Native - 유효성 검사 (0) | 2022.04.03 |
AWS EC2 프리티어 과금 (0) | 2022.04.03 |
[TIL-156] React Native (0) | 2022.04.01 |