Code Monkey home page Code Monkey logo

react-native-community / react-native-template-typescript Goto Github PK

View Code? Open in Web Editor NEW
1.8K 1.8K 397.0 545 KB

๐Ÿ‘พ Clean and minimalist React Native template for a quick start with TypeScript.

Home Page: https://www.npmjs.com/package/react-native-template-typescript

License: MIT License

JavaScript 3.10% TypeScript 8.09% Java 43.01% Objective-C 6.58% Ruby 4.47% Starlark 1.66% C++ 20.09% Objective-C++ 12.25% CMake 0.75%
boilerplate jest react-native template typescript

react-native-template-typescript's People

Contributors

abakimatov avatar artyorsh avatar diegomais avatar dratwas avatar ekaansharora avatar emin93 avatar friederbluemle avatar iepsen avatar italomlp avatar josephmbeveridge avatar julioxavierr avatar junichisugiura avatar kennytian avatar khalisafkari avatar kuasha420 avatar leotm avatar malord avatar monholm avatar mrbrentkelly avatar naturalclar avatar newyankeecodeshop avatar oieduardorabelo avatar radko93 avatar retyui avatar seventeeen avatar sheepsteak avatar steventcramer avatar wood1986 avatar wwdrew avatar yutasugimura avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-template-typescript's Issues

npx react-native init MyApp --template react-native-template-typescript does not work correctly

Bug

Environment info

React native info output:

System:
    OS: macOS 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 1.15 GB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.6.0 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 23.0.1, 23.0.3, 25.0.1, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3
      System Images: android-27 | Google APIs Intel x86 Atom
      Android NDK: 19.2.5345600
  IDEs:
    Android Studio: 3.1 AI-173.4907809
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    create-react-native-app: 1.0.0
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

Library version: x.x.x

Steps To Reproduce

  1. After running command npx react-native init MyApp --template react-native-template-typescript I get below error in terminal

Screenshot 2019-09-12 at 6 27 53 PM

The installer is looking for package **react-native-template-react-native-template-typescript** which is not available.

  1. After removing react-native-template- & running command npx react-native init MyApp --template typescript I get below folder structure which is incorrect.

Screenshot 2019-09-12 at 6 30 00 PM

Typescript project is created inside template directory.

init template dont create tsconfig

Bug

after executing the command, the file tsconfig is not created

Environment info

React native info output:

System:
    OS: macOS 10.15
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.11.1 - /usr/local/bin/node
    npm: 6.11.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 11.1/11A1027 - /usr/bin/xcodebuild

Steps To Reproduce

npx react-native init testProj --template react-native-template-typescript

Describe what you expected to happen:

  1. create project files
  2. create tsconfig.json / esconfig.json

Doesn't build after project initialization

After recent update in cli-platform-android the project doesn't start. Stating Cannot invoke method getErrorStream() on null object. I wanted to submit an issue for that package but I could not find a github repo for that.

$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
:ReactNative:Cannot run program "npx": CreateProcess error=2, โ•ั… ั”ั„ั€ั…ะ„ั‘ย  ัั€ั‰ะ„ัˆ ั”ัŠั€ั‡ั€ััโˆšั‰ ะ‡ั€ั‰ั‹
:ReactNative:Automatic import of native modules failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 169

* What went wrong:
A problem occurred evaluating script.
> Cannot invoke method getErrorStream() on null object

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --v

erbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Script 'C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 169

* What went wrong:
A problem occurred evaluating script.
> Cannot invoke method getErrorStream() on null object

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

    at checkExecSyncError (child_process.js:621:11)
    at execFileSync (child_process.js:639:15)
    at runOnAllDevices (C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
    at buildAndRun (C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
    at C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
    at async Command.handleAction (C:\TEMP\natapp\node_modules\@react-native-community\cli\build\index.js:164:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I'm running on Windows 10 x64 and node version is 12.8.0

Command not found: react-native

After react-native init with NPX, when I run "react-native run-ios" command it gives an error as "react-native run-ios
zsh: command not found: react-native"

I understand that I have this problem because I initialized React-Native with NPX. I can run simulator with adding NPX head of the command. If there is any other solution, I think we might update read me file about the usege with NPX.

How to handle different CLI versions

Introduction

The new RN CLI will have an updated template feature which is incompatible with the current one. As the current CLI won't go anywhere soon, we have to support both versions for a while.

I created a new branch (cli-v2) with the changes for the new CLI.

Question

How should we handle the support for both versions?

Proposals

  • Maintain two separate branches (e.g. master and master-cli-v2) and release the CLI v2 compatible template with the next tag.
  • Integrate a detection in the post install script and handle the differences there. This would allow us to have only one branch but it will make things a bit messy.

Breaks with @react-native-community/[email protected]

Expected results

The project should initialise properly.

Observed results

Can't be built because of the new template api documented here

Logs

image

โœ” Downloading template
โœ– Copying template
error Error: Cannot find module '/var/folders/78/49srzccj41jg4k660nnt6b8w0000gn/T/rncli-init-template-1UgDus/node_modules/react-native-template-typescript/template.config'

Steps to reproduce

  1. Install the latest version of the cli
yarn global add @react-native-community/[email protected] 
# Or 
npm i -g @react-native-community/[email protected]
  1. Create the app
react-native init YoYoYo --version react-native@next --template typescript
  1. Observe the failure

CocoaPods install fails: url_for_request: uninitialized constant GhInspector::Sidekick::ERB (NameError)

Bug

After creating the project successfully, pod install seem to fail. First I got Xcodeproj doesn't know about the following attributes {"inputFileListPaths"=>[], "outputFileListPaths"=>[]} for the 'PBXShellScriptBuildPhase' isa, which I could solve following this post: CocoaPods/CocoaPods#7835 (comment)

After that I got the error

/Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/sidekick.rb:67:in `url_for_request': uninitialized constant GhInspector::Sidekick::ERB (NameError)
	from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/sidekick.rb:24:in `search'
	from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/inspector.rb:65:in `search_query'
	from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/inspector.rb:59:in `search_exception'
	from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/user_interface/error_report.rb:119:in `search_for_exceptions'
	from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/command.rb:67:in `report_error'
	from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:396:in `handle_exception'
	from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:337:in `rescue in run'
	from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:324:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/lib/cocoapods/command.rb:52:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.4.0/bin/pod:55:in `<top (required)>'
	from /usr/local/Cellar/cocoapods/1.4.0/libexec/bin/pod:22:in `load'
	from /usr/local/Cellar/cocoapods/1.4.0/libexec/bin/pod:22:in `<main>'

after re-trying pod install on the iOS project. gem update xcodeproj didn't help. The only hint I have is this: CocoaPods/CocoaPods#7478 but it got closed without being addressed and I don't know how to continue, right now.

Environment info

React native info output:

$ npx react-native info
info Fetching system and libraries information...
System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
    Memory: 353.47 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.6.0 - /usr/local/bin/node
    npm: 6.9.0 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 19, 22, 23, 24, 25, 26, 28
      Build Tools: 25.0.2, 26.0.2, 27.0.3, 28.0.0, 28.0.3
      System Images: android-28 | Google Play Intel x86 Atom
      Android NDK: 17.2.4988734
  IDEs:
    Android Studio: 3.3 AI-182.5107.16.33.5314842
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react-native: ^0.60.4 => 0.60.4

react-native 0.60.4
react-native-typescript-template 5.2.0

Steps To Reproduce

npm i react-native react-native-template-typescript -D
npx react-native init app --template react-native-template-typescript@next
cd app/ios
pod install

can not run `npx react-native init MyApp --template react-native-template-typescript`

Bug

Environment info

React native info output:

 // paste it here

Library version: x.x.x

Steps To Reproduce

...

Describe what you expected to happen:

Reproducible sample code

yarn add v1.17.3
[1/4] ๐Ÿ”  Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > [email protected]: use String.prototype.padStart()
error An unexpected error occurred: "https://registry.npmjs.org/react-native-template-react-native-template-typescript: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/kenny/react0611/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.17.3
[1/2] ๐Ÿ—‘  Removing module react-native-template-react-native-template-typescript...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/remove for documentation about this command.
warn Failed to clean up template temp files in node_modules/react-native-template-react-native-template-typescript. This is not a critical error, you can work on your app.
(node:2599) UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript
    at makeError (/Users/kenny/react0611/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/Users/kenny/react0611/node_modules/execa/index.js:278:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:2599) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:2599) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
k

baseUrl in tsconfig is not supported

Expected results

Setting baseUrl in tsconfig.json should enable absolute import paths.

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "jsx": "react-native",
    "lib": ["es6"],
    "moduleResolution": "node",
    "noEmit": true,
    "strict": true,
    "strictPropertyInitialization": false,
    "target": "esnext",
    "baseUrl": "./src",
    "paths": {
      "@assets/*": ["assets/*"]
    }
  },
  "exclude": ["node_modules"]
}

index.ts

import Images from 'assets/images';

Observed results

What happened?
This error appears: error: bundling failed: Error: Unable to resolve module assets/images

Logs

Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `assets/images` from `D:\App\src\pages\Splash\Splash.tsx`: Module `assets/images` does not exist in the Haste module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
  1. Clear watchman watches: `watchman watch-del-all`.
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
    at ModuleResolver.resolveDependency (D:\App\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:209:1301)
    at ResolutionRequest.resolveDependency (D:\App\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:83:16)
    at DependencyGraph.resolveDependency (D:\App\node_modules\metro\src\node-haste\DependencyGraph.js:238:485)
    at Object.resolve (D:\App\node_modules\metro\src\lib\transformHelpers.js:180:25)
    at dependencies.map.result (D:\App\node_modules\metro\src\DeltaBundler\traverseDependencies.js:311:29)
    at Array.map (<anonymous>)
    at resolveDependencies (D:\App\node_modules\metro\src\DeltaBundler\traverseDependencies.js:307:16)
    at D:\App\node_modules\metro\src\DeltaBundler\traverseDependencies.js:164:33
    at Generator.next (<anonymous>)
    at step (D:\App\node_modules\metro\src\DeltaBundler\traverseDependencies.js:266:307)

Incomplete Usage docs

Question

In order to make the init command work (npx react-native init MyApp --template react-native-template-typescript), I also had to uninstall react-native-cli globally from yarn (yarn global remove react-native-cli), otherwise the command would fail accusing the following:

error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found"

error This module isn't specified in a package.json file.

Also, when trying to run the app, I had to use the packaged react-native from the project ($(yarn bin)/react-native run-ios), as the globally installed react-native-cli was removed, when following the docs.

Initialising new RN 0.59 TypeScript project fails with yarn installed

Expected results

What did you expect to happen?

A React Native 0.59 project with the TypeScript template applied.

Observed results

What happened?

During the installation process of the TypeScript template, one of the scripts fails which seems to break the setup process. After comparing the files created with and without the template, the package.json file in particular seems not to have been updated correctly but there could be other changes.

Logs

Please add the log output here.

info Setting up new React Native app in /Users/d/Projects/ExampleTestTS
info Fetching template react-native-template-typescript...
yarn add v1.13.0
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning " > [email protected]" has unmet peer dependency "[email protected]".
warning "react-native > @react-native-community/[email protected]" has incorrect peer dependency "react-native@^0.57.0".
warning "react-native > [email protected]" has unmet peer dependency "@babel/core@*".
warning "react-native > @react-native-community/cli > [email protected]" has unmet peer dependency "@babel/core@*".
[4/4] ๐Ÿ”จ  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
โ””โ”€ [email protected]
info All dependencies
โ””โ”€ [email protected]
โœจ  Done in 8.71s.
info Adding dependencies for the project...
info No additional dependencies.
info Adding develop dependencies for the project...
yarn add v1.13.0
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning " > [email protected]" has unmet peer dependency "[email protected]".
warning "react-native > @react-native-community/[email protected]" has incorrect peer dependency "react-native@^0.57.0".
warning "react-native > [email protected]" has unmet peer dependency "@babel/core@*".
warning "react-native > @react-native-community/cli > [email protected]" has unmet peer dependency "@babel/core@*".
[4/4] ๐Ÿ”จ  Building fresh packages...
error /Users/drew/Projects/ExampleTestTS/node_modules/react-native-template-typescript: Command failed.
Exit code: 1
Command: node setup.js
Arguments:
Directory: /Users/drew/Projects/ExampleTestTS/node_modules/react-native-template-typescript
Output:
fs.js:119
    throw err;
    ^

Error: ENOENT: no such file or directory, unlink '/Users/d/Projects/ExampleTestTS/.flowconfig'
    at Object.unlinkSync (fs.js:972:3)
    at deleteProjectFile (/Users/d/Projects/ExampleTestTS/node_modules/react-native-template-typescript/setup.js:13:42)
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/d/Projects/ExampleTestTS/node_modules/react-native-template-typescript/setup.js:16:22)
    at Module._compile (internal/modules/cjs/loader.js:799:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
    at Module.load (internal/modules/cjs/loader.js:666:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
    at Function.Module._load (internal/modules/cjs/loader.js:598:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:862:12)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.13.0
[1/2] ๐Ÿ—‘  Removing module react-native-template-typescript...
[2/2] ๐Ÿ”จ  Regenerating lockfile and installing missing dependencies...
warning " > [email protected]" has unmet peer dependency "[email protected]".
warning "react-native > @react-native-community/[email protected]" has incorrect peer dependency "react-native@^0.57.0".
warning "react-native > [email protected]" has unmet peer dependency "@babel/core@*".
warning "react-native > @react-native-community/cli > [email protected]" has unmet peer dependency "@babel/core@*".
success Uninstalled packages.
โœจ  Done in 9.32s.
child_process.js:677
    throw err;
    ^

Error: Command failed: yarn add -D @types/jest@latest @types/react-native@latest @types/react-test-renderer@latest @types/react@latest typescript@latest
    at checkExecSyncError (child_process.js:637:11)
    at execSync (child_process.js:674:13)
    at PackageManager.executeCommand (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/PackageManager.js:28:42)
    at PackageManager.installDev (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/PackageManager.js:42:41)
    at installTemplateDevDependencies (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/generator/templates.js:194:6)
    at createFromRemoteTemplate (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/generator/templates.js:124:5)
    at createProjectFromTemplate (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/generator/templates.js:81:3)
    at generateProject (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/commands/init/init.js:109:44)
    at Object.init (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/commands/init/init.js:92:3)
    at run (/Users/drew/.nvm/versions/node/v11.11.0/lib/node_modules/react-native-cli/index.js:302:7)

Steps to reproduce

  1. Install yarn globally.

  2. Create a new repository with react-native init Example --template typescript


This is more of a heads up than a help request as I prefer to use npm over yarn, but I did happen to have yarn installed so it did cause me a few headscratches this afternoon when the new template dropped. I solved it by uninstalling yarn (yay!), but thought I should let you know in case anyone else comes across the same problem.

Cannot find module '@babel/plugin-external-helpers'

Thank you so much for this great template, it has simplified my life :)

Expected results

Running app after following readme.

Observed results

RSoD showing error:
Cannot find module '@babel/plugin-external-helpers'

Installing said module fixes the problem!

Set "noImplicitAny" to true per default?

Actually this is a question to all of you who are using this template.

In my experience it always made sense to set noImplicitAny to true, even though TypeScript doesn't do that per default.

What do you think?

Typescript 3.7.x support

Hi!

Hope itโ€™s a legitimate question โ€“ probably I miss something silly :(

I wanted to try out a new project with the Typescript (3.7.2), with optional chaining and more. I followed the instructions on React Native website, but optional chaining doesnโ€™t seem to work

My end goal is to upgrade my existing project (I have upgraded there to 3.7.2, but still doesnโ€™t work)

What am I missing?

Would love for your help
Thank you!

Doubt

Cool one, perfectly working, good work. (y)

Although I've one about the working of this system. How does the command 'react-native init MyApp --template typescript' connects to this github repo ? Is this published in any official react native things server ? or the RN system installs 'yarn add react-native-template-anything-after-template-flag' ?

An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found"

Bug

Trying to run exactly what is said in README.md of this package:

user@computer:~/workspace$ react-native init RNTEST --template react-native-template-typescript

Gives me this error

This will walk you through creating a new React Native project in /home/user/workspace/RNTEST
Using yarn v1.17.3
Installing react-native...
yarn add v1.17.3
info No lockfile found.
[1/4] Resolving packages...
warning react-native > create-react-class > fbjs > [email protected]: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native > [email protected]" has unmet peer dependency "@babel/core@*".
warning " > [email protected]" has unmet peer dependency "[email protected]".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 391 new dependencies.
info Direct dependencies
โ””โ”€ [email protected]
info All dependencies
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @babel/[email protected]
โ”œโ”€ @cnakazawa/[email protected]
โ”œโ”€ @hapi/[email protected]
โ”œโ”€ @hapi/[email protected]
โ”œโ”€ @hapi/[email protected]
โ”œโ”€ @hapi/[email protected]
โ”œโ”€ @jest/[email protected]
โ”œโ”€ @react-native-community/[email protected]
โ”œโ”€ @react-native-community/[email protected]
โ”œโ”€ @react-native-community/[email protected]
โ”œโ”€ @types/[email protected]
โ”œโ”€ @types/[email protected]
โ”œโ”€ @types/[email protected]
โ”œโ”€ @types/[email protected]
โ”œโ”€ @types/[email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ””โ”€ [email protected]
Done in 5.66s.
info Setting up new React Native app in /home/user/workspace/RNTEST
info Fetching template react-native-template-react-native-template-typescript...
yarn add v1.17.3
[1/4] Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > [email protected]: use String.prototype.padStart()
error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/home/user/workspace/RNTEST/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.17.3
[1/2] Removing module react-native-template-react-native-template-typescript...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/remove for documentation about this command.
warn Failed to clean up template temp files in node_modules/react-native-template-react-native-template-typescript. This is not a critical error, you can work on your app.
(node:9290) UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript
    at makeError (/home/user/workspace/RNTEST/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/home/user/workspace/RNTEST/node_modules/execa/index.js:278:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:9290) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:9290) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
user@latitude:~/workspace$ react-native init RNTEST --template react-native-template-typescript

Environment info

React native info output:

warn Package react has been ignored because it contains invalid configuration. Reason: Cannot find module 'react/package.json'
warn Package @react-native-community/eslint-config has been ignored because it contains invalid configuration. Reason: Cannot find module '@react-native-community/eslint-config/package.json'
warn Package babel-jest has been ignored because it contains invalid configuration. Reason: Cannot find module 'babel-jest/package.json'
warn Package jest has been ignored because it contains invalid configuration. Reason: Cannot find module 'jest/package.json'
warn Package react-test-renderer has been ignored because it contains invalid configuration. Reason: Cannot find module 'react-test-renderer/package.json'
info Fetching system and libraries information...
System:
    OS: Linux 5.1 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 8.61 GB / 15.56 GB
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 10.16.2 - ~/.nvm/versions/node/v10.16.2/bin/node
    Yarn: 1.17.3 - /usr/bin/yarn
    npm: 6.11.3 - ~/.nvm/versions/node/v10.16.2/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google Play Intel x86 Atom_64
      Android NDK: 20.0.5594570
  npmPackages:
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Library version: 0.60.5

Steps To Reproduce

  1. proceed with official getting started guide for RN (React Native CLI Quickstart)
  2. try to init TS template
    ...

Describe what you expected to happen:

  1. should not crash

Reproducible sample code

I have no code, it is not related to this issue

Gist link for migrate from existing project

I have a project with React-Native, that uses Javascript and PropTypes. So, I saw the benefits in the use of Typescript, and migrate to this. In the web, there are many tutorials, most of them a little old, and the recents are not complete or acceptable. So, I found this template, but don't want to start a new project and import the code. So, based in it (and in its setup.js), I did all by myself, and make a Gist for this migration.

My suggestion is, if you agree and think that it's helpful, add it to the links section of this repo.

The link for it is
https://gist.github.com/italomlp/4d16bf0f19d09f9fae48d272f9e6306e

Template files have executable permission

Bug

Template files have executable permission.

git ls-files -s

100644 8f4cafd8a2b436e78f475d60aa8086c8b6d60200 0	.gitignore
100644 3392e656705ca61a6f03007fba07c806b0dd6c7f 0	.travis.yml
100644 28348521fb5f09ecd63e7398e2a970fc917ac2c8 0	CODE_OF_CONDUCT.md
100644 1727292b8d455b92032f0a523f8af2d1d630209e 0	CONTRIBUTING.md
100644 cb41758099010a9a31adf78292ff6f2334779046 0	ISSUE_TEMPLATE.md
100644 15c23b089bbb8998dcfb2de73f7b2e0bbd84fd65 0	LICENSE
100644 67f1d07087337933a55d1b1a30ba66edff6c5503 0	README.md
100644 6da38c0943760241a4b19c6e20b8ff270bbe76ae 0	package-lock.json
100644 9c2fb98f256d13f42e41885c069fa466c84bc915 0	package.json
100644 bcbb99003750e6c101e4dd7390b33b2dd372ae66 0	template.config.js
100755 b7adefe32e2a2cfb1d9898a96d512f6299baa271 0	template/App.tsx
100755 178476699b605584dc503e85537c47dac8b7b611 0	template/__tests__/App-test.tsx
100755 934256cb29d4a3616c740861c6af35ff6a165917 0	template/_buckconfig
100755 40c6dcd05f3100109c83d8e5946ae1e99b25162b 0	template/_eslintrc.js
100755 d42ff18354df611a7cd2c52f852e9afc579bb194 0	template/_gitattributes
100755 4f5f4db4b5f6637bee7af72c3e63a39c167367e1 0	template/_gitignore
100755 5c4de1a4f6592df28e158eb0e6e9b8cca74377e1 0	template/_prettierrc.js
100755 9e26dfeeb6e641a33dae4961196235bdb965b21b 0	template/_watchmanconfig
100755 0e779048347e025bf341d2b2c0e96950cea2d1e3 0	template/android/app/_BUCK
100755 7898e7bd0a59376043f7434e4cb97403c53a6dbd 0	template/android/app/build.gradle
.....
.....
100755 ba72822e8728ef2951005e49b6c27a2f1da6572d 0	template/ios/HelloWorldTests/Info.plist
100755 0fa914aed2b57e228a595343379596aa444aeae4 0	template/ios/Podfile
100755 13a964217f20a081de8765924a21f9dad0e95306 0	template/metro.config.js
100755 63125d0a9aadd20c3165e57a067049e6014803fa 0	template/package.json

Unable to resolve "@babel/runtime/..."

Expected results

Success Build

Observed results

It gets an error says

Unable to resolve "@babel/runtime/helpers/builtin/interopRequireDefault"

Steps to reproduce

  1. Just try to install the project in iOS 12

Quick Fix

npm add @babel/runtime and restart the project.

Jest tests fail on a clean init project against RN 0.61.0-rc.2

Bug

Jest tests fail on a clean init project against RN 0.61.0-rc.2

output of yarn test

 โ— Console

    console.error node_modules/react/cjs/react.development.js:172
      Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

  โ— renders correctly

    Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

      at node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14806:34
      at createFiberFromTypeAndProps (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14809:13)
      at createFiberFromElement (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14830:15)
      at reconcileSingleElement (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:5154:23)
      at reconcileChildFibers (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:5211:35)
      at reconcileChildren (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7353:28)
      at updateHostRoot (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7780:5)
      at beginWork$1 (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9162:14)
      at performUnitOfWork (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:12981:12)
      at workLoopSync (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:12955:22)

Environment info

React native info output:

info Fetching system and libraries information...
System:
    OS: macOS 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 30.24 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 21, 23, 24, 25, 26, 27, 28
      Build Tools: 21.1.2, 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.2, 28.0.3
      System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
      Android NDK: 17.1.4828580
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.0-rc.2 => 0.61.0-rc.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

react-native init testrnnav --version 0.61.0-rc.2 --template typescript
yarn test
cd testrnnav/
yarn test

Tests fails with RN 0.59

If a test has the tsx extension and contains JSX code, the tests fails with this error message :

Jest encountered an unexpected token

However, if the tests does not contain JSX, it works perfectly.

I think we need fix the devDependencies in template package.json

Discussion & Proposal

Using stable package is very important for any one who r using this template.

Description

I just init react native project with rn cli, And I got this package.json as below
image
I think fix react native node with stable node_modules is good for developer who have no time to fix many trouble problem which could happen in setup environment.
e.g. dependency bug
I m using 0.58.0 typescript template, i think the template should be generate fixed version in devDependencies too.

Unable to import another tsx files in to App.tsx

Here is my App.tsx

import React from 'react';
import { View, Text} from 'react-native'

import HomeScreen from 'screens/home/HomeScreen';

const App = () => {
return ()
};

export default App;

I am getting this error when starting app

Unable to resolve module screens/home/HomeScreen from App.tsx: screens/home/HomeScreen could not be found within the project.

If you are sure the module exists, try these steps:

  1. Clear watchman watches: watchman watch-del-all
  2. Delete node_modules: rm -rf node_modules and run yarn install
  3. Reset Metro's cache: yarn start --reset-cache
  4. Remove the cache: rm -rf /tmp/metro-*

RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
UIApplicationMain
main
start
0x0

Any ideas what is missing?

error Error: Cannot find module '/var/folders/2y/.../T/rncli-init-template-jUussB/node_modules/typescript/template.config'

Question

When trying to init a new project I get the following error message:

~/MyDev/test$ npx react-native init myapp --template typescript
                                                          
               ######                ######               
             ###     ####        ####     ###             
            ##          ###    ###          ##            
            ##             ####             ##            
            ##             ####             ##            
            ##           ##    ##           ##            
            ##         ###      ###         ##            
             ##  ########################  ##             
          ######    ###            ###    ######          
      ###     ##    ##              ##    ##     ###      
   ###         ## ###      ####      ### ##         ###   
  ##           ####      ########      ####           ##  
 ##             ###     ##########     ###             ## 
  ##           ####      ########      ####           ##  
   ###         ## ###      ####      ### ##         ###   
      ###     ##    ##              ##    ##     ###      
          ######    ###            ###    ######          
             ##  ########################  ##             
            ##         ###      ###         ##            
            ##           ##    ##           ##            
            ##             ####             ##            
            ##             ####             ##            
            ##          ###    ###          ##            
             ###     ####        ####     ###             
               ######                ######               
                                                          

                  Welcome to React Native!                
                 Learn Once Write Anywhere                

โœ” Downloading template
โœ– Copying template
error Error: Cannot find module '/var/folders/2y/kvrr5nws6xz4nx9vnwjxj17w0000gn/T/rncli-init-template-jUussB/node_modules/typescript/template.config'
Require stack:
- /Users/doberkofler/.npm/_npx/27475/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/template.js
- /Users/doberkofler/.npm/_npx/27475/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/init.js
- /Users/doberkofler/.npm/_npx/27475/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/index.js
- /Users/doberkofler/.npm/_npx/27475/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/index.js
- /Users/doberkofler/.npm/_npx/27475/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js
- /Users/doberkofler/.npm/_npx/27475/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js
- /Users/doberkofler/.npm/_npx/27475/lib/node_modules/react-native/cli.js

0.59.10 template Cannot find module 'react-native/Libraries/NewAppScreen'

Bug

Environment info

info 
  React Native Environment Info:
    Binaries:
      Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
      Yarn: 1.12.3 - ~/.nvm/versions/node/v10.15.0/bin/yarn
      npm: 6.5.0 - ~/.nvm/versions/node/v10.15.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 27
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5522156
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.10 => 0.59.10 
    npmGlobalPackages:
      react-native-git-upgrade: 0.2.7

Reproducible sample code

   react-native init chat --version [email protected] --template typescript
   react-native run-ios

I got this error

error: bundling failed: Error: While resolving module `react-native/Libraries/NewAppScreen`, the Haste package `react-native` was found. However the module `Libraries/NewAppScreen` could not be found within the package. Indeed, none of these files exist:

It seems template code using 0.60.x react native feature.

Breaking with July release of React Native?

FYI, this seems to be breaking with the latest CLI 6.1.0:

D:\MyProject\node_modules\react-native\local-cli\cliEntry.js:30
import type {CommandT} from './commands';
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:599:28)
    at Module._compile (D:\MyProject\node_modules\pirates\lib\index.js:91:24)
    at Module._extensions..js (module.js:646:10)
    at Object.newLoader [as .js] (D:\MyProject\node_modules\pirates\lib\index.js:96:7)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)

Typescript: Duplicated identifier between React Native and ES6 Lib

Expected results

  • Typescript should compile with success.
  • Typescript errors should be shown in the console.
  • React Native should not compile when a Typescript error occurred.

Observed results

Newly created project with the template doesn't compile successfully. Global type declaration of react-native/index.d.ts are in conflict with typescript/lib/lib.es6.d.ts. Furthermore, Typescript errors are not show in the console.

Logs

Find below errors shown in the console of a tsc command.

node_modules/@types/react-native/globals.d.ts:92:14 - error TS2300: Duplicate identifier 'RequestInfo'.

92 declare type RequestInfo = Request | string;
                ~~~~~~~~~~~

node_modules/@types/react-native/index.d.ts:8844:11 - error TS2451: Cannot redeclare block-scoped variable 'console'.

8844     const console: Console;
               ~~~~~~~

node_modules/@types/react-native/index.d.ts:8852:18 - error TS2717: Subsequent property declarations must have the same type.  Property 'geolocation' must be of type 'Geolocation', but here has type 'GeolocationStatic'.

8852         readonly geolocation: Geolocation;
                      ~~~~~~~~~~~

node_modules/@types/react-native/index.d.ts:8855:11 - error TS2451: Cannot redeclare block-scoped variable 'navigator'.

8855     const navigator: Navigator;
               ~~~~~~~~~

node_modules/typescript/lib/lib.es6.d.ts:21580:13 - error TS2451: Cannot redeclare block-scoped variable 'navigator'.

21580 declare var navigator: Navigator;
                  ~~~~~~~~~

node_modules/typescript/lib/lib.es6.d.ts:21756:13 - error TS2451: Cannot redeclare block-scoped variable 'console'.

21756 declare var console: Console;
                  ~~~~~~~

node_modules/typescript/lib/lib.es6.d.ts:21813:6 - error TS2300: Duplicate identifier 'RequestInfo'.

21813 type RequestInfo = Request | string;

Steps to reproduce

  1. Create project: react-native init ReactNativeTest --template typescript && node ReactNativeTest/setup.js
  2. Compile Typescript (v2.9.2) manually to show errors: tsc (or npm run tsc with corresponding command in package.json)

Solution

  1. Specify in tsconfig.json valid library files to be included in the compilation. React Native is built on top of ES6 so that would be enough: "lib": [ "es6" ]

  2. @emin93 At least, it could be great if we can have Typescript output to debug app because sometimes:

  • The app can run with Typescript errors triggered silently in the background without any log
  • The React Native bundle.js is not generated when an error occurred and no log specifies the reason

176 type errors after react-native init

Bug

176 typescript errors after initialising project with typescript template (using community cli).

Environment info

React native info output:

info Fetching system and libraries information...
System:
    OS: macOS 10.15
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 379.68 MB / 16.00 GB
    Shell: 3.0.2 - /usr/local/bin/fish
  Binaries:
    Node: 12.11.1 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2

Library version: latest (from cli)

Steps To Reproduce

npm i -g @react-native-community/cli
react-native init test --template react-native-template-typescript
cd test
yarn tsc

Describe what you expected to happen:

  1. No errors

Reproducible sample code

n/a

Hot Reloading

Bug

Hot Reloading doesn't seem to be working

Environment info

React native info output:

System:
    OS: macOS 10.14.5
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 82.00 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.3 => 0.60.3 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Library version: x.x.x

Steps To Reproduce

  1. Enable Hot reloading
  2. Change some text in App.tsx
    ...

Describe what you expected to happen:

  1. Text should change with hot reloading enabled

Reproducible sample code

None required

Make it possible to write tests in TypeScript

Expected results

That configurations exists to make it possible to write tests with TypeScript. I'm aware that there exists some guide out there that allows us to configure Jest to work with TypeScript, but I think it should be part of this awesome template from the beginning.

Observed results

Currently the test that is created with this template is written in JS, and converting them to TypeScript makes Jest crash.

Logs

> yarn test
yarn run v1.13.0
$ jest
 FAIL  __tests__/App.tsx
  โ— Test suite failed to run

    MyTSApp/__tests__/App.tsx:6
    import 'react-native';
           ^^^^^^^^^^^^^^

    SyntaxError: Unexpected string

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:440:17)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.206s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Steps to reproduce

  1. react-native init MyTSApp --template typescript && node MyTSApp/setup.js
  2. Rename __tests__/App.js to __tests__/App.tsx
  3. Get error about invalid syntax (see error above)

New App Screen

Feature Request

Support for New App screen that came with React Native version 0.60

Why it is needed

This template is still using the old React Native App Screen. React Native version 0.60 came with a new App screen, which is much more helpful. To make it consistent with new react native version we need to upgrade it.

Possible implementation

We can use same implementation as https://github.com/facebook/react-native/tree/master/Libraries/NewAppScreen with little modifications.

An unexpected error occurred

Hello,

I read readMe file and then I check my global packages; I only see

 npm list -g --depth 0
/Users/xxx/.npm-global/lib
โ””โ”€โ”€ [email protected]

Then I wrote
npx react-native init newProject --template [email protected]
and I get

error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/efecantekin/Documents/Projeler/campa/campa/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.13.0
[1/2] ๐Ÿ—‘  Removing module [email protected]...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/remove for documentation about this command.
warn Failed to clean up template temp files in node_modules/[email protected]. This is not a critical error, you can work on your app.

How can I solve this problem?

Thank you,

Cannot find module 'rncli-init-template-FBKsnC/node_modules/typescript/template.config'

Bug

I did

npm init
npm i react-native react-native-template-typescript -D
npx react-native init app --template typescript

but the output is:

โœ” Downloading template
โœ– Copying template
error Error: Cannot find module '/var/folders/xj/t4w3l34124g6bxv455kt25ph0000gn/T/rncli-init-template-FBKsnC/node_modules/typescript/template.config'
Require stack:
- ./node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/template.js
- ./node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/init.js
- ./node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/index.js
- ./node_modules/react-native/node_modules/@react-native-community/cli/build/commands/index.js
- ./node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js
- ./node_modules/react-native/node_modules/@react-native-community/cli/build/index.js
- . /node_modules/react-native/cli.js

Environment info

React native info output:

$ npx react-native info
info Fetching system and libraries information...
System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
    Memory: 353.47 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.6.0 - /usr/local/bin/node
    npm: 6.9.0 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 19, 22, 23, 24, 25, 26, 28
      Build Tools: 25.0.2, 26.0.2, 27.0.3, 28.0.0, 28.0.3
      System Images: android-28 | Google Play Intel x86 Atom
      Android NDK: 17.2.4988734
  IDEs:
    Android Studio: 3.3 AI-182.5107.16.33.5314842
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react-native: ^0.60.4 => 0.60.4

react-native 0.60.4
react-native-typescript-template 5.2.0

Steps To Reproduce

Please see the Bug section above. Template / generator packages are installed locally and executed with npx.

What I expected to happen: The project creation succeed.

How to use this template for a RN 0.59 app

Question

The docs include the following information for RN 0.60 and 0.61

[email protected] or higher

npx react-native init MyApp --template react-native-template-typescript
[email protected]

npx react-native init MyApp --template [email protected]

But how would you use this template for a RN 0.59 app? I know it seems odd to want to bootstrap a new app with an older version of RN, but it can be useful for library maintainers who want to keep a matrix of RN versions in their samples\ to demonstrate compatibility of their library across recent versions of RN. With the current docs, it's unclear how to do it. I've been trying to use this template but the CLI doesn't seem to be applying it correctly because I end up with an App.js

Not working with Hello World tests

Expected results

The Hello World test should pass

Observed results

Something about the Babel / Jest config isn't working

Logs

> [email protected] test /Users/jp/Sites/Typescript
> jest

 FAIL  __tests__/App.tsx
  โ— Test suite failed to run

    Plugin 0 specified in "/Users/jp/Sites/Typescript/node_modules/babel-preset-react-native/index.js" provided an invalid property of "default" (While processing preset: "/Users/jp/Sites/Typescript/node_modules/babel-preset-react-native/index.js")

      at Plugin.init (node_modules/babel-core/lib/transformation/plugin.js:131:13)
      at Function.normalisePlugin (node_modules/babel-core/lib/transformation/file/options/option-manager.js:152:12)
      at node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
          at Array.map (<anonymous>)
      at Function.normalisePlugins (node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
      at OptionManager.mergeOptions (node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
      at node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
      at node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
          at Array.map (<anonymous>)
      at OptionManager.resolvePresets (node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.576s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `jest`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Steps to reproduce

  1. Run react-native init app --template typescript

  2. Make a new __tests__ directory in the root

  3. Copy __tests__/App.js from the Hello World template and save it as __tests__/App.tsx

  4. Run npm test

Can't create new project with 0.61

Bug

The installation command from the Readme file doesn't work:

$ npx react-native init RN61ts --template react-native-template-typescript
Using yarn v1.17.3
Installing react-native...
...
success Saved lockfile.
success Saved 411 new dependencies.
info Direct dependencies
โ””โ”€ [email protected]
...
โœจ  Done in 16.48s.
info Setting up new React Native app in /Users/gianfranco/temp/RN61ts
info Fetching template react-native-template-react-native-template-typescript...
yarn add v1.17.3
[1/4] ๐Ÿ”  Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > [email protected]: use String.prototype.padStart()
error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found".

This doesn't give an error but it creates a folder called template with, for example, the App.tsx file:

$ npx react-native init RN61ts --template typescript
$ ls RN61ts
ls RN61ts
App.js             __tests__          babel.config.js    metro.config.js    template
LICENSE            android            index.js           node_modules       template.config.js
README.md          app.json           ios                package.json       yarn.lock
$ ls RN61ts/template
App.tsx         android         babel.config.js ios             package.json
__tests__       app.json        index.js        metro.config.js

Maybe it's related that the template hasn't been upgraded to 0.61?

"dependencies": {
"react": "16.8.6",
"react-native": "0.60.5"
},

Environment info

React native info output:

$ npx react-native info
System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 334.95 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.11.3 - ~/.nvm/versions/node/v10.16.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 23, 24, 25, 26, 27, 28
      Build Tools: 20.0.0, 21.1.2, 22.0.1, 23.0.3, 25.0.3, 26.0.2, 27.0.0, 27.0.3, 28.0.2, 28.0.3, 29.0.0, 29.0.0, 29.0.2
      System Images: android-22 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.0 => 0.61.0
  npmGlobalPackages:
    react-native-autocomplete-dropdown: 1.0.0
    react-native-cli: 2.0.1
    react-native-rename: 2.4.0
    react-native-simple-radio-button: 2.7.3

FYI the main RN documentation website says to use the react-native global cli.
Is the README file in this repo outdated?

Init command not working at all

Bug

image

Environment info

no react-native-cli installed

Steps To Reproduce

Just following Readme documentation

Describe what you expected to happen:

I wanted a new project created with typescript support

Remove TSLint from the dependencies?

I was thinking about removing TSLint to be more consistent with the default React Native template.
Besides that, I think it's not nice if we force the default TSLint code style in new projects.

It'll still be very easy to include TSLint later as you need it.

run command get an error

warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > [email protected]: use String.prototype.padStart()
error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-native-template-typescript
: Not found".
info If you think this is a bug, please open a bug report with the information provided in "C:\Users\i321872\Desktop
\rn-2\rnts02\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.12.3
[1/2] Removing module react-native-template-react-native-template-typescript...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/remove for documentation about this command.
warn Failed to clean up template temp files in node_modules/react-native-template-react-native-template-typescript. This
is not a critical error, you can work on your app.
(node:30872) UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-templa
te-typescript
at makeError (C:\Users\i321872\Desktop\rn-2\rnts02\node_modules\execa\index.js:174:9)
at Promise.all.then.arr (C:\Users\i321872\Desktop\rn-2\rnts02\node_modules\execa\index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:30872) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing ins
ide of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejectio
n id: 3)
(node:30872) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejection
s that are not handled will terminate the Node.js process with a non-zero exit code.

How to use typescript template for RN app < 0.60

Question

I try several commands before open this issue. #82 doesn't have any guide to how to use for RN apps below 0.60.

I try:

Tried with npx react-native init... as well and can't find any solution for this.
Any help how I can create an new app with [email protected] and typescript I appreciate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.