react-native-scrollable-tab-view
react-native-scrollable-tab-view copied to clipboard
ReferenceError: Can't find variable: ReactNative
terminal logs:

System:
OS: macOS 10.15.6
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 894.66 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 11.13.0 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_202 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.2 => 0.63.2
npmGlobalPackages:
*react-native*: Not Found
Same problem here
Got this on Android only after upgrading from RN 0.61 to RN 0.63. I guess this came from an update in Metro Bundler.
https://github.com/ptomasroos/react-native-scrollable-tab-view/blob/master/index.js#L3
This seems totally unnecessary and kind of weird that ViewPropTypes is destructuring outside the block a few lines down.
I patched it like this and run on npm postinstall:
# postinstall.sh
RN_SCROLLABLE_TAB_VIEW_FILE="./node_modules/react-native-scrollable-tab-view/index.js"
if [ -e $RN_SCROLLABLE_TAB_VIEW_FILE ]; then
echo "Patching react-native-scrollable-tab-view to not break on RN 0.63 and new Metro Bundler..."
sed -i '' "s/const { ViewPropTypes } = ReactNative = require('react-native');/const ReactNative = require('react-native'); const { ViewPropTypes } = ReactNative;/g" $RN_SCROLLABLE_TAB_VIEW_FILE || true
fi
It just declares const ReactNative = require('react-native'); before destructuring ViewPropTypes.
anyone Find solution for this ?
solution for this please
any fix for this?
any fix for this pleeaaaaaaaaaaase
Hi everyone, the above patch did work perfectly for us for more than a year on an app with 30k + users.
The problem is here:
https://github.com/ptomasroos/react-native-scrollable-tab-view/blob/master/index.js#L3
The weird destructuring on Line 3 breaks Metro Bundler. The author just had to write two lines like a normal developer would.
Anyway last year we removed this library completely and wrote our own in-house version, but unfortunately I don't think we will be open sourcing it as it is quite bespoke 😩
Best of luck to everyone fixing or finding an alternative 🙏