0

React Native Linking 및 Firebase를 사용하여 동적 링크를 생성합니다. 앱이 백그라운드에서 열리거나 링크를 클릭 할 때 "트레이 (tray)"가 열려 있지 않으면 모든 것이 제대로 작동합니다. 앱이 링크를 클릭 할 때 이미 열려 있으면 아무 것도하지 않습니다.React 네이티브 Linking.addEventListener()가 응용 프로그램 트레이에있을 때 실행되지 않습니다.

청취자는 documentation과 같이 componentDidMount에 설정되어 있지만 발포는 아닙니다.

componentDidMount() { 
    Linking.addEventListener('url', this._handleOpenURL); 
}, 

사실, 내가 겪었 및 componentWillMount(), componentDidMount(), componentWillUpdate(), componentWillUnmount(), componentWillReceiveNewProps() 및 _handleOpenURL을 (경고) 내가 링크를 클릭 할 때 나는 아무것도 얻을 것 그리고 그것은 백그라운드에서 앱을 "다시 열"는 것입니까? 내가 도대체 ​​뭘 잘못하고있는 겁니까?

답변

0

누군가가 같은 문제가있는 경우를 대비하여 질문을 남깁니다.

밝혀졌습니다.이 코드 블록을 AppDelegate.m 파일에 추가하기 만하면되었습니다.

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity 
restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler 
{ 
    return [RCTLinkingManager application:application 
        continueUserActivity:userActivity 
        restorationHandler:restorationHandler]; 
}