signals: New version of preact signals for react not working with React Native

In my RN apps, preact signals not working. Previous implementation wasn’t working because of navigation.

 ERROR  TypeError: Cannot read property 'alternate' of null

This error is located at:
    in NativeStackNavigator (created by App)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by App)
    in QueryClientProvider (created by PersistQueryClientProvider)
    in PersistQueryClientProvider (created by CacheProvider)
    in CacheProvider (created by App)
    in App (created by gestureHandlerRootHOC(App))
    in RNGestureHandlerRootView (created by GestureHandlerRootView)
    in GestureHandlerRootView (created by gestureHandlerRootHOC(App))
    in gestureHandlerRootHOC(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in oone_drive(RootComponent), js engine: hermes

However its working in expo snack: https://snack.expo.dev/@xantregodlike/funny-pretzel?platform=android This issue is not reproducing event in pure react native starter. I think it can be related with some external libraries. When i will detect which one is causing this issue - it will add reproduce steps

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 8
  • Comments: 22 (13 by maintainers)

Most upvoted comments

@andrewiggins Can i create PR to add information for docs how to use preact signals in react native?

Hint, hint? __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED Fired!

The solution for it is to roll back to 1.2.1 and apply a little patch (if you are using react-navigation) #257

I’m currently pursuing a method that would use a babel transform on components to track signals instead of patching internals. That should hopefully work better for all renderers. PR for feedback should be out soon (a couple days).