2016-06-16 3 views
5

나는이 문제를 전혀 파악하지 못했습니다. React Native 애플리케이션을 열면 이러한 오류가 발생합니다. 가장 좋은 점은 응용 프로그램이 번들되는 방식과 관련이 있다는 것입니다. 어떤 도움을 많이 인정하고 upvoted 것입니다! 감사! 엑스 코드에서네이티브 소켓 프로토콜 오류 및 TimeoutError 문제가 발생합니다.

Error example

오류

2016-06-16 17:21:50.160 [warn][tid:com.facebook.react.JavaScript] [TimeoutError: Event response for 'login' timed out] 
2016-06-16 17:21:51.580 [warn][tid:com.facebook.react.JavaScript] [SocketProtocolError: Socket hung 

버전

"react": "^15.1.0", 
    "react-native": "^0.27.2" 
    ... along with about 30 others 

IOS - AppDelegate.m

jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; 

    /** 
    * OPTION 2 
    * Load from pre-bundled file on disk. The static bundle is automatically 
    * generated by the "Bundle React Native code and images" build step when 
    * running the project on an actual device or running the project on the 
    * simulator in the "Release" build configuration. 
    */ 

    // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 


    RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 
                moduleName:@"MyApp" 
                initialProperties:nil 
                launchOptions:launchOptions]; 

답변

1

오랜 시간 후, 나는 그것이 ACTU 깨달았다 동맹국 React Dev Tools와 HMR.

import Immutable from 'immutable'; 
import { Platform } from 'react-native'; 
import { createStore, applyMiddleware, compose } from 'redux'; 
import thunk from 'redux-thunk'; 
import reducer from '../reducers'; 

const middlewares = [thunk]; 

let enhancer = applyMiddleware(...middlewares); 

export default function configureStore(initialState) { 
    const store = createStore(reducer, initialState, enhancer); 
    if (module.hot) { 
    module.hot.accept(() => { 
     store.replaceReducer(require('../reducers').default); 
    }); 
    } 
    return store; 
} 
----- (아래) ----- (아래)

OLD

import Immutable from 'immutable'; 
    import { Platform } from 'react-native'; 
    import { createStore, applyMiddleware, compose } from 'redux'; 
    import thunk from 'redux-thunk'; 
    import reducer from '../reducers'; 

    const middlewares = [thunk]; 

let enhancer; 
if (__DEV__) { 
    const installDevTools = require('immutable-devtools'); 
    installDevTools(Immutable); 

    const devTools = require('remote-redux-devtools'); 
    enhancer = compose(
    applyMiddleware(...middlewares), 
    devTools({ 
     name: Platform.OS, 
     hostname: 'localhost', 
     port: 5678 
    }) 
); 
} else { 
    enhancer = applyMiddleware(...middlewares); 
} 

NEW : 나는 다음에 내 스토어 구성을 업데이트했다

관련 문제