Skip to content

Ability to specify a custom IP for 'react-native run-ios' command #406

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

Open
GrabbenD opened this issue Sep 16, 2021 · 2 comments
Open

Ability to specify a custom IP for 'react-native run-ios' command #406

GrabbenD opened this issue Sep 16, 2021 · 2 comments

Comments

@GrabbenD
Copy link

Introduction

The current implementation of react-native-xcode.sh script is limited to the first available network interface (see code snippet):

# Enables iOS devices to get the IP address of the machine running Metro
if [[ "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then
  for num in 0 1 2 3 4 5 6 7 8; do
    IP=$(ipconfig getifaddr en${num})
    if [ ! -z "$IP" ]; then
      break
    fi
  done
  if [ -z "$IP" ]; then
    IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | grep -v ' 169.254.' |cut -d\   -f2  | awk 'NR==1{print $1}')
  fi

  echo "$IP" > "$DEST/ip.txt"
fi

This makes it quite difficult to get Metro Server to run on the correct interface with a custom network configuration.

Details

The above code is executed in xCode during Bundle React Native code and images build phase:

export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh

Discussion points

Option of allowing IP= to be customized would make it greatly easier for developers to run Metro Server with react-native run-ios command. I personally find it troublesome to get Metro Server to work with my setup and this feature would be greatly appreciated

@kelset
Copy link
Member

kelset commented Sep 17, 2021

I think it'd be a good idea, but it's likely that you'd have to do the PR yourself to enable this. It'd probably the fastest way to get someone to review and give you feedback

@cortinico
Copy link
Member

I think it'd be a good idea, but it's likely that you'd have to do the PR yourself to enable this. It'd probably the fastest way to get someone to review and give you feedback

Indeed 👍 I believe is a good addition. A PR on this is most likely going to be reviewed/merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants