Search code examples
ruby-on-railswebviewreact-nativeturbolinks

Turbolinks does not work with react-native webview


I am building a hybrid react-native + ruby on rails app. I am using the onNavigationStateChange in the WebView component to detect changes in the page, and use this to change the react-native navigation menu. This works fine, but when I tried to use turbolinks, there can be a change in the page but the onNavigationStateChange is not triggered.

The onNavigationStateChange is triggered is with following code

  render() { 
    return (
      <WebView
        ref={'webview'}
        automaticallyAdjustContentInsets={false}
        source={{uri: SETTINGS_URL}}
        javaScriptEnabled={true}
        onNavigationStateChange={this.props.onNavigationStateChange}
        startInLoadingState={true}
        scalesPageToFit={true}
      />
    )
  }

This works normally, but if I turn on turbolinks, in the ROR app, the onNavigationStateChange no longer triggers.

How do I fix this?


Solution

  • The turbolinks team appear to be working on a native integrations, with turbolinks-ios and turbolinks-android.