@expo/ui 58.0.12 → 58.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +1 -0
- package/build/State/index.d.ts +1 -0
- package/build/State/index.js +1 -0
- package/build/State/index.js.map +1 -1
- package/build/State/useWorkletCallback.d.ts +31 -0
- package/build/State/useWorkletCallback.js +30 -0
- package/build/State/useWorkletCallback.js.map +1 -0
- package/build/jetpack-compose/index.d.ts +1 -1
- package/build/jetpack-compose/index.js +1 -1
- package/build/jetpack-compose/index.js.map +1 -1
- package/build/swift-ui/ArrangementView/index.d.ts +48 -0
- package/build/swift-ui/ArrangementView/index.js +56 -0
- package/build/swift-ui/ArrangementView/index.js.map +1 -0
- package/build/swift-ui/index.d.ts +2 -1
- package/build/swift-ui/index.js +2 -1
- package/build/swift-ui/index.js.map +1 -1
- package/build/swift-ui/modifiers/arrangementModifiers.d.ts +109 -0
- package/build/swift-ui/modifiers/arrangementModifiers.js +35 -0
- package/build/swift-ui/modifiers/arrangementModifiers.js.map +1 -0
- package/build/swift-ui/modifiers/hingeObservation.d.ts +73 -0
- package/build/swift-ui/modifiers/hingeObservation.js +45 -0
- package/build/swift-ui/modifiers/hingeObservation.js.map +1 -0
- package/build/swift-ui/modifiers/index.d.ts +4 -1
- package/build/swift-ui/modifiers/index.js +2 -0
- package/build/swift-ui/modifiers/index.js.map +1 -1
- package/ios/ArrangementViewView.swift +40 -0
- package/ios/ExpoUIModule.swift +1 -0
- package/ios/Modifiers/ArrangementModifiers.swift +157 -0
- package/ios/Modifiers/HingeObservationModifiers.swift +82 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +28 -3
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.12/expo.modules.ui-58.0.12-sources.jar → 58.0.13/expo.modules.ui-58.0.13-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.12/expo.modules.ui-58.0.12.module → 58.0.13/expo.modules.ui-58.0.13.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.12/expo.modules.ui-58.0.12.pom → 58.0.13/expo.modules.ui-58.0.13.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.13/expo.modules.ui-58.0.13.pom.sha512 +1 -0
- package/package.json +2 -2
- package/prebuilds/output/debug/xcframeworks/ExpoUI.tar.gz +0 -0
- package/prebuilds/output/release/xcframeworks/ExpoUI.tar.gz +0 -0
- package/src/State/index.ts +1 -0
- package/src/State/useWorkletCallback.ts +48 -0
- package/src/jetpack-compose/index.ts +1 -1
- package/src/swift-ui/ArrangementView/index.tsx +70 -0
- package/src/swift-ui/index.tsx +2 -1
- package/src/swift-ui/modifiers/arrangementModifiers.ts +142 -0
- package/src/swift-ui/modifiers/hingeObservation.ts +91 -0
- package/src/swift-ui/modifiers/index.ts +4 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.12/expo.modules.ui-58.0.12.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [iOS] Add `ArrangementView` component and `arrangementViewStyle`, `splitArrangementLayoutRatio`, `splitArrangementLayoutSize`, `splitArrangementFixedLayoutSize`, and `overlayArrangementEdge` modifiers. ([#50893](https://github.com/expo/expo/pull/50893) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
|
|
8
|
+
- [Android] Fix `TimePickerDialog` ignoring `elementColors.containerColor`. ([#51116](https://github.com/expo/expo/pull/51116) by [@expo-bot](https://github.com/expo-bot))
|
|
9
|
+
- [iOS][tvOS] Fix the tvOS build failing to compile with `'inlineLarge' is unavailable in tvOS` when `@expo/ui` is linked. `ToolbarTitleDisplayMode.inlineLarge` is unavailable on tvOS, but the `inlineLarge` case of the `toolbarTitleDisplayMode` modifier was only gated behind an OS version check that listed `tvOS 18.0`, so it was compiled into the tvOS slice. It is now guarded by platform and returns `nil` on tvOS. The same check also required iOS 18.0 / macOS 15.0, so `inlineLarge` silently fell back to `automatic` on iOS 17 and macOS 14 even though it is available there; it now applies on those versions. ([#51007](https://github.com/expo/expo/pull/51007) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
10
|
+
- [iOS] `onHingeChange` also accepts a callback from `useWorkletCallback`, which runs on the UI thread to track the hinge angle without a JS-thread round trip. ([#50910](https://github.com/expo/expo/pull/50910) by [@huntie](https://github.com/huntie))
|
|
11
|
+
- [iOS] Added the `onHingeChange` modifier, which reports the device hinge angle and status on iPhone Duo (iOS 27.1+). ([#50909](https://github.com/expo/expo/pull/50909) by [@huntie](https://github.com/huntie))
|
|
12
|
+
- Added the `useWorkletCallback` hook, which wraps a worklet function so a modifier that accepts one can run it synchronously on the UI thread. ([#51108](https://github.com/expo/expo/pull/51108) by [@huntie](https://github.com/huntie))
|
|
13
|
+
|
|
3
14
|
## 58.0.12
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -12,13 +12,13 @@ apply plugin: 'expo-module-gradle-plugin'
|
|
|
12
12
|
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
13
13
|
|
|
14
14
|
group = 'expo.modules.ui'
|
|
15
|
-
version = '58.0.
|
|
15
|
+
version = '58.0.13'
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace "expo.modules.ui"
|
|
19
19
|
defaultConfig {
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName "58.0.
|
|
21
|
+
versionName "58.0.13"
|
|
22
22
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
23
23
|
}
|
|
24
24
|
buildFeatures {
|
|
@@ -451,6 +451,7 @@ fun ExpoTimePickerDialogContent(props: TimePickerDialogProps, onDateSelected: (D
|
|
|
451
451
|
Text(props.dismissButtonLabel ?: stringResource(android.R.string.cancel))
|
|
452
452
|
}
|
|
453
453
|
},
|
|
454
|
+
containerColor = timePickerColors.containerColor,
|
|
454
455
|
text = {
|
|
455
456
|
TimePicker(
|
|
456
457
|
state = state,
|
package/build/State/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './index.fx';
|
|
2
2
|
export { useNativeState, type ObservableState } from './useNativeState';
|
|
3
3
|
export { useWorkletProp } from './useWorkletProp';
|
|
4
|
+
export { useWorkletCallback, type WorkletCallback } from './useWorkletCallback';
|
|
4
5
|
export { worklets } from './optionalWorklets';
|
|
5
6
|
export { getStateId } from './utils';
|
package/build/State/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import './index.fx';
|
|
6
6
|
export { useNativeState } from './useNativeState';
|
|
7
7
|
export { useWorkletProp } from './useWorkletProp';
|
|
8
|
+
export { useWorkletCallback } from './useWorkletCallback';
|
|
8
9
|
export { worklets } from './optionalWorklets';
|
|
9
10
|
export { getStateId } from './utils';
|
|
10
11
|
|
package/build/State/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["State/index.ts"],"sourcesContent":[null],"names":["useNativeState","useWorkletProp","worklets","getStateId"],"mappings":"AAAA,oEAAoE;AACpE,oEAAoE;AACpE,oEAAoE;AACpE,mDAAmD;AACnD,OAAO,aAAa;AAEpB,SAASA,cAAc,QAA8B,mBAAmB;AACxE,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,UAAU,QAAQ,UAAU"}
|
|
1
|
+
{"version":3,"sources":["State/index.ts"],"sourcesContent":[null],"names":["useNativeState","useWorkletProp","useWorkletCallback","worklets","getStateId"],"mappings":"AAAA,oEAAoE;AACpE,oEAAoE;AACpE,oEAAoE;AACpE,mDAAmD;AACnD,OAAO,aAAa;AAEpB,SAASA,cAAc,QAA8B,mBAAmB;AACxE,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,kBAAkB,QAA8B,uBAAuB;AAChF,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,UAAU,QAAQ,UAAU"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SharedObject } from 'expo';
|
|
2
|
+
/**
|
|
3
|
+
* A worklet function wrapped for native code, returned by [`useWorkletCallback`](#useworkletcallback).
|
|
4
|
+
* Pass it to a modifier or prop that accepts worklet callbacks, which then runs it synchronously on
|
|
5
|
+
* the UI thread.
|
|
6
|
+
*/
|
|
7
|
+
export type WorkletCallback<T extends (...args: never[]) => void> = SharedObject & {
|
|
8
|
+
/** @hidden */
|
|
9
|
+
readonly __workletCallbackType?: T;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a worklet function so native code can run it synchronously on the UI thread, with no
|
|
13
|
+
* JS-thread round trip. Pass the result to a modifier that accepts worklet callbacks, such as
|
|
14
|
+
* `onHingeChange`. The callback must start with the `'worklet'` directive, and
|
|
15
|
+
* [`react-native-worklets`](https://docs.swmansion.com/react-native-worklets/) must be installed.
|
|
16
|
+
*
|
|
17
|
+
* The native callback is updated when `callback` changes and released when the component unmounts,
|
|
18
|
+
* so call it at the top of your component like any hook.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const angle = useNativeState(180);
|
|
23
|
+
* const onHinge = useWorkletCallback((_, newContext) => {
|
|
24
|
+
* 'worklet';
|
|
25
|
+
* angle.value = newContext.hinge?.angle ?? 180;
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* <VStack modifiers={[onHingeChange(onHinge)]} />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useWorkletCallback<T extends (...args: never[]) => void>(callback: T): WorkletCallback<T>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { worklets } from './optionalWorklets';
|
|
2
|
+
import { useWorkletProp } from './useWorkletProp';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a worklet function so native code can run it synchronously on the UI thread, with no
|
|
5
|
+
* JS-thread round trip. Pass the result to a modifier that accepts worklet callbacks, such as
|
|
6
|
+
* `onHingeChange`. The callback must start with the `'worklet'` directive, and
|
|
7
|
+
* [`react-native-worklets`](https://docs.swmansion.com/react-native-worklets/) must be installed.
|
|
8
|
+
*
|
|
9
|
+
* The native callback is updated when `callback` changes and released when the component unmounts,
|
|
10
|
+
* so call it at the top of your component like any hook.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const angle = useNativeState(180);
|
|
15
|
+
* const onHinge = useWorkletCallback((_, newContext) => {
|
|
16
|
+
* 'worklet';
|
|
17
|
+
* angle.value = newContext.hinge?.angle ?? 180;
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* <VStack modifiers={[onHingeChange(onHinge)]} />
|
|
21
|
+
* ```
|
|
22
|
+
*/ export function useWorkletCallback(callback) {
|
|
23
|
+
const workletCallback = useWorkletProp(callback);
|
|
24
|
+
if (!worklets || !workletCallback) {
|
|
25
|
+
throw new Error("useWorkletCallback needs the 'react-native-worklets' package, which couldn't be loaded. " + 'Install react-native-worklets and rebuild the native app, or pass a plain function ' + 'where the API accepts one.');
|
|
26
|
+
}
|
|
27
|
+
return workletCallback;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=useWorkletCallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["State/useWorkletCallback.ts"],"sourcesContent":[null],"names":["worklets","useWorkletProp","useWorkletCallback","callback","workletCallback","Error"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,cAAc,QAAQ,mBAAmB;AAYlD;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,SAASC,mBACdC,QAAW;IAEX,MAAMC,kBAAkBH,eAAeE;IACvC,IAAI,CAACH,YAAY,CAACI,iBAAiB;QACjC,MAAM,IAAIC,MACR,6FACE,wFACA;IAEN;IACA,OAAOD;AACT"}
|
|
@@ -49,6 +49,6 @@ export * from './Box';
|
|
|
49
49
|
export * from './Row';
|
|
50
50
|
export * from './Column';
|
|
51
51
|
export * from './FlowRow';
|
|
52
|
-
export { useNativeState } from '../State';
|
|
52
|
+
export { useNativeState, useWorkletCallback, type WorkletCallback } from '../State';
|
|
53
53
|
export type { ViewEvent } from '../types';
|
|
54
54
|
export type { PrimitiveBaseProps } from './layout-types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jetpack-compose/index.ts"],"sourcesContent":[null],"names":["BasicAlertDialog","TextField","OutlinedTextField","BasicTextField","HorizontalPager","Text","useNativeState"],"mappings":"AAAA,OAAO,wCAAwC;AAE/C,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,gBAAgB,QAAoC,qBAAqB;AAClF,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,2BAA2B;AACzC,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,oBAAoB;AAClC,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,SACEC,SAAS,EACTC,iBAAiB,EACjBC,cAAc,QAcT,cAAc;AACrB,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B,SACEC,eAAe,QAGV,oBAAoB;AAC3B,cAAc,cAAc;AAC5B,cAAc,aAAa;AAC3B,cAAc,oBAAoB;AAClC,cAAc,8BAA8B;AAC5C,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,SAAyBC,IAAI,QAAQ,SAAS;AAC9C,cAAc,YAAY;AAC1B,cAAc,qBAAqB;AAEnC,cAAc,uBAAuB;AACrC,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,SAASC,cAAc,
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/index.ts"],"sourcesContent":[null],"names":["BasicAlertDialog","TextField","OutlinedTextField","BasicTextField","HorizontalPager","Text","useNativeState","useWorkletCallback"],"mappings":"AAAA,OAAO,wCAAwC;AAE/C,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,gBAAgB,QAAoC,qBAAqB;AAClF,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,2BAA2B;AACzC,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,oBAAoB;AAClC,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,SACEC,SAAS,EACTC,iBAAiB,EACjBC,cAAc,QAcT,cAAc;AACrB,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B,SACEC,eAAe,QAGV,oBAAoB;AAC3B,cAAc,cAAc;AAC5B,cAAc,aAAa;AAC3B,cAAc,oBAAoB;AAClC,cAAc,8BAA8B;AAC5C,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,SAAyBC,IAAI,QAAQ,SAAS;AAC9C,cAAc,YAAY;AAC1B,cAAc,qBAAqB;AAEnC,cAAc,uBAAuB;AACrC,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,SAASC,cAAc,EAAEC,kBAAkB,QAA8B,WAAW"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type CommonViewModifierProps } from '../types';
|
|
2
|
+
export interface ArrangementViewProps extends CommonViewModifierProps {
|
|
3
|
+
/**
|
|
4
|
+
* The views to arrange. Provide `ArrangementView.Primary` and `ArrangementView.Secondary`.
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The primary view of the arrangement.
|
|
10
|
+
*/
|
|
11
|
+
declare function ArrangementViewPrimary(props: {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* The secondary view of the arrangement.
|
|
16
|
+
*/
|
|
17
|
+
declare function ArrangementViewSecondary(props: {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* ArrangementView uses the native [ArrangementView](https://developer.apple.com/documentation/swiftui/arrangementview) view.
|
|
22
|
+
*
|
|
23
|
+
* A view that arranges primary and secondary content using an adaptive layout that responds to
|
|
24
|
+
* the environment.
|
|
25
|
+
*
|
|
26
|
+
* > **Note:** Below iOS 27.1, the children render without a container.
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <Host style={{ flex: 1 }}>
|
|
30
|
+
* <ArrangementView modifiers={[arrangementViewStyle('split')]}>
|
|
31
|
+
* <ArrangementView.Primary>
|
|
32
|
+
* <NowPlaying />
|
|
33
|
+
* </ArrangementView.Primary>
|
|
34
|
+
* <ArrangementView.Secondary>
|
|
35
|
+
* <Lyrics />
|
|
36
|
+
* </ArrangementView.Secondary>
|
|
37
|
+
* </ArrangementView>
|
|
38
|
+
* </Host>
|
|
39
|
+
* ```
|
|
40
|
+
* @platform ios 27.1+
|
|
41
|
+
* @platform tvos 27.1+
|
|
42
|
+
*/
|
|
43
|
+
export declare function ArrangementView(props: ArrangementViewProps): import("react").JSX.Element;
|
|
44
|
+
export declare namespace ArrangementView {
|
|
45
|
+
var Primary: typeof ArrangementViewPrimary;
|
|
46
|
+
var Secondary: typeof ArrangementViewSecondary;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { requireNativeView } from 'expo';
|
|
3
|
+
import { Slot } from '../SlotView';
|
|
4
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
+
const ArrangementViewNativeView = requireNativeView('ExpoUI', 'ArrangementViewView');
|
|
6
|
+
/**
|
|
7
|
+
* The primary view of the arrangement.
|
|
8
|
+
*/ function ArrangementViewPrimary(props) {
|
|
9
|
+
return /*#__PURE__*/ _jsx(Slot, {
|
|
10
|
+
name: "primary",
|
|
11
|
+
children: props.children
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The secondary view of the arrangement.
|
|
16
|
+
*/ function ArrangementViewSecondary(props) {
|
|
17
|
+
return /*#__PURE__*/ _jsx(Slot, {
|
|
18
|
+
name: "secondary",
|
|
19
|
+
children: props.children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
ArrangementView.Primary = ArrangementViewPrimary;
|
|
23
|
+
ArrangementView.Secondary = ArrangementViewSecondary;
|
|
24
|
+
/**
|
|
25
|
+
* ArrangementView uses the native [ArrangementView](https://developer.apple.com/documentation/swiftui/arrangementview) view.
|
|
26
|
+
*
|
|
27
|
+
* A view that arranges primary and secondary content using an adaptive layout that responds to
|
|
28
|
+
* the environment.
|
|
29
|
+
*
|
|
30
|
+
* > **Note:** Below iOS 27.1, the children render without a container.
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Host style={{ flex: 1 }}>
|
|
34
|
+
* <ArrangementView modifiers={[arrangementViewStyle('split')]}>
|
|
35
|
+
* <ArrangementView.Primary>
|
|
36
|
+
* <NowPlaying />
|
|
37
|
+
* </ArrangementView.Primary>
|
|
38
|
+
* <ArrangementView.Secondary>
|
|
39
|
+
* <Lyrics />
|
|
40
|
+
* </ArrangementView.Secondary>
|
|
41
|
+
* </ArrangementView>
|
|
42
|
+
* </Host>
|
|
43
|
+
* ```
|
|
44
|
+
* @platform ios 27.1+
|
|
45
|
+
* @platform tvos 27.1+
|
|
46
|
+
*/ export function ArrangementView(props) {
|
|
47
|
+
const { modifiers, children, ...restProps } = props;
|
|
48
|
+
return /*#__PURE__*/ _jsx(ArrangementViewNativeView, {
|
|
49
|
+
modifiers: modifiers,
|
|
50
|
+
...modifiers ? createViewModifierEventListener(modifiers) : undefined,
|
|
51
|
+
...restProps,
|
|
52
|
+
children: children
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["swift-ui/ArrangementView/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","Slot","createViewModifierEventListener","ArrangementViewNativeView","ArrangementViewPrimary","props","name","children","ArrangementViewSecondary","ArrangementView","Primary","Secondary","modifiers","restProps","undefined"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAEzC,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,+BAA+B,QAAQ,qBAAqB;AAUrE,MAAMC,4BAAuEH,kBAC3E,UACA;AAGF;;CAEC,GACD,SAASI,uBAAuBC,KAAoC;IAClE,qBAAO,KAACJ;QAAKK,MAAK;kBAAWD,MAAME,QAAQ;;AAC7C;AAEA;;CAEC,GACD,SAASC,yBAAyBH,KAAoC;IACpE,qBAAO,KAACJ;QAAKK,MAAK;kBAAaD,MAAME,QAAQ;;AAC/C;AAEAE,gBAAgBC,OAAO,GAAGN;AAC1BK,gBAAgBE,SAAS,GAAGH;AAE5B;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,SAASC,gBAAgBJ,KAA2B;IACzD,MAAM,EAAEO,SAAS,EAAEL,QAAQ,EAAE,GAAGM,WAAW,GAAGR;IAE9C,qBACE,KAACF;QACCS,WAAWA;QACV,GAAIA,YAAYV,gCAAgCU,aAAaE,SAAS;QACtE,GAAGD,SAAS;kBACZN;;AAGP"}
|
|
@@ -29,6 +29,7 @@ export * from './Menu';
|
|
|
29
29
|
export * from './NavigationDestination';
|
|
30
30
|
export * from './NavigationLink';
|
|
31
31
|
export * from './NavigationSplitView';
|
|
32
|
+
export * from './ArrangementView';
|
|
32
33
|
export * from './NavigationStack';
|
|
33
34
|
export * from './Picker';
|
|
34
35
|
export * from './ProgressView';
|
|
@@ -39,7 +40,7 @@ export * from './Spacer';
|
|
|
39
40
|
export * from './Stepper';
|
|
40
41
|
export * from './SwipeActions';
|
|
41
42
|
export * from './Text';
|
|
42
|
-
export { useNativeState } from '../State';
|
|
43
|
+
export { useNativeState, useWorkletCallback, type WorkletCallback } from '../State';
|
|
43
44
|
export { withAnimation, type WithAnimationCompletionCriteria } from './withAnimation';
|
|
44
45
|
export * from './SyncToggle';
|
|
45
46
|
export * from './TabView';
|
package/build/swift-ui/index.js
CHANGED
|
@@ -28,6 +28,7 @@ export * from './Menu';
|
|
|
28
28
|
export * from './NavigationDestination';
|
|
29
29
|
export * from './NavigationLink';
|
|
30
30
|
export * from './NavigationSplitView';
|
|
31
|
+
export * from './ArrangementView';
|
|
31
32
|
export * from './NavigationStack';
|
|
32
33
|
export * from './Picker';
|
|
33
34
|
export * from './ProgressView';
|
|
@@ -38,7 +39,7 @@ export * from './Spacer';
|
|
|
38
39
|
export * from './Stepper';
|
|
39
40
|
export * from './SwipeActions';
|
|
40
41
|
export * from './Text';
|
|
41
|
-
export { useNativeState } from '../State';
|
|
42
|
+
export { useNativeState, useWorkletCallback } from '../State';
|
|
42
43
|
export { withAnimation } from './withAnimation';
|
|
43
44
|
export * from './SyncToggle';
|
|
44
45
|
export * from './TabView';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["swift-ui/index.tsx"],"sourcesContent":[null],"names":["useNativeState","withAnimation","TextField"],"mappings":"AAAA,cAAc,8BAA8B;AAC5C,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,2BAA2B;AACzC,cAAc,uBAAuB;AACrC,cAAc,iBAAiB;AAC/B,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,oBAAoB;AAClC,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,mBAAmB;AACjC,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,eAAe;AAE7B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,0BAA0B;AACxC,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,cAAc,WAAW;AACzB,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,iBAAiB;AAC/B,cAAc,SAAS;AACvB,SAASA,cAAc,
|
|
1
|
+
{"version":3,"sources":["swift-ui/index.tsx"],"sourcesContent":[null],"names":["useNativeState","useWorkletCallback","withAnimation","TextField"],"mappings":"AAAA,cAAc,8BAA8B;AAC5C,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,2BAA2B;AACzC,cAAc,uBAAuB;AACrC,cAAc,iBAAiB;AAC/B,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,oBAAoB;AAClC,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,mBAAmB;AACjC,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,eAAe;AAE7B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,0BAA0B;AACxC,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,WAAW;AACzB,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,iBAAiB;AAC/B,cAAc,SAAS;AACvB,SAASA,cAAc,EAAEC,kBAAkB,QAA8B,WAAW;AACpF,SAASC,aAAa,QAA8C,kBAAkB;AACtF,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,SACEC,SAAS,QAIJ,cAAc;AACrB,cAAc,gBAAgB;AAC9B,cAAc,cAAc;AAC5B,cAAc,yBAAyB;AACvC,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,SAAS"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { createModifier } from './createModifier';
|
|
2
|
+
/**
|
|
3
|
+
* A style that configures an `ArrangementView` with an arrangement.
|
|
4
|
+
* - `'automatic'`: The default style, which resolves to `'split'`.
|
|
5
|
+
* - `'split'`: An arrangement view style that places the primary and secondary views side by side along one or more axes.
|
|
6
|
+
* - `'overlay'`: An arrangement view style that layers the primary view over the secondary view in z-order.
|
|
7
|
+
*/
|
|
8
|
+
export type ArrangementViewStyle = 'automatic' | 'split' | 'overlay';
|
|
9
|
+
/**
|
|
10
|
+
* Sets the style for arrangement views within this view.
|
|
11
|
+
* @param style - The style to apply.
|
|
12
|
+
* @param options - The `axes` the arrangement supports. With `'split'`, creates a split arrangement
|
|
13
|
+
* that supports the given axes. With `'overlay'`, creates an overlay arrangement that supports
|
|
14
|
+
* laying out its views along the given axes.
|
|
15
|
+
* @platform ios 27.1+
|
|
16
|
+
* @platform tvos 27.1+
|
|
17
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/arrangementviewstyle(_:)).
|
|
18
|
+
*/
|
|
19
|
+
export declare function arrangementViewStyle(style: 'automatic'): ReturnType<typeof createModifier>;
|
|
20
|
+
export declare function arrangementViewStyle(style: 'split' | 'overlay', options?: {
|
|
21
|
+
axes?: 'horizontal' | 'vertical' | 'both';
|
|
22
|
+
}): ReturnType<typeof createModifier>;
|
|
23
|
+
/**
|
|
24
|
+
* The minimum, ideal, and maximum ratios for `splitArrangementLayoutRatio`.
|
|
25
|
+
*/
|
|
26
|
+
export type SplitArrangementLayoutRatioParams = {
|
|
27
|
+
minHorizontal?: number;
|
|
28
|
+
idealHorizontal?: number;
|
|
29
|
+
maxHorizontal?: number;
|
|
30
|
+
minVertical?: number;
|
|
31
|
+
idealVertical?: number;
|
|
32
|
+
maxVertical?: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Sets the preferred size ratio for the content of `ArrangementView.Primary` or
|
|
36
|
+
* `ArrangementView.Secondary` in a split arrangement.
|
|
37
|
+
* @platform ios 27.1+
|
|
38
|
+
* @platform tvos 27.1+
|
|
39
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/splitarrangementlayoutratio(_:)).
|
|
40
|
+
*/
|
|
41
|
+
export declare function splitArrangementLayoutRatio(ratio: number): ReturnType<typeof createModifier>;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the size ratio for the content of `ArrangementView.Primary` or `ArrangementView.Secondary`
|
|
44
|
+
* in a split arrangement.
|
|
45
|
+
* @platform ios 27.1+
|
|
46
|
+
* @platform tvos 27.1+
|
|
47
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/splitarrangementlayoutratio(minhorizontal:idealhorizontal:maxhorizontal:minvertical:idealvertical:maxvertical:)).
|
|
48
|
+
*/
|
|
49
|
+
export declare function splitArrangementLayoutRatio(ratios: SplitArrangementLayoutRatioParams): ReturnType<typeof createModifier>;
|
|
50
|
+
/**
|
|
51
|
+
* The minimum, ideal, and maximum sizes for `splitArrangementLayoutSize`.
|
|
52
|
+
*/
|
|
53
|
+
export type SplitArrangementLayoutSizeParams = {
|
|
54
|
+
minWidth?: number;
|
|
55
|
+
idealWidth?: number;
|
|
56
|
+
maxWidth?: number;
|
|
57
|
+
minHeight?: number;
|
|
58
|
+
idealHeight?: number;
|
|
59
|
+
maxHeight?: number;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Sets the size constraints for the content of `ArrangementView.Primary` or
|
|
63
|
+
* `ArrangementView.Secondary` in a split arrangement.
|
|
64
|
+
* @platform ios 27.1+
|
|
65
|
+
* @platform tvos 27.1+
|
|
66
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/splitarrangementlayoutsize(minwidth:idealwidth:maxwidth:minheight:idealheight:maxheight:)).
|
|
67
|
+
*/
|
|
68
|
+
export declare const splitArrangementLayoutSize: (constraints: SplitArrangementLayoutSizeParams) => import("./createModifier").ModifierConfig;
|
|
69
|
+
/**
|
|
70
|
+
* The split axes on which `splitArrangementFixedLayoutSize` prefers the ideal size of the view.
|
|
71
|
+
*/
|
|
72
|
+
export type SplitArrangementFixedLayoutSizeParams = {
|
|
73
|
+
/**
|
|
74
|
+
* Whether to prefer a fixed width for the view in a horizontal split.
|
|
75
|
+
* @default true
|
|
76
|
+
*/
|
|
77
|
+
horizontal?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to prefer a fixed height for the view in a vertical split.
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
vertical?: boolean;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Sets the preferred size constraint for the content of `ArrangementView.Primary` or
|
|
86
|
+
* `ArrangementView.Secondary` in a split arrangement to the ideal size of the view within its
|
|
87
|
+
* container. The arrangement view prefers this size, but may resize to a smaller size depending on
|
|
88
|
+
* the priority of the view.
|
|
89
|
+
* @platform ios 27.1+
|
|
90
|
+
* @platform tvos 27.1+
|
|
91
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/splitarrangementfixedlayoutsize(horizontal:vertical:)).
|
|
92
|
+
*/
|
|
93
|
+
export declare const splitArrangementFixedLayoutSize: (options?: SplitArrangementFixedLayoutSizeParams) => import("./createModifier").ModifierConfig;
|
|
94
|
+
/**
|
|
95
|
+
* Sets the horizontal edge that a view in an overlay arrangement occupies when the arrangement
|
|
96
|
+
* transitions to a horizontal layout.
|
|
97
|
+
* @platform ios 27.1+
|
|
98
|
+
* @platform tvos 27.1+
|
|
99
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/overlayarrangementedge(_:)).
|
|
100
|
+
*/
|
|
101
|
+
export declare function overlayArrangementEdge(edge: 'leading' | 'trailing'): ReturnType<typeof createModifier>;
|
|
102
|
+
/**
|
|
103
|
+
* Sets the vertical edge that a view in an overlay arrangement occupies when the arrangement
|
|
104
|
+
* transitions to a vertical layout.
|
|
105
|
+
* @platform ios 27.1+
|
|
106
|
+
* @platform tvos 27.1+
|
|
107
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/overlayarrangementedge(_:)-4tjwn).
|
|
108
|
+
*/
|
|
109
|
+
export declare function overlayArrangementEdge(edge: 'top' | 'bottom'): ReturnType<typeof createModifier>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createModifier } from './createModifier';
|
|
2
|
+
export function arrangementViewStyle(style, options) {
|
|
3
|
+
return createModifier('arrangementViewStyle', {
|
|
4
|
+
style,
|
|
5
|
+
axes: options?.axes
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export function splitArrangementLayoutRatio(ratioOrParams) {
|
|
9
|
+
return createModifier('splitArrangementLayoutRatio', typeof ratioOrParams === 'number' ? {
|
|
10
|
+
ratio: ratioOrParams
|
|
11
|
+
} : ratioOrParams);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Sets the size constraints for the content of `ArrangementView.Primary` or
|
|
15
|
+
* `ArrangementView.Secondary` in a split arrangement.
|
|
16
|
+
* @platform ios 27.1+
|
|
17
|
+
* @platform tvos 27.1+
|
|
18
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/splitarrangementlayoutsize(minwidth:idealwidth:maxwidth:minheight:idealheight:maxheight:)).
|
|
19
|
+
*/ export const splitArrangementLayoutSize = (constraints)=>createModifier('splitArrangementLayoutSize', constraints);
|
|
20
|
+
/**
|
|
21
|
+
* Sets the preferred size constraint for the content of `ArrangementView.Primary` or
|
|
22
|
+
* `ArrangementView.Secondary` in a split arrangement to the ideal size of the view within its
|
|
23
|
+
* container. The arrangement view prefers this size, but may resize to a smaller size depending on
|
|
24
|
+
* the priority of the view.
|
|
25
|
+
* @platform ios 27.1+
|
|
26
|
+
* @platform tvos 27.1+
|
|
27
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/splitarrangementfixedlayoutsize(horizontal:vertical:)).
|
|
28
|
+
*/ export const splitArrangementFixedLayoutSize = (options)=>createModifier('splitArrangementFixedLayoutSize', options);
|
|
29
|
+
export function overlayArrangementEdge(edge) {
|
|
30
|
+
return createModifier('overlayArrangementEdge', {
|
|
31
|
+
edge
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=arrangementModifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["swift-ui/modifiers/arrangementModifiers.ts"],"sourcesContent":[null],"names":["createModifier","arrangementViewStyle","style","options","axes","splitArrangementLayoutRatio","ratioOrParams","ratio","splitArrangementLayoutSize","constraints","splitArrangementFixedLayoutSize","overlayArrangementEdge","edge"],"mappings":"AAAA,SAASA,cAAc,QAAQ,mBAAmB;AAyBlD,OAAO,SAASC,qBACdC,KAA2B,EAC3BC,OAAuD;IAEvD,OAAOH,eAAe,wBAAwB;QAAEE;QAAOE,MAAMD,SAASC;IAAK;AAC7E;AAgCA,OAAO,SAASC,4BACdC,aAAyD;IAEzD,OAAON,eACL,+BACA,OAAOM,kBAAkB,WAAW;QAAEC,OAAOD;IAAc,IAAIA;AAEnE;AAcA;;;;;;CAMC,GACD,OAAO,MAAME,6BAA6B,CAACC,cACzCT,eAAe,8BAA8BS,aAAa;AAkB5D;;;;;;;;CAQC,GACD,OAAO,MAAMC,kCAAkC,CAACP,UAC9CH,eAAe,mCAAmCG,SAAS;AAoB7D,OAAO,SAASQ,uBAAuBC,IAA+C;IACpF,OAAOZ,eAAe,0BAA0B;QAAEY;IAAK;AACzD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type WorkletCallback } from '../../State';
|
|
2
|
+
/**
|
|
3
|
+
* Status of the device hinge, as reported by SwiftUI's `DeviceHinge.Status`.
|
|
4
|
+
* `'unknown'` is reserved for a status this version of Expo UI does not recognize.
|
|
5
|
+
* @platform ios 27.1+
|
|
6
|
+
*/
|
|
7
|
+
export type HingeStatus = 'closed' | 'partiallyOpen' | 'fullyOpen' | 'unknown';
|
|
8
|
+
/**
|
|
9
|
+
* State of the device hinge. Mirrors SwiftUI's `DeviceHinge`.
|
|
10
|
+
* @platform ios 27.1+
|
|
11
|
+
*/
|
|
12
|
+
export type Hinge = {
|
|
13
|
+
/**
|
|
14
|
+
* The current angle of the hinge in degrees, where `0` is closed and `180` is flat. The rate and
|
|
15
|
+
* granularity of angle updates are system policy, so do not depend on a particular update
|
|
16
|
+
* frequency or precision. Prefer `status` when you only need to know whether the hinge is closed,
|
|
17
|
+
* partially open, or fully open.
|
|
18
|
+
*/
|
|
19
|
+
angle: number;
|
|
20
|
+
/**
|
|
21
|
+
* The current status of the hinge, determined by the system from the angle and device orientation.
|
|
22
|
+
*/
|
|
23
|
+
status: HingeStatus;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The hinge context of the view hierarchy. Mirrors SwiftUI's `DeviceHingeContext`.
|
|
27
|
+
* @platform ios 27.1+
|
|
28
|
+
*/
|
|
29
|
+
export type HingeContext = {
|
|
30
|
+
/**
|
|
31
|
+
* The current hinge, or `null` when the device has no hinge or the view's hierarchy provides no
|
|
32
|
+
* hinge updates.
|
|
33
|
+
*/
|
|
34
|
+
hinge: Hinge | null;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A function called with the old and the new hinge context when the hinge context changes.
|
|
38
|
+
*/
|
|
39
|
+
export type HingeChangeHandler = (oldContext: HingeContext, newContext: HingeContext) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Calls the handler when the hinge context of the view hierarchy changes, such as when the user
|
|
42
|
+
* folds or unfolds the device. The handler receives the old and the new context. Use hinge
|
|
43
|
+
* state for interactions and effects, not for layout.
|
|
44
|
+
*
|
|
45
|
+
* Pass a plain function to run it on the JS thread, or a callback from
|
|
46
|
+
* [`useWorkletCallback`](../usenativestate/#useworkletcallback) to run it synchronously on the UI
|
|
47
|
+
* thread, which suits driving a native state value from the continuous `angle`.
|
|
48
|
+
*
|
|
49
|
+
* The first call happens when the view appears, and its old context has a `null` hinge. On devices
|
|
50
|
+
* without a hinge, both contexts have a `null` hinge. The modifier is a no-op on iOS versions earlier
|
|
51
|
+
* than 27.1 and in builds made with Xcode earlier than 27.1.
|
|
52
|
+
*
|
|
53
|
+
* @param handler - Function or worklet callback called with the old and the new hinge context.
|
|
54
|
+
* @platform ios 27.1+
|
|
55
|
+
*
|
|
56
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/onhingechange(isenabled:_:)).
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* // JS thread
|
|
61
|
+
* const [hinge, setHinge] = useState<Hinge | null>(null);
|
|
62
|
+
* <VStack modifiers={[onHingeChange((_, newContext) => setHinge(newContext.hinge))]} />
|
|
63
|
+
*
|
|
64
|
+
* // UI thread
|
|
65
|
+
* const angle = useNativeState(180);
|
|
66
|
+
* const onHinge = useWorkletCallback((_, newContext) => {
|
|
67
|
+
* 'worklet';
|
|
68
|
+
* angle.value = newContext.hinge?.angle ?? 180;
|
|
69
|
+
* });
|
|
70
|
+
* <VStack modifiers={[onHingeChange(onHinge)]} />
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare const onHingeChange: (handler: HingeChangeHandler | WorkletCallback<HingeChangeHandler>) => import("./createModifier").ModifierConfig;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getStateId } from '../../State';
|
|
2
|
+
import { createModifier, createModifierWithEventListener } from './createModifier';
|
|
3
|
+
/**
|
|
4
|
+
* Calls the handler when the hinge context of the view hierarchy changes, such as when the user
|
|
5
|
+
* folds or unfolds the device. The handler receives the old and the new context. Use hinge
|
|
6
|
+
* state for interactions and effects, not for layout.
|
|
7
|
+
*
|
|
8
|
+
* Pass a plain function to run it on the JS thread, or a callback from
|
|
9
|
+
* [`useWorkletCallback`](../usenativestate/#useworkletcallback) to run it synchronously on the UI
|
|
10
|
+
* thread, which suits driving a native state value from the continuous `angle`.
|
|
11
|
+
*
|
|
12
|
+
* The first call happens when the view appears, and its old context has a `null` hinge. On devices
|
|
13
|
+
* without a hinge, both contexts have a `null` hinge. The modifier is a no-op on iOS versions earlier
|
|
14
|
+
* than 27.1 and in builds made with Xcode earlier than 27.1.
|
|
15
|
+
*
|
|
16
|
+
* @param handler - Function or worklet callback called with the old and the new hinge context.
|
|
17
|
+
* @platform ios 27.1+
|
|
18
|
+
*
|
|
19
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/onhingechange(isenabled:_:)).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // JS thread
|
|
24
|
+
* const [hinge, setHinge] = useState<Hinge | null>(null);
|
|
25
|
+
* <VStack modifiers={[onHingeChange((_, newContext) => setHinge(newContext.hinge))]} />
|
|
26
|
+
*
|
|
27
|
+
* // UI thread
|
|
28
|
+
* const angle = useNativeState(180);
|
|
29
|
+
* const onHinge = useWorkletCallback((_, newContext) => {
|
|
30
|
+
* 'worklet';
|
|
31
|
+
* angle.value = newContext.hinge?.angle ?? 180;
|
|
32
|
+
* });
|
|
33
|
+
* <VStack modifiers={[onHingeChange(onHinge)]} />
|
|
34
|
+
* ```
|
|
35
|
+
*/ export const onHingeChange = (handler)=>{
|
|
36
|
+
if (typeof handler !== 'function') {
|
|
37
|
+
return createModifier('onHingeChange', {
|
|
38
|
+
workletCallback: getStateId(handler)
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const callback = handler;
|
|
42
|
+
return createModifierWithEventListener('onHingeChange', (event)=>callback(event.oldContext, event.newContext));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=hingeObservation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["swift-ui/modifiers/hingeObservation.ts"],"sourcesContent":[null],"names":["getStateId","createModifier","createModifierWithEventListener","onHingeChange","handler","workletCallback","callback","event","oldContext","newContext"],"mappings":"AAAA,SAASA,UAAU,QAA8B,cAAc;AAC/D,SAASC,cAAc,EAAEC,+BAA+B,QAAQ,mBAAmB;AA4CnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCC,GACD,OAAO,MAAMC,gBAAgB,CAC3BC;IAEA,IAAI,OAAOA,YAAY,YAAY;QACjC,OAAOH,eAAe,iBAAiB;YAAEI,iBAAiBL,WAAWI;QAAS;IAChF;IACA,MAAME,WAAWF;IACjB,OAAOF,gCACL,iBACA,CAACK,QACCD,SAASC,MAAMC,UAAU,EAAED,MAAME,UAAU;AAEjD,EAAE"}
|