Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/build-ios-rn080.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build iOS (React Native 0.80)

# Builds the NitroModules pod inside a bare React Native 0.80 app with static
# libraries (the CocoaPods default). React Native <= 0.83 builds glog from
# source with a modulemap that cannot be compiled as a clang module, so any
# NitroModules public header that (transitively) includes <glog/logging.h>
# breaks every `import NitroModules` from Swift. The example app cannot cover
# this: its React Native ships glog with a textual-headers modulemap (RN 0.84+).

on:
push:
branches:
- main
paths:
- '.github/workflows/build-ios-rn080.yml'
- 'packages/react-native-nitro-modules/cpp/**'
- 'packages/react-native-nitro-modules/ios/**'
- 'packages/react-native-nitro-modules/*.podspec'
- 'packages/react-native-nitro-modules/nitro_pod_utils.rb'
pull_request:
paths:
- '.github/workflows/build-ios-rn080.yml'
- 'packages/react-native-nitro-modules/cpp/**'
- 'packages/react-native-nitro-modules/ios/**'
- 'packages/react-native-nitro-modules/*.podspec'
- 'packages/react-native-nitro-modules/nitro_pod_utils.rb'

env:
XCODE_VERSION: '26.5'
RN_VERSION: '0.80.3'

jobs:
build:
name: Build NitroModules pod (RN 0.80, static libraries)
runs-on: macOS-26
steps:
- uses: actions/checkout@v7

- name: Select Xcode ${{ env.XCODE_VERSION }}
run: sudo xcode-select -s "/Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer"

- name: Create a bare React Native ${{ env.RN_VERSION }} app
working-directory: ${{ runner.temp }}
run: npx -y @react-native-community/cli@latest init TestApp --version ${{ env.RN_VERSION }} --skip-git-init --install-pods false

- name: Add NitroModules to the Podfile
working-directory: ${{ runner.temp }}/TestApp/ios
env:
NITRO_PATH: ${{ github.workspace }}/packages/react-native-nitro-modules
run: |
ruby - <<'RUBY'
podfile = File.read('Podfile')
pod_line = " pod 'NitroModules', :path => '#{ENV['NITRO_PATH']}'\n"
raise 'use_native_modules! not found in template Podfile' unless podfile.sub!(/^(\s*config = use_native_modules!\n)/) { "#{$1}#{pod_line}" }
File.write('Podfile', podfile)
RUBY

- name: Install Pods
working-directory: ${{ runner.temp }}/TestApp/ios
run: pod install

- name: Build NitroModules pod
working-directory: ${{ runner.temp }}/TestApp/ios
run: |
set -o pipefail
xcodebuild \
-project Pods/Pods.xcodeproj \
-target NitroModules \
-sdk iphonesimulator \
-configuration Debug \
ARCHS=arm64 \
ONLY_ACTIVE_ARCH=YES \
build | xcbeautify --renderer github-actions
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
#define _CXX_INTEROP_HAS_ATTRIBUTE(x) 0
#endif

// Helper to find out if this code is currently being compiled as part of a given clang module
#ifdef __building_module
#define NITRO_BUILDING_MODULE(module) __building_module(module)
#else
#define NITRO_BUILDING_MODULE(module) 0
#endif

// Closed/Final Enums
#if _CXX_INTEROP_HAS_ATTRIBUTE(enum_extensibility)
// Enum is marked as closed/not extensible
Expand Down
9 changes: 9 additions & 0 deletions packages/react-native-nitro-modules/cpp/views/ReactProp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

#pragma once

#include "NitroDefines.hpp"

// This header includes <react/renderer/*> headers, which cannot be compiled as part of a
// clang module - so it is hidden from the Swift-facing `NitroModules` module and can only
// be included textually, from C++.
#if !NITRO_BUILDING_MODULE(NitroModules)

#include "BorrowingReference.hpp"
#include "IsFunctionProp.hpp"
#include "JSIConverter.hpp"
Expand Down Expand Up @@ -121,3 +128,5 @@ class ReactProp final {
};

} // namespace margelo::nitro

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

#pragma once

#include "NitroDefines.hpp"

// This header includes <react/renderer/*> headers, which cannot be compiled as part of a
// clang module - so it is hidden from the Swift-facing `NitroModules` module and can only
// be included textually, from C++.
#if !NITRO_BUILDING_MODULE(NitroModules)

#include "RawPropsCompat.hpp"

#include <concepts>
Expand Down Expand Up @@ -75,3 +82,5 @@ class ViewComponentDescriptor final : public react::ConcreteComponentDescriptor<
};

} // namespace margelo::nitro

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

#pragma once

#include "NitroDefines.hpp"

// This header includes <react/renderer/*> headers, which cannot be compiled as part of a
// clang module - so it is hidden from the Swift-facing `NitroModules` module and can only
// be included textually, from C++.
#if !NITRO_BUILDING_MODULE(NitroModules)

#include <memory>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <utility>
Expand Down Expand Up @@ -48,3 +55,5 @@ struct ViewPropsHolderState final {
};

} // namespace margelo::nitro

#endif