Skip to content

Commit

Permalink
Merge pull request #146 from flexn-io/fix/postinstall_script_crosspla…
Browse files Browse the repository at this point in the history
…tform

fix postinstall script on linux
  • Loading branch information
mihaiblaga89 committed Jul 31, 2023
2 parents 69ae6cc + d71bd63 commit c5040fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/create/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"clean": "rm -rf ./lib && rm -rf tsconfig.tsbuildinfo",
"compile": "tsc -b tsconfig.json",
"watch": "tsc --watch --preserveWatchOutput",
"postinstall": "sh tools/overrideRNScrollView.sh"
"postinstall": "bash tools/overrideRNScrollView.sh"
},
"files": [
"lib",
Expand Down
8 changes: 3 additions & 5 deletions packages/create/tools/overrideRNScrollView.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -euo pipefail

Expand All @@ -7,16 +7,14 @@ RN_DIR="${CREATE_DIR}/../../../react-native"
RN_SCROLLVIEW_DIR="${RN_DIR}/Libraries/Components/ScrollView"
MIN_RN_VERSION="68"

echo "${RN_DIR}/package.json"

if [ -e "${RN_DIR}/package.json" ] ; then
PACKAGE_VERSION=$(cat ${RN_DIR}/package.json \
PACKAGE_VERSION=$(cat "${RN_DIR}"/package.json \
| grep version \
| head -1 \
| awk -F: '{print $2 }' \
| sed 's/[",]//g')

if [ -e $RN_SCROLLVIEW_DIR ] && [ "${PACKAGE_VERSION:3:2}" -ge "${MIN_RN_VERSION}" ] ; then
if [ -e "$RN_SCROLLVIEW_DIR" ] && [ "${PACKAGE_VERSION:3:2}" -ge "${MIN_RN_VERSION}" ] ; then
sed -i '' "s|'RCTScrollView'|Platform.isTV \&\& Platform.OS === 'android' ? 'RCTScrollViewTV' : 'RCTScrollView'|" "${RN_SCROLLVIEW_DIR}/ScrollViewNativeComponent.js"
echo "Overriding done."
else
Expand Down

0 comments on commit c5040fe

Please sign in to comment.