Skip to content

Instantly share code, notes, and snippets.

@durul
Created May 29, 2026 17:26
Show Gist options
  • Select an option

  • Save durul/2968bee19e294a8de85e9498c5621487 to your computer and use it in GitHub Desktop.

Select an option

Save durul/2968bee19e294a8de85e9498c5621487 to your computer and use it in GitHub Desktop.
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'fliprn2' do
  use_expo_modules!

  if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1'
    config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"];
  else
    config_command = [
      'node',
      '--no-warnings',
      '--eval',
      'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))',
      'react-native-config',
      '--json',
      '--platform',
      'ios'
    ]
  end

  config = use_native_modules!(config_command)

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )

    # Workaround: fmt 11.0.2's consteval format-string checking is rejected by
    # Apple clang 21 (Xcode 26) with "call to consteval function ... is not a
    # constant expression". Disable consteval in fmt (falls back to runtime
    # checks). Re-applied here so it survives `pod install`.
    fmt_base = File.join(__dir__, 'Pods', 'fmt', 'include', 'fmt', 'base.h')
    if File.exist?(fmt_base)
      contents = File.read(fmt_base)
      patched = contents.gsub(
        '#elif defined(__apple_build_version__) && __apple_build_version__ < 14000029L',
        '#elif defined(__apple_build_version__)'
      )
      if patched != contents
        File.write(fmt_base, patched)
        Pod::UI.puts '[fmt patch] Disabled consteval for Apple clang (Xcode 26 compatibility)'.green
      end
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment