728x90
반응형

react-native run-android --mode release #android

react-native run-ios --configuration Release #ios

728x90
반응형
728x90
반응형

redux 툴킷을 상요하지않다가 이번에 사용을 하면서

 

기존

const store = createStore(rootReducer, applyMiddleware(myLogger, logger));

const store = createStore(reducer, composeWithDevTools(
  applyMiddleware(...middleware),
  // other store enhancers if any
));

로 사용하던 로거를

 

const store = configureStore({
reducer: persistedReducer,
middleware: (getDefaultMiddleware) => {
// eslint-disable-next-line no-undef
if (__DEV__) {
return getDefaultMiddleware({ serializableCheck: false }).concat(logger);
}
return getDefaultMiddleware({ serializableCheck: false });
},
// eslint-disable-next-line no-undef
devTools: __DEV__,
});

형태로 바꾸어줬다

728x90
반응형
728x90
반응형

맥을 껐다 켜니 갑자기 gitlab에 push가 해당 에러를 내며 거부되었다.

 

access token 값을 변경하고나서 vscode에 저장을 하지 않아서 발생한 문제였다.

 

git config --system --unset credential.helper

 

명령어로 초기화후( permission 관련 에러가나면 sudo git config --system --unset credential.helper ) 

 

다시 git push를 하면 아이디 / pwd 입력칸이 나온다.

 

이메일로 아이디를 넣어주고, 발급받은 token값을 비밀번호로 입력하면 정상작동한다.

 

해당 정보를 저장하기위해서 

 

git config credential.helper store

명령어 입력해줬다.

728x90
반응형
728x90
반응형

1. 같은 와이파이

 

2. 먼저 스마트폰을 컴퓨터에 USB로 연결

 

 

3. cmd 창에서 5555 포트로 지정

adb tcpip 5555

 

성공시 나타나는 내용 : restarting in TCP mode port: 5555

 

4. 이제 USB를 연결해제

 

그다음 스마트폰의 IP주소를 알아내야 합니다.

알아내는 방법은 다양하므로 몇가지만 알려드린후 넘어가겠습니다.

 

설정 앱 - 휴대폰 정보 - 상태(또는 네트워크) - IP 주소

설정 앱 - WIFI - WIFI 고급 설정(또는 WIFI 설정) - IP 주소

 

adb connect <Your IP>:5555

 

성공시 나타나는 내용 : connected to <IP>:5555

 

 

5. adb devices 로 연결 상태를 확인할 수 있습니다.

728x90
반응형
728x90
반응형

watchman watch-del '/Users/유저이름/프로젝트이름' ; watchman watch-project '/Users/유저이름/프로젝트이름'

 

으로 해결

728x90
반응형
728x90
반응형
import * as React from 'react';
import {Alert, Text, TouchableOpacity, View} from 'react-native';

interface ErrorBoundaryProps {}

interface ErrorBoundaryState {
hasError: boolean;
errorMessage: string;
}

export default class ErrorBoundary extends React.Component<
React.PropsWithChildren<ErrorBoundaryProps>,
ErrorBoundaryState
> {
constructor(props: ErrorBoundaryProps) {
super(props);
this.state = {hasError: false, errorMessage: ''};
}

static getDerivedStateFromError(_error: Error) {
return {hasError: true};
}

componentDidCatch(error: Error, _errorInfo: any) {
this.setState({errorMessage: error.toString()});
}

onRefresh = () => {
Alert.alert('', 'error refresh');
this.setState({hasError: false});
};

render() {
if (this.state.hasError) {
return (
<View
style={{
flex: 1,
justifyContent: 'center',
alignContent: 'center',
backgroundColor: '#ffe2e2',
}}>
<Text>system error</Text>
<Text>{this.state.errorMessage}</Text>
<TouchableOpacity onPress={this.onRefresh}>
<Text>refresh</Text>
</TouchableOpacity>
</View>
);
}

return this.props.children;
}
}
728x90
반응형
728x90
반응형

Any way to disable onPress on child views while swiping?

 

스와이프를 할때도, pressable / touchableopacity 가 event가 먹기에 Pressable을 커스텀했다.

 

import React, {useRef} from 'react';
import {NativeTouchEvent, Pressable, PressableProps} from 'react-native';

export const CustomPressable = ({
onPress,
onPressIn,
onPressOut,
...props
}: PressableProps) => {
const _touchActivatePositionRef = useRef<NativeTouchEvent | null>(null);
const _onPressIn: PressableProps['onPressIn'] = e => {
_touchActivatePositionRef.current = e.nativeEvent;

onPressIn?.(e);
};

const _onPress: PressableProps['onPress'] = e => {
const {pageX, pageY} = e.nativeEvent;

const absX = Math.abs(
(_touchActivatePositionRef.current?.pageX || 0) - pageX,
);
const absY = Math.abs(
(_touchActivatePositionRef.current?.pageY || 0) - pageY,
);

const dragged = absX > 2 || absY > 2;
if (!dragged) {
onPress?.(e);
}
};

return (
<Pressable
onPressIn={_onPressIn}
onPress={_onPress}
onPressOut={onPressOut}
{...props}>
{props.children}
</Pressable>
);
};

Pressable 말고 TouchableOpacity로도 사용이 가능한데, RN공홈에서 Pressable 을 권장하니 참고

728x90
반응형
728x90
반응형

archive 후 testFlight로 업로드를 하는데 평소에 나지 않던 에러가 발생했다.

 

The Info.plist key 'BGTaskSchedulerPermittedIdentifiers' must contain a list of identifiers used to submit and handle tasks when 'UIBackgroundModes' has a value of 'processing'.

 

BGTaskSchedulerPermittedIdentifiers 가 필요하다는 내용이었다.

 

info.plist 에

 

해당 key 값 추가해서 해결

728x90
반응형
728x90
반응형

killall -9 node

rm -rf ios/build

react-native run-ios

728x90
반응형
728x90
반응형

xattr -d com.apple.quarantine /Applications/Flipper.app 

 

728x90
반응형

+ Recent posts