react-native icon indicating copy to clipboard operation
react-native copied to clipboard

error: SyntaxError: .../node_modules/react-native/Libraries/Components/Touchable/Touchable.js: Unexpected token, expected "]" (25:45)

Open alexkendall opened this issue 1 year ago • 26 comments

New Version

0.70.0

Old Version

0.63.3

Build Target(s)

iOS 16.0

Output of react-native info

System: OS: macOS 13.0 CPU: (8) x64 Apple M1 Memory: 27.19 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node Yarn: 1.22.19 - ~/.yarn/bin/yarn npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm Watchman: 2021.06.07.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/alex/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: API Levels: 28, 29, 30, 31 Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 31.0.0 System Images: android-25 | Google APIs ARM 64 v8a, android-29 | Google Play ARM 64 v8a, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play ARM 64 v8a, android-31 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7486908 Xcode: 14.0/14A309 - /usr/bin/xcodebuild Languages: Java: 11.0.10 - /opt/homebrew/opt/openjdk@11/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.1 => 0.70.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Issue and Reproduction Steps

  1. Build the app using Xcode 14
  2. yarn start --reset-cache
  3. Error displays

alexkendall avatar Sep 18 '22 21:09 alexkendall

Screenshot 2022-09-19 at 8 06 07 PM

alexkendall avatar Sep 20 '22 00:09 alexkendall

+1 Same issue is happening to me

hemantgogia09 avatar Sep 20 '22 06:09 hemantgogia09

Same for Android upgrading form 0.63.4

ChaseApptentive avatar Sep 20 '22 16:09 ChaseApptentive

By the way @here. I had to patch that file using the version from 0.69 with patch-package to get the latest version of react-native to compile after upgrading from 0.63.3

alexkendall avatar Sep 20 '22 18:09 alexkendall

Just upgraded from 0.63.4 to 0.70.1 and got this error This helped me rm -fr node_modules watchman watch-del-all

bulatshafigullin avatar Sep 27 '22 10:09 bulatshafigullin

Running into this error as well, upgraded from 0.64.0 to 0.70.2

lmarques6 avatar Oct 06 '22 15:10 lmarques6

Running into this error as well, upgraded from 0.67.3 to 0.70.3

maximpostnikov avatar Oct 18 '22 23:10 maximpostnikov

Hello, solve this issue writing this in app console : rm -rf node_modules rm yarn.lock yarn

rmojsejkov avatar Oct 21 '22 00:10 rmojsejkov

Issue persists when upgrading from 0.69.3 to 0.70.4

Temporary work around react-native+0.70.4.patch

diff --git a/node_modules/react-native/Libraries/Components/Touchable/Touchable.js b/node_modules/react-native/Libraries/Components/Touchable/Touchable.js
index ea448b3..a1fb596 100644
--- a/node_modules/react-native/Libraries/Components/Touchable/Touchable.js
+++ b/node_modules/react-native/Libraries/Components/Touchable/Touchable.js
@@ -21,18 +21,7 @@ import type {ColorValue} from '../../StyleSheet/StyleSheet';
 import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
 import type {PressEvent} from '../../Types/CoreEventTypes';
 
-const extractSingleTouch = (nativeEvent: {
-  +changedTouches: $ReadOnlyArray<PressEvent['nativeEvent']>,
-  +force?: number,
-  +identifier: number,
-  +locationX: number,
-  +locationY: number,
-  +pageX: number,
-  +pageY: number,
-  +target: ?number,
-  +timestamp: number,
-  +touches: $ReadOnlyArray<PressEvent['nativeEvent']>,
-}) => {
+const extractSingleTouch = nativeEvent => {
   const touches = nativeEvent.touches;
   const changedTouches = nativeEvent.changedTouches;
   const hasTouches = touches && touches.length > 0;

dcangulo avatar Oct 27 '22 11:10 dcangulo

I also had a similar problem

xianguoGou avatar Nov 08 '22 01:11 xianguoGou