-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't Compile #242
Comments
Same here using it with react-native-web |
Also had an issue in segmented-input with react-native-web. Just modify your webpack.config.js where you configure your babel loader:
Adding this solves the problem: path.resolve(appDirectory, 'node_modules/@react-native-segmented-control/segmented-control'), |
I needed to make this work with NextJS and achieved that using a webpack loader, that strips away the flow types (which is the root cause of the problem:
Solution with babel will be similar. Hope this helps! |
Thanks @balgamat your solution helped me get most of the way. I have a similar use case with @expo/next-adapter I also had to add the package to const nextConfig = {
reactStrictMode: false,
transpilePackages: [
'@react-native-segmented-control/segmented-control',
// blah blah blah...
],
webpack: (c) => {
c.module.rules.push({
test: /\.jsx?$/,
use: ['remove-flow-types-loader']
})
return c
}
}
module.exports = withExpo(nextConfig) |
I wanted to use your component.
I'm getting compilations errors after adding: "import SegmentedControl from '@react-native-segmented-control/segmented-control/SegmentedControl.js';" to my js file.
I'm running on a Mac.
I've followed the installation instructions. I can see the module in node_modules.
Please advise.
-------------------------- Error Message ----------------------------
Creating an optimized production build...
Failed to compile.
./node_modules/@react-native-segmented-control/segmented-control/js/SegmentedControl.js
SyntaxError: /Users/alexbasile/jars_workspace/src/gitlab.com/jarsgroup/ras.gg/node_modules/@react-native-segmented-control/segmented-control/js/SegmentedControl.js: Unexpected token (18:12)
16 | } from 'react-native';
17 |
The text was updated successfully, but these errors were encountered: