Created
February 14, 2020 18:59
-
-
Save smilingkylan/7a1e0a24b2c77396e6339cf60aa640bb to your computer and use it in GitHub Desktop.
Bash create style files from React Native components (Example)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in ./*.tsx; | |
do | |
FILE=$f | |
if [ ! -f "../styles/${f%.tsx}Style.ts" ]; then | |
echo "Processing $f" | |
cp $f /Users/myUser/src/styles/${f%.tsx}Style.ts | |
cat /Users/myUser/StyleTemplate.ts > /Users/myUser/src/styles/${f%.tsx}Style.ts | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { StyleSheet, Dimensions } from 'react-native' | |
const { width, height } = Dimensions.get('window') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment