Skip to content
Merged
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
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ Both platforms: `TrueSheetView` (hidden host) → Controller → `ContainerView`
2. Create event class in `ios/events/` and `android/.../events/`
3. Emit from native view

### Adding an iOS source folder

`RNTrueSheet.podspec` (CocoaPods) and `Package.swift` (SwiftPM) both build `ios/` and `common/cpp/`. CocoaPods flattens headers and SwiftPM does not, so add any new folder that holds headers to `headerSearchPaths` in `Package.swift`. CI only builds CocoaPods, so a missing entry breaks SwiftPM apps silently.

### Updating the AI skill

`skills/truesheet-usage/` is the consumer-facing skill installed via `npx skills add lodev09/react-native-true-sheet`. Whenever docs under `docs/content/docs/next/` change (new prop, event, method, guide, limitation, or troubleshooting entry), update the skill to match in the same PR:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### 🎉 New features

- **iOS**: Added Swift Package Manager support for apps using React Native's SwiftPM setup (`npx react-native spm`, React Native 0.88 and later). CocoaPods is unchanged. ([#1013](https://github.com/lodev09/react-native-true-sheet/pull/1013) by [@VladyslavMartynov10](https://github.com/VladyslavMartynov10) and [@lodev09](https://github.com/lodev09))

### 🐛 Bug fixes

- **Android**: A sheet whose keyboard starts rising as the present slide ends, such as one that focuses an input around `onWillPresent`, now finishes presenting. It used to never fire `onDidPresent` or resolve `present()`, and kept swallowing taps. ([#1012](https://github.com/lodev09/react-native-true-sheet/pull/1012) by [@JacquesLeupin](https://github.com/JacquesLeupin))
Expand Down
59 changes: 59 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// swift-tools-version: 6.0

// Swift Package Manager manifest consumed by React Native's SwiftPM autolinking
// (react-native >= 0.88, `npx react-native spm`). CocoaPods keeps using
// RNTrueSheet.podspec and is unaffected.
//
// The autolinker references this package through a symlink at
// <app>/ios/build/generated/autolinking/libs/RNTrueSheet, and SwiftPM resolves
// the relative `.package(path:)` entries below against that symlink, so they
// point at the app's prebuilt React Native and codegen packages. They do not
// resolve in a bare clone of this repository.

import PackageDescription

// CocoaPods flattens a pod's headers into one directory and SwiftPM does not,
// so every folder that holds headers must be listed here.
let headerSearchPaths = ["ios", "ios/core", "ios/events", "ios/utils", "common/cpp"]

let package = Package(
name: "RNTrueSheet",
platforms: [.iOS("15.1")],
products: [
.library(name: "RNTrueSheet", targets: ["RNTrueSheet"]),
],
dependencies: [
.package(name: "ReactNative", path: "../../../../xcframeworks"),
.package(name: "React-GeneratedCode", path: "../../../ios"),
],
targets: [
.target(
name: "RNTrueSheet",
dependencies: [
.product(name: "ReactHeaders", package: "ReactNative"),
.product(name: "ReactNativeHeaders", package: "ReactNative"),
.product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
.product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
],
path: ".",
// tvOS builds stubs only (see the podspec); SwiftPM autolinking targets iOS.
exclude: ["ios/tvos"],
sources: ["ios", "common/cpp"],
publicHeadersPath: "ios",
cSettings: [.define("RCT_NEW_ARCH_ENABLED", to: "1")]
+ headerSearchPaths.map { CSetting.headerSearchPath($0) },
cxxSettings: [
.define("RCT_NEW_ARCH_ENABLED", to: "1"),
// Must match the prebuilt React.framework's config-gated C++ ABI.
.define("DEBUG", .when(configuration: .debug)),
.define("NDEBUG", .when(configuration: .release)),
] + headerSearchPaths.map { CXXSetting.headerSearchPath($0) },
linkerSettings: [
.linkedFramework("UIKit"),
.linkedFramework("Foundation"),
.linkedFramework("CoreGraphics"),
]
),
],
cxxLanguageStandard: .cxx20
)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ yarn add @lodev09/react-native-true-sheet
cd ios && pod install
```

On apps using React Native's Swift Package Manager setup (React Native 0.88+), run `npx react-native spm` instead of `pod install`.

## Documentation

- [Example](example)
Expand Down
2 changes: 2 additions & 0 deletions docs/content/docs/next/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ Then install the native dependencies:
```sh
cd ios && pod install
```

On apps using React Native's Swift Package Manager setup (React Native 0.88+), run `npx react-native spm` instead of `pod install`.
4 changes: 4 additions & 0 deletions ios/TrueSheetViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
#if __has_include(<RNScreens/RNSDismissibleModalProtocol.h>)
#import <RNScreens/RNSDismissibleModalProtocol.h>
#define RNS_DISMISSIBLE_MODAL_PROTOCOL_AVAILABLE 1
// SwiftPM does not flatten headers: react-native-screens is exposed under its package paths
#elif __has_include(<RNScreens/ios/integrations/RNSDismissibleModalProtocol.h>)
#import <RNScreens/ios/integrations/RNSDismissibleModalProtocol.h>
#define RNS_DISMISSIBLE_MODAL_PROTOCOL_AVAILABLE 1
#else
#define RNS_DISMISSIBLE_MODAL_PROTOCOL_AVAILABLE 0
#endif
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"ios",
"common",
"*.podspec",
"Package.swift",
"react-native.config.js",
"!ios/build",
"!android/build",
Expand Down Expand Up @@ -308,5 +309,8 @@
}
}
}
},
"swiftpmConfig": {
"name": "RNTrueSheet"
}
}
2 changes: 1 addition & 1 deletion skills/truesheet-usage/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: >-

Use this skill to produce correct, idiomatic code for apps that consume `@lodev09/react-native-true-sheet` (v4). It covers choosing the right integration pattern, applying the public API correctly, and avoiding platform-specific pitfalls.

Requires React Native >= 0.82 (Expo SDK 55+) with the New Architecture.
Requires React Native >= 0.82 (Expo SDK 55+) with the New Architecture. On iOS it links through CocoaPods (`pod install`) or React Native's Swift Package Manager setup (`npx react-native spm`, RN 0.88+).

## Quick Start

Expand Down
Loading