Picker web import line missing colon causing error
https://github.com/react-native-community/react-native-picker/blob/414892c0f633271a59216193d1f439bb6c0a1c96/js/Picker.web.js#L7
https://github.com/react-native-community/react-native-picker/blob/a50ec11d98b7cbb20b13892716ec9601852d9394/js/Picker.web.js#L13
Any progress on this issue? Have you worked on a PR? If not, then I can take a look
I also encountered this problem when compiling with react native web. any fixes ?
SyntaxError: D:\RahtabMonoRepo\applications\node_modules\@react-native-picker\picker\js\Picker.web.js: Unexpected token (9:12)
7 | 8 | import React from 'react'; > 9 | import type { | ^ 10 | ViewStyleProp, 11 | TextStyleProp, 12 | } from 'react-native/Libraries/StyleSheet/StyleSheet';
I also encountered this problem when compiling with react native web. any fixes ?
SyntaxError: D:\RahtabMonoRepo\applications\node_modules@react-native-picker\picker\js\Picker.web.js: Unexpected token (9:12)
7 | 8 | import React from 'react';
9 | import type { | ^ 10 | ViewStyleProp, 11 | TextStyleProp, 12 | } from 'react-native/Libraries/StyleSheet/StyleSheet';
@mkhib I have the same issue any solution?
I also encountered this problem when compiling with react native web. any fixes ? SyntaxError: D:\RahtabMonoRepo\applications\node_modules@react-native-picker\picker\js\Picker.web.js: Unexpected token (9:12) 7 | 8 | import React from 'react';
9 | import type { | ^ 10 | ViewStyleProp, 11 | TextStyleProp, 12 | } from 'react-native/Libraries/StyleSheet/StyleSheet';
@mkhib I have the same issue any solution?
As a temporary workaround I’ve created two separate components for web and native and used the deprecated picker from ‘react-native’ for the web and it is working as expected.
I'm not able to reproduce this issue on my side when using it for web. Could you create a minimal sample repo that causes the issue? Thanks
error - ./node_modules/@react-native-community/picker/js/Picker.web.js:9:12 Syntax error: Unexpected token
7 | 8 | import React from 'react';
9 | import type { | ^ 10 | ViewStyleProp, 11 | TextStyleProp, 12 | } from 'react-native/Libraries/StyleSheet/StyleSheet';
any update on this issue?
any update on this issue?
after tested from latest version, just v1.9.5 work for me
v1.16.5 monorepo web + rn still has error
I'm also encountering this error when using Picker inside of a typescript project: `
node_modules/@react-native-picker/picker/js/Picker.web.js: Unexpected token (10:12):
at this line:
import type {ViewProps} from 'react-native-web/src/exports/View/types';
using 1.16.5 of the picker
Hello @Naturalclar, please check minimal repo with repro:
https://github.com/Zahoq/rnwPickerIssue
(I've created repo with create-react-native-web-app, however I've removed android directory as it was not needed)
Environment: Windows 10, Chrome 93.0.4577.63 (64-bit), React: 17.0.2, @react-native-picker/picker: 2.0.0
to run app:
- yarn
- yarn web
Compilation attempt results with:
Failed to compile.
./node_modules/@react-native-community/picker/js/Picker.web.js
SyntaxError: C:\code\rnwPickerIssue\node_modules\@react-native-community\picker\js\Picker.web.js: Unexpected token (9:12)
7 |
8 | import React from 'react';
> 9 | import type {
| ^
10 | ViewStyleProp,
11 | TextStyleProp,
12 | } from 'react-native/Libraries/StyleSheet/StyleSheet';
@Zahoq Same issue here, have you found any solution?
:tada: This issue has been resolved in version 2.0.3 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
@d-vincent regarding workaround: you can add webpack configuration to support flow:
addWebpackModuleRule({
test: /react-native-(picker|web)(-select)?.*\.jsx?$/,
use: {
loader: 'babel-loader',
options: {
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-flow",
]
}
}
}),
@Naturalclar fix works, thanks!