Skip to content

Commit

Permalink
fix(mobile): fix change listen addrs after refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Sacha <sfroment42@gmail.com>
  • Loading branch information
sfroment committed Apr 12, 2019
1 parent c3172e9 commit c24b75f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
10 changes: 5 additions & 5 deletions client/react-native/common/components/Library/DebugStateBar.js
Expand Up @@ -18,11 +18,11 @@ class DebugStateBar extends PureComponent {
constructor (props) {
super(props)
this.state = {
watchTime: 3000,
watchTime: 10000,
listenAddrs: [],
listenInterfaceAddrs: [],
timeouted: false,
requestTimeout: 2000,
requestTimeout: 5000,
listenAddrTimer: null,
InterfaceAddrTimer: null,
bertyColor: colors.lightGrey,
Expand Down Expand Up @@ -169,7 +169,7 @@ class DebugStateBar extends PureComponent {
let bleState = false

if (listenAddrs.length > 0 && listenInterfaceAddrs.length > 0) {
listenInterfaceAddrs.forEach((v, i, arr) => {
listenAddrs.forEach((v, i, arr) => {
try {
const splited = v.split('/')
if (splited[1] === 'ip4' && splited[2] !== '127.0.0.1') {
Expand All @@ -179,8 +179,8 @@ class DebugStateBar extends PureComponent {
daemonState = daemonStateValues.connected
}
if (
splited[1] === 'ble' &&
splited[2] !== '00000000-0000-0000-0000-000000000000'
splited[1] === 'ble'
// && splited[2] !== '00000000-0000-0000-0000-000000000000'
) {
bleColor = colors.green
bgBleColor = colors.green25
Expand Down
37 changes: 19 additions & 18 deletions client/react-native/common/components/Navigator/index.js
Expand Up @@ -56,28 +56,29 @@ class Navigator extends PureComponent {
const { navigation } = this.props

return (
<AppNavigator
{...this.props}
ref={() => {
if (Platform.OS !== 'web') {
this.navigation = navigation
NavigationService.setTopLevelNavigator(navigation)
}
}}
onNavigationStateChange={(prevState, currentState) => {
const currentRoute = getActiveRoute(currentState)
const prevRoute = getActiveRoute(prevState)
if (prevRoute !== currentRoute) {
CoreModule.setCurrentRoute(getURIFromRoute(currentRoute))
this.setState(currentRoute)
}
}}
/>
<NavigatorContext.Provider value={this.state}>
<AppNavigator
{...this.props}
ref={() => {
if (Platform.OS !== 'web') {
this.navigation = navigation
NavigationService.setTopLevelNavigator(navigation)
}
}}
onNavigationStateChange={(prevState, currentState) => {
const currentRoute = getActiveRoute(currentState)
const prevRoute = getActiveRoute(prevState)
if (prevRoute !== currentRoute) {
CoreModule.setCurrentRoute(getURIFromRoute(currentRoute))
this.setState(currentRoute)
}
}}
/>
</NavigatorContext.Provider>
)
}
}

export default (Platform.OS !== 'web'
? createAppContainer(Navigator)
: Navigator)

0 comments on commit c24b75f

Please sign in to comment.