nandorojo / expo-next-react-navigation

â›´ Make Next.js and react-navigation play nicely together with an Expo/React Native Web app.
408 stars 32 forks source link

Cannot read property 'query' of null #10

Closed emroot closed 4 years ago

emroot commented 4 years ago

I keep getting the this error when tryin to use useRouting on web. image

This is my index.tsx page

// @generated: @expo/next-adapter@2.0.10
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import withApollo from "../lib/withApollo";
import { useRouter } from "next/dist/client/router";
import { useRouting } from "expo-next-react-navigation";

const App = () => {
  const { navigate } = useRouting();
  return (
    <View style={styles.container}>
      <Text style={styles.text}>Welcome to Expo + Next.js 👋</Text>
    </View>
  );
};

export default App;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
  },
  text: {
    fontSize: 16,
  },
});

Did i miss something?

emroot commented 4 years ago

Looks like this is happening because I'm using react ^16.12.0 and react-dom ^16.12.0.

emroot commented 4 years ago

Actually I take that back, it wasn't because, I was using next 9.2 instead of 9.1.5. Changed it and ti works like a charm.

nandorojo commented 4 years ago

Thanks for following up & closing!

nandorojo commented 4 years ago

Could you check if using the latest version (1.0.2) solves this?

yarn add expo-next-react-navigation@v5