React-native import fixing script
This script fixes imports so that they work both with
react-native link React projects and
cocoapods React projects.
./importFixingUtil.sh . RCTConvert
where param1 is the directory you want it to scan and change, and param2 is the name of the React import you want to change.
Before running the script:
... #import <React/UIView+React.h> ...
After running the script
./importFixingUtil.sh ios/ExampleApp/ UIView+React:
... #if __has_include(<React/UIView+React.h>) #import <React/UIView+React.h> #else #import "UIView+React.h" #endif ...
- This script runs as is on Linux shell.
- For OSX shell I
- renamed the
brew install findutils gnu-sed(Found that here)
- commented out the chmod line