react-navigation / react-navigation/react-navigation

cant install and run example from latest repo

Open
#9,479 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
24.5k
Forks
5.1k
Avg merge
1d 5h
Merged PRs (30d)
18

Description

tried using git instal from github.cli and downloading zip file same problem

used yarn to install then yarn --cwd example (and several other iterations )

the expo instance ran and i selected web then i recieved this message


10:04
Failed to compile.
./packages/elements/src/Header/Header.tsx 11:12
Module parse failed: Unexpected token (11:12)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import HeaderShownContext from './HeaderShownContext';
| import getDefaultHeaderHeight from './getDefaultHeaderHeight';
> import type { HeaderOptions, Layout } from '../types';
| 
| type Props = HeaderOptions & {

this is the package.json from the root


{
  "description": "Rethinking navigation",
  "private": true,
  "workspaces": {
    "packages": [
      "packages/*",
      "example"
    ]
  },
  "publishConfig": {
    "access": "public",
    "tag": "alpha"
  },
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/react-navigation/react-navigation.git"
  },
  "author": "Satyajit Sahoo <satyajit.happy@gmail.com> (https://github.com/satya164/), Michał Osadnik <micosa97@gmail.com> (https://github.com/osdnk/)",
  "scripts": {
    "lint": "eslint \"**/*.{js,ts,tsx}\"",
    "typescript": "tsc --noEmit --composite false",
    "test": "jest",
    "prerelease": "lerna run clean",
    "release": "lerna publish",
    "example": "yarn --cwd example"
  },
  "devDependencies": {
    "@commitlint/config-conventional": "^12.0.1",
    "@types/jest": "^26.0.19",
    "babel-jest": "^26.6.3",
    "codecov": "^3.8.1",
    "commitlint": "^12.0.1",
    "eslint": "^7.21.0",
    "eslint-config-satya164": "^3.1.9",
    "husky": "^4.3.6",
    "jest": "^26.6.3",
    "lerna": "^4.0.0",
    "metro-react-native-babel-preset": "^0.65.2",
    "prettier": "^2.2.1",
    "typescript": "^4.2.3"
  },
  "resolutions": {
    "react": "~16.13.1",
    "react-native": "~0.63.2"
  },
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
      "pre-commit": "yarn lint && yarn typescript && yarn test"
    }
  },
  "jest": {
    "testEnvironment": "node",
    "testRegex": "/__tests__/.*\\.(test|spec)\\.(js|tsx?)$",
    "setupFiles": [
      "<rootDir>/jest/setup.js"
    ],
    "moduleNameMapper": {
      "@react-navigation/([^/]+)": "<rootDir>/packages/$1/src"
    },
    "preset": "react-native"
  },
  "prettier": {
    "tabWidth": 2,
    "useTabs": false,
    "singleQuote": true,
    "trailingComma": "es5"
  },
  "detox": {
    "test-runner": "jest",
    "runner-config": "example/e2e/config.json",
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "example/ios/build/Build/Products/Debug-iphonesimulator/ReactNavigationExample.app",
        "build": "set -o pipefail; xcodebuild -workspace example/ios/ReactNavigationExample.xcworkspace -scheme ReactNavigationExample -configuration Debug -sdk iphonesimulator -derivedDataPath example/ios/build",
        "type": "ios.simulator",
        "device": {
          "type": "iPhone 11 Pro"
        }
      },
      "ios.sim.release": {
        "binaryPath": "example/ios/build/Build/Products/Release-iphonesimulator/ReactNavigationExample.app",
        "build": "export RCT_NO_LAUNCH_PACKAGER=true; set -o pipefail; xcodebuild -workspace example/ios/ReactNavigationExample.xcworkspace -scheme ReactNavigationExample -configuration Release -sdk iphonesimulator -derivedDataPath example/ios/build",
        "type": "ios.simulator",
        "device": {
          "type": "iPhone 11 Pro"
        }
      }
    }
  }
}

and this is the one from the example


{
  "name": "@react-navigation/example",
  "description": "Demo app to showcase various functionality of React Navigation",
  "version": "5.1.0",
  "private": true,
  "scripts": {
    "start": "expo start",
    "web": "expo start --web",
    "native": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "server": "nodemon -e '.js,.ts,.tsx' --exec \"babel-node -i '/node_modules[/\\](?react-native)/' -x '.web.tsx,.web.ts,.web.js,.tsx,.ts,.js' --config-file ./server/babel.config.js server\"",
    "test": "jest"
  },
  "dependencies": {
    "@expo/vector-icons": "^12.0.3",
    "@react-native-masked-view/masked-view": "0.2.0",
    "color": "^3.1.3",
    "expo": "^40.0.1",
    "expo-asset": "~8.2.2",
    "expo-blur": "~9.0.0",
    "expo-linking": "~2.1.1",
    "expo-updates": "~0.4.2",
    "koa": "^2.13.0",
    "metro-react-native-babel-preset": "^0.65.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.0.tar.gz",
    "react-native-appearance": "~0.3.3",
    "react-native-gesture-handler": "~1.8.0",
    "react-native-pager-view": "^4.2.4",
    "react-native-paper": "^4.7.2",
    "react-native-reanimated": "~1.13.0",
    "react-native-safe-area-context": "3.1.9",
    "react-native-screens": "~2.15.0",
    "react-native-tab-view": "^3.0.0",
    "react-native-vector-icons": "^8.1.0",
    "react-native-web": "~0.15.0"
  },
  "devDependencies": {
    "@babel/node": "^7.13.0",
    "@expo/webpack-config": "~0.12.60",
    "@types/cheerio": "^0.22.24",
    "@types/jest-dev-server": "^4.2.0",
    "@types/koa": "^2.13.1",
    "@types/node-fetch": "^2.5.8",
    "@types/react": "~16.9.35",
    "@types/react-dom": "~16.9.8",
    "@types/react-native": "~0.63.51",
    "babel-loader": "^8.2.2",
    "babel-plugin-module-resolver": "^4.0.0",
    "babel-preset-expo": "8.3.0",
    "cheerio": "^1.0.0-rc.3",
    "expo-cli": "^4.3.0",
    "jest": "^26.6.3",
    "jest-dev-server": "^4.4.0",
    "mock-require-assets": "^0.0.1",
    "node-fetch": "^2.6.1",
    "nodemon": "^2.0.6",
    "playwright": "^1.9.1",
    "serve": "^11.3.0",
    "typescript": "~4.2.3"
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the commands described in the issue, starting from the root and example package.json files and packages/elements/src/Header/Header.tsx. Inspect the example's Expo web build configuration and determine why this TypeScript file is not processed; done means the example's web target compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript, webpack
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.