@expo/ui 58.0.21 → 58.0.22
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 +22 -0
- package/README.md +86 -2
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/CompositionLocalProviderView.kt +26 -0
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +12 -0
- package/android/src/main/java/expo/modules/ui/HostView.kt +4 -1
- package/android/src/main/java/expo/modules/ui/MaskView.kt +3 -2
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +3 -1
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +11 -7
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +6 -1
- package/android/src/main/java/expo/modules/ui/TopAppBarView.kt +62 -0
- package/android/src/main/java/expo/modules/ui/colors/MaterialColors.kt +61 -0
- package/build/community/bottom-sheet/BottomSheet.ios.js +8 -3
- package/build/community/bottom-sheet/BottomSheet.ios.js.map +1 -1
- package/build/community/pager-view/PagerView.ios.js +25 -8
- package/build/community/pager-view/PagerView.ios.js.map +1 -1
- package/build/community/segmented-control/SegmentedControl.ios.js +11 -2
- package/build/community/segmented-control/SegmentedControl.ios.js.map +1 -1
- package/build/community/segmented-control/types.d.ts +5 -1
- package/build/community/segmented-control/types.js.map +1 -1
- package/build/jetpack-compose/CompositionLocalProvider/index.d.ts +28 -0
- package/build/jetpack-compose/CompositionLocalProvider/index.js +15 -0
- package/build/jetpack-compose/CompositionLocalProvider/index.js.map +1 -0
- package/build/jetpack-compose/Host/index.d.ts +8 -0
- package/build/jetpack-compose/Host/index.js +38 -5
- package/build/jetpack-compose/Host/index.js.map +1 -1
- package/build/jetpack-compose/Switch/index.d.ts +2 -0
- package/build/jetpack-compose/Switch/index.js +1 -0
- package/build/jetpack-compose/Switch/index.js.map +1 -1
- package/build/jetpack-compose/TopAppBar/index.d.ts +72 -0
- package/build/jetpack-compose/TopAppBar/index.js +45 -0
- package/build/jetpack-compose/TopAppBar/index.js.map +1 -0
- package/build/jetpack-compose/index.d.ts +2 -0
- package/build/jetpack-compose/index.js +2 -0
- package/build/jetpack-compose/index.js.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +5 -1
- package/build/jetpack-compose/modifiers/index.js +6 -2
- package/build/jetpack-compose/modifiers/index.js.map +1 -1
- package/build/swift-ui/BottomSheet/index.d.ts +6 -0
- package/build/swift-ui/BottomSheet/index.js +9 -3
- package/build/swift-ui/BottomSheet/index.js.map +1 -1
- package/build/universal/Checkbox/index.android.js +16 -4
- package/build/universal/Checkbox/index.android.js.map +1 -1
- package/build/universal/ScrollView/index.ios.js +12 -6
- package/build/universal/ScrollView/index.ios.js.map +1 -1
- package/build/universal/Switch/index.android.js +17 -4
- package/build/universal/Switch/index.android.js.map +1 -1
- package/build/universal/Switch/index.js +1 -0
- package/build/universal/Switch/index.js.map +1 -1
- package/build/universal/Text/index.js +2 -2
- package/build/universal/Text/index.js.map +1 -1
- package/build/universal/webUtils.js +4 -0
- package/build/universal/webUtils.js.map +1 -1
- package/ios/BottomSheetView.swift +11 -2
- package/ios/DatePickerView.swift +134 -9
- package/ios/Modifiers/SelectedSegmentTintColorModifier.swift +86 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +4 -0
- package/ios/RNHostView.swift +34 -16
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.21/expo.modules.ui-58.0.21-sources.jar → 58.0.22/expo.modules.ui-58.0.22-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.21/expo.modules.ui-58.0.21.module → 58.0.22/expo.modules.ui-58.0.22.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.21/expo.modules.ui-58.0.21.pom → 58.0.22/expo.modules.ui-58.0.22.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.sha512 +1 -0
- package/package.json +2 -2
- package/src/community/bottom-sheet/BottomSheet.ios.tsx +7 -3
- package/src/community/pager-view/PagerView.ios.tsx +25 -8
- package/src/community/segmented-control/SegmentedControl.ios.tsx +13 -1
- package/src/community/segmented-control/types.tsx +5 -1
- package/src/jetpack-compose/CompositionLocalProvider/index.tsx +43 -0
- package/src/jetpack-compose/Host/index.tsx +50 -4
- package/src/jetpack-compose/Switch/index.tsx +4 -0
- package/src/jetpack-compose/TopAppBar/index.tsx +113 -0
- package/src/jetpack-compose/index.ts +2 -0
- package/src/jetpack-compose/modifiers/index.ts +11 -3
- package/src/swift-ui/BottomSheet/index.tsx +24 -3
- package/src/universal/Checkbox/index.android.tsx +24 -5
- package/src/universal/ScrollView/index.ios.tsx +14 -3
- package/src/universal/Switch/index.android.tsx +23 -4
- package/src/universal/Switch/index.tsx +1 -0
- package/src/universal/Text/index.tsx +2 -2
- package/src/universal/webUtils.ts +4 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.sha512 +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { HStack, ScrollView as SwiftUIScrollView, VStack } from '@expo/ui/swift-ui';
|
|
3
3
|
import { frame, padding } from '@expo/ui/swift-ui/modifiers';
|
|
4
4
|
import { transformToModifiers } from '../transformStyle';
|
|
5
5
|
export function ScrollView({ children, direction = 'vertical', showsIndicators = true, style, onPress, onAppear, onDisappear, disabled, hidden, testID, modifiers: extraModifiers }) {
|
|
6
|
-
// Extract padding from style — it goes on the inner
|
|
6
|
+
// Extract padding from style — it goes on the inner stack so content is
|
|
7
7
|
// inset after stretching to full width.
|
|
8
8
|
const { padding: paddingAll, paddingHorizontal, paddingVertical, paddingTop, paddingBottom, paddingLeft, paddingRight, ...styleWithoutPadding } = style ?? {};
|
|
9
9
|
const scrollModifiers = transformToModifiers(Object.keys(styleWithoutPadding).length > 0 ? styleWithoutPadding : undefined, {
|
|
@@ -34,15 +34,21 @@ export function ScrollView({ children, direction = 'vertical', showsIndicators =
|
|
|
34
34
|
trailing: paddingRight
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
37
|
+
const stack = direction === 'horizontal' ? /*#__PURE__*/ _jsx(HStack, {
|
|
38
|
+
alignment: "top",
|
|
39
|
+
modifiers: innerModifiers,
|
|
40
|
+
children: children
|
|
41
|
+
}) : /*#__PURE__*/ _jsx(VStack, {
|
|
42
|
+
alignment: "leading",
|
|
43
|
+
modifiers: innerModifiers,
|
|
44
|
+
children: children
|
|
45
|
+
});
|
|
37
46
|
return /*#__PURE__*/ _jsx(SwiftUIScrollView, {
|
|
38
47
|
axes: direction,
|
|
39
48
|
showsIndicators: showsIndicators,
|
|
40
49
|
modifiers: scrollModifiers,
|
|
41
50
|
testID: testID,
|
|
42
|
-
children:
|
|
43
|
-
modifiers: innerModifiers,
|
|
44
|
-
children: children
|
|
45
|
-
})
|
|
51
|
+
children: stack
|
|
46
52
|
});
|
|
47
53
|
}
|
|
48
54
|
export * from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/ScrollView/index.ios.tsx"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"sources":["universal/ScrollView/index.ios.tsx"],"sourcesContent":[null],"names":["HStack","ScrollView","SwiftUIScrollView","VStack","frame","padding","transformToModifiers","children","direction","showsIndicators","style","onPress","onAppear","onDisappear","disabled","hidden","testID","modifiers","extraModifiers","paddingAll","paddingHorizontal","paddingVertical","paddingTop","paddingBottom","paddingLeft","paddingRight","styleWithoutPadding","scrollModifiers","Object","keys","length","undefined","innerModifiers","maxWidth","Infinity","alignment","hasPadding","push","all","horizontal","vertical","top","bottom","leading","trailing","stack","axes"],"mappings":";AAAA,SAASA,MAAM,EAAEC,cAAcC,iBAAiB,EAAEC,MAAM,QAAQ,oBAAoB;AACpF,SAASC,KAAK,EAAEC,OAAO,QAAQ,8BAA8B;AAG7D,SAASC,oBAAoB,QAAQ,oBAAoB;AAGzD,OAAO,SAASL,WAAW,EACz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|
import { Row, Switch as ComposeSwitch, Text } from '@expo/ui/jetpack-compose';
|
|
3
|
-
import { fillMaxWidth, IntrinsicSize, testID as testIDModifier, weight, width } from '@expo/ui/jetpack-compose/modifiers';
|
|
3
|
+
import { defaultMinSize, fillMaxWidth, IntrinsicSize, testID as testIDModifier, toggleable, weight, width } from '@expo/ui/jetpack-compose/modifiers';
|
|
4
|
+
// Material's minimum touch target.
|
|
5
|
+
const MIN_INTERACTIVE_SIZE = 48;
|
|
4
6
|
export function Switch({ value, onValueChange, label, disabled, testID, modifiers }) {
|
|
7
|
+
const isLabeled = label != null;
|
|
5
8
|
const toggle = /*#__PURE__*/ _jsx(ComposeSwitch, {
|
|
6
9
|
value: value,
|
|
7
|
-
onCheckedChange:
|
|
10
|
+
onCheckedChange: isLabeled ? undefined : onValueChange,
|
|
8
11
|
enabled: !disabled,
|
|
9
12
|
modifiers: [
|
|
10
13
|
...modifiers ?? [],
|
|
14
|
+
...isLabeled ? [
|
|
15
|
+
defaultMinSize({
|
|
16
|
+
minWidth: MIN_INTERACTIVE_SIZE,
|
|
17
|
+
minHeight: MIN_INTERACTIVE_SIZE
|
|
18
|
+
})
|
|
19
|
+
] : [],
|
|
11
20
|
...testID ? [
|
|
12
21
|
testIDModifier(testID)
|
|
13
22
|
] : []
|
|
14
23
|
]
|
|
15
24
|
});
|
|
16
|
-
if (
|
|
25
|
+
if (!isLabeled) return toggle;
|
|
17
26
|
return /*#__PURE__*/ _jsxs(Row, {
|
|
18
27
|
verticalAlignment: "center",
|
|
19
28
|
horizontalArrangement: {
|
|
@@ -21,7 +30,11 @@ export function Switch({ value, onValueChange, label, disabled, testID, modifier
|
|
|
21
30
|
},
|
|
22
31
|
modifiers: [
|
|
23
32
|
fillMaxWidth(),
|
|
24
|
-
width(IntrinsicSize.Max)
|
|
33
|
+
width(IntrinsicSize.Max),
|
|
34
|
+
toggleable(value, ()=>!disabled && onValueChange(!value), {
|
|
35
|
+
role: 'switch',
|
|
36
|
+
enabled: !disabled
|
|
37
|
+
})
|
|
25
38
|
],
|
|
26
39
|
children: [
|
|
27
40
|
/*#__PURE__*/ _jsx(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/Switch/index.android.tsx"],"sourcesContent":[null],"names":["Row","Switch","ComposeSwitch","Text","fillMaxWidth","IntrinsicSize","testID","testIDModifier","weight","width","value","onValueChange","label","disabled","modifiers","toggle","onCheckedChange","undefined","enabled","verticalAlignment","horizontalArrangement","spacedBy","Max"],"mappings":";AAAA,SAASA,GAAG,EAAEC,UAAUC,aAAa,EAAEC,IAAI,QAAQ,2BAA2B;AAC9E,SACEC,YAAY,EACZC,aAAa,EACbC,UAAUC,cAAc,EACxBC,MAAM,EACNC,KAAK,QACA,qCAAqC;AAI5C,OAAO,
|
|
1
|
+
{"version":3,"sources":["universal/Switch/index.android.tsx"],"sourcesContent":[null],"names":["Row","Switch","ComposeSwitch","Text","defaultMinSize","fillMaxWidth","IntrinsicSize","testID","testIDModifier","toggleable","weight","width","MIN_INTERACTIVE_SIZE","value","onValueChange","label","disabled","modifiers","isLabeled","toggle","onCheckedChange","undefined","enabled","minWidth","minHeight","verticalAlignment","horizontalArrangement","spacedBy","Max","role"],"mappings":";AAAA,SAASA,GAAG,EAAEC,UAAUC,aAAa,EAAEC,IAAI,QAAQ,2BAA2B;AAC9E,SACEC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,UAAUC,cAAc,EACxBC,UAAU,EACVC,MAAM,EACNC,KAAK,QACA,qCAAqC;AAI5C,mCAAmC;AACnC,MAAMC,uBAAuB;AAE7B,OAAO,SAASX,OAAO,EAAEY,KAAK,EAAEC,aAAa,EAAEC,KAAK,EAAEC,QAAQ,EAAET,MAAM,EAAEU,SAAS,EAAe;IAC9F,MAAMC,YAAYH,SAAS;IAC3B,MAAMI,uBACJ,KAACjB;QACCW,OAAOA;QACPO,iBAAiBF,YAAYG,YAAYP;QACzCQ,SAAS,CAACN;QACVC,WAAW;eACLA,aAAa,EAAE;eACfC,YACA;gBAACd,eAAe;oBAAEmB,UAAUX;oBAAsBY,WAAWZ;gBAAqB;aAAG,GACrF,EAAE;eACFL,SAAS;gBAACC,eAAeD;aAAQ,GAAG,EAAE;SAC3C;;IAIL,IAAI,CAACW,WAAW,OAAOC;IAEvB,qBACE,MAACnB;QACCyB,mBAAkB;QAClBC,uBAAuB;YAAEC,UAAU;QAAE;QACrCV,WAAW;YACTZ;YACAM,MAAML,cAAcsB,GAAG;YACvBnB,WAAWI,OAAO,IAAM,CAACG,YAAYF,cAAc,CAACD,QAAQ;gBAC1DgB,MAAM;gBACNP,SAAS,CAACN;YACZ;SACD;;0BACD,KAACb;gBAAKc,WAAW;oBAACP,OAAO;iBAAG;0BAAGK;;YAC9BI;;;AAGP;AAEA,cAAc,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/Switch/index.tsx"],"sourcesContent":[null],"names":["View","Text","StyleSheet","useFocusVisible","colors","createWebComponent","durations","easings","shadows","Input","styles","create","view","alignItems","cursor","display","flexDirection","gap","viewDisabled","opacity","input","position","pointerEvents","margin","width","height","text","color","foreground","userSelect","track","backgroundColor","gray","borderRadius","transitionDuration","base","transitionProperty","transitionTimingFunction","standard","trackChecked","primary","focused","boxShadow","focus","thumb","top","left","thumbChecked","transform","Switch","value","onValueChange","label","disabled","testID","focusVisible","onFocus","onBlur","aria-disabled","role","style","type","checked","onChange","target"],"mappings":";AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,eAAe;AAEtD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,MAAM,EAAEC,kBAAkB,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,QAAQ,cAAc;AAGtF,MAAMC,QAAQJ,mBAAmB;AAEjC,MAAMK,SAASR,WAAWS,MAAM,CAAC;IAC/BC,MAAM;QACJC,YAAY;QACZC,QAAQ;QACRC,SAAS;QACTC,eAAe;QACfC,KAAK;IACP;IACAC,cAAc;QACZJ,QAAQ;QACRK,SAAS;IACX;IACAC,OAAO;QACLC,UAAU;QACVF,SAAS;QACTG,eAAe;QACfC,QAAQ;QACRC,OAAO;QACPC,QAAQ;IACV;IACAC,MAAM;QACJC,OAAOvB,OAAOwB,UAAU;QACxBC,YAAY;IACd;IACAC,OAAO;QACLC,
|
|
1
|
+
{"version":3,"sources":["universal/Switch/index.tsx"],"sourcesContent":[null],"names":["View","Text","StyleSheet","useFocusVisible","colors","createWebComponent","durations","easings","shadows","Input","styles","create","view","alignItems","cursor","display","flexDirection","gap","viewDisabled","opacity","input","position","pointerEvents","margin","width","height","text","color","foreground","flexGrow","userSelect","track","backgroundColor","gray","borderRadius","transitionDuration","base","transitionProperty","transitionTimingFunction","standard","trackChecked","primary","focused","boxShadow","focus","thumb","top","left","thumbChecked","transform","Switch","value","onValueChange","label","disabled","testID","focusVisible","onFocus","onBlur","aria-disabled","role","style","type","checked","onChange","target"],"mappings":";AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,eAAe;AAEtD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,MAAM,EAAEC,kBAAkB,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,QAAQ,cAAc;AAGtF,MAAMC,QAAQJ,mBAAmB;AAEjC,MAAMK,SAASR,WAAWS,MAAM,CAAC;IAC/BC,MAAM;QACJC,YAAY;QACZC,QAAQ;QACRC,SAAS;QACTC,eAAe;QACfC,KAAK;IACP;IACAC,cAAc;QACZJ,QAAQ;QACRK,SAAS;IACX;IACAC,OAAO;QACLC,UAAU;QACVF,SAAS;QACTG,eAAe;QACfC,QAAQ;QACRC,OAAO;QACPC,QAAQ;IACV;IACAC,MAAM;QACJC,OAAOvB,OAAOwB,UAAU;QACxBC,UAAU;QACVC,YAAY;IACd;IACAC,OAAO;QACLC,iBAAiB5B,OAAO6B,IAAI,CAAC,IAAI;QACjCC,cAAc,KAAK;QACnBT,QAAQ;QACRJ,UAAU;Q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K;wBAAEM,SAASzC,OAAOsC,YAAY;qBAAC;;;;;AAIjE;AAEA,cAAc,UAAU"}
|
|
@@ -3,10 +3,10 @@ import { Text as RNText, StyleSheet, useColorScheme } from 'react-native';
|
|
|
3
3
|
import { useUniversalLifecycle } from '../hooks';
|
|
4
4
|
const styles = StyleSheet.create({
|
|
5
5
|
light: {
|
|
6
|
-
color: '#000000'
|
|
6
|
+
color: 'var(--expo-ui-foreground, #000000)'
|
|
7
7
|
},
|
|
8
8
|
dark: {
|
|
9
|
-
color: '#FFFFFF'
|
|
9
|
+
color: 'var(--expo-ui-foreground, #FFFFFF)'
|
|
10
10
|
},
|
|
11
11
|
hidden: {
|
|
12
12
|
display: 'none'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/Text/index.tsx"],"sourcesContent":[null],"names":["Text","RNText","StyleSheet","useColorScheme","useUniversalLifecycle","styles","create","light","color","dark","hidden","display","disabled","opacity","children","textStyle","numberOfLines","style","onPress","onAppear","onDisappear","testID","isDarkScheme"],"mappings":";AAAA,SAASA,QAAQC,MAAM,EAAEC,UAAU,EAAEC,cAAc,QAAQ,eAAe;AAE1E,SAASC,qBAAqB,QAAQ,WAAW;AAGjD,MAAMC,SAASH,WAAWI,MAAM,CAAC;IAC/BC,OAAO;QAAEC,OAAO;
|
|
1
|
+
{"version":3,"sources":["universal/Text/index.tsx"],"sourcesContent":[null],"names":["Text","RNText","StyleSheet","useColorScheme","useUniversalLifecycle","styles","create","light","color","dark","hidden","display","disabled","opacity","children","textStyle","numberOfLines","style","onPress","onAppear","onDisappear","testID","isDarkScheme"],"mappings":";AAAA,SAASA,QAAQC,MAAM,EAAEC,UAAU,EAAEC,cAAc,QAAQ,eAAe;AAE1E,SAASC,qBAAqB,QAAQ,WAAW;AAGjD,MAAMC,SAASH,WAAWI,MAAM,CAAC;IAC/BC,OAAO;QAAEC,OAAO;IAAqC;IACrDC,MAAM;QAAED,OAAO;IAAqC;IACpDE,QAAQ;QAAEC,SAAS;IAAO;IAC1BC,UAAU;QAAEC,SAAS;IAAI;AAC3B;AAEA;;CAEC,GACD,OAAO,SAASb,KAAK,EACnBc,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,WAAW,EACXR,WAAW,KAAK,EAChBF,SAAS,KAAK,EACdW,MAAM,EACI;IACVjB,sBAAsBe,UAAUC;IAEhC,MAAME,eAAenB,qBAAqB;IAE1C,qBACE,KAACF;QACCe,eAAeA;QACfE,SAASA;QACTN,UAAUA;QACVS,QAAQA;QACRJ,OAAO;YACLK,eAAejB,OAAOI,IAAI,GAAGJ,OAAOE,KAAK;YACzCU;YACAF;YACAL,UAAUL,OAAOK,MAAM;YACvBE,YAAYP,OAAOO,QAAQ;SAC5B;kBACAE;;AAGP;AAEA,cAAc,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/webUtils.ts"],"sourcesContent":[null],"names":["processColor","unstable_createElement","createWebComponent","type","props","css","strings","values","reduce","acc","s","i","length","String","replace","trim","lightVariables","darkVariables","colors","background","foreground","red","primary","gray","durations","fast","base","slow","easings","standard","shadows","button","focus","input","globalCss","DEFAULT_PRIMARY_COLOR","srgbToLinear","c","Math","pow","linearToSrgb","hexToLch","hex","raw","body","Array","from","join","r","Number","parseInt","slice","g","b","l","cbrt","m","L","labA","labB","sqrt","atan2","lchToHex","chroma","hue","a","cos","sin","l_","m_","s_","bl","cl","max","min","round","map","x","toString","padStart","PRIMARY_STOPS","step","cMul","colorValueToHex","color","argb","generatePrimaryColorScale","C","H","scale","tgtL","newL","newC"],"mappings":"AACA,SACEA,YAAY,EACZC,sBAAsB,QAMjB,eAAe;AAetB,OAAO,MAAMC,qBACX,CAAwBC,OACxB,CAACC,QACCH,uBAAuBE,MAAMC,OAAO;AAExC,OAAO,MAAMC,MAAM,CAACC,SAA+B,GAAGC,SACpDD,QACGE,MAAM,CAAC,CAACC,KAAKC,GAAGC,IAAMF,MAAMC,IAAKC,CAAAA,IAAIJ,OAAOK,MAAM,GAAGC,OAAON,MAAM,CAACI,EAAE,IAAI,EAAC,GAAI,IAC9EG,OAAO,CAAC,QAAQ,KAChBC,IAAI,GAAG;AAEZ,MAAMC,iBAAiBX,GAAG,CAAC;;;;;;;;;;;;;;;;;AAiB3B,CAAC;AAED,MAAMY,gBAAgBZ,GAAG,CAAC;;;;;;;;;;;;;;;;;AAiB1B,CAAC;AAED,OAAO,MAAMa,SAAS;IACpBC,YAAY;IACZC,YAAY;IAEZC,KAAK;IAELC,SAAS;QACPF,YAAY;QACZ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;IACP;IAEAG,MAAM;QACJ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;IACP;AACF,EAAE;AAEF,OAAO,MAAMC,YAAY;IACvBC,MAAM;IACNC,MAAM;IACNC,MAAM;AACR,EAAE;AAEF,OAAO,MAAMC,UAAU;IACrBC,UAAU;AACZ,EAAE;AAEF,OAAO,MAAMC,UAAU;IACrBC,QAAQ;IACRC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,OAAO,MAAMC,YAAY7B,GAAG,CAAC;;IAEzB,EAAEW,eAAe;;;;;MAKf,EAAEC,cAAc;;;;;IAKlB,
|
|
1
|
+
{"version":3,"sources":["universal/webUtils.ts"],"sourcesContent":[null],"names":["processColor","unstable_createElement","createWebComponent","type","props","css","strings","values","reduce","acc","s","i","length","String","replace","trim","lightVariables","darkVariables","colors","background","foreground","red","primary","gray","durations","fast","base","slow","easings","standard","shadows","button","focus","input","globalCss","DEFAULT_PRIMARY_COLOR","srgbToLinear","c","Math","pow","linearToSrgb","hexToLch","hex","raw","body","Array","from","join","r","Number","parseInt","slice","g","b","l","cbrt","m","L","labA","labB","sqrt","atan2","lchToHex","chroma","hue","a","cos","sin","l_","m_","s_","bl","cl","max","min","round","map","x","toString","padStart","PRIMARY_STOPS","step","cMul","colorValueToHex","color","argb","generatePrimaryColorScale","C","H","scale","tgtL","newL","newC"],"mappings":"AACA,SACEA,YAAY,EACZC,sBAAsB,QAMjB,eAAe;AAetB,OAAO,MAAMC,qBACX,CAAwBC,OACxB,CAACC,QACCH,uBAAuBE,MAAMC,OAAO;AAExC,OAAO,MAAMC,MAAM,CAACC,SAA+B,GAAGC,SACpDD,QACGE,MAAM,CAAC,CAACC,KAAKC,GAAGC,IAAMF,MAAMC,IAAKC,CAAAA,IAAIJ,OAAOK,MAAM,GAAGC,OAAON,MAAM,CAACI,EAAE,IAAI,EAAC,GAAI,IAC9EG,OAAO,CAAC,QAAQ,KAChBC,IAAI,GAAG;AAEZ,MAAMC,iBAAiBX,GAAG,CAAC;;;;;;;;;;;;;;;;;AAiB3B,CAAC;AAED,MAAMY,gBAAgBZ,GAAG,CAAC;;;;;;;;;;;;;;;;;AAiB1B,CAAC;AAED,OAAO,MAAMa,SAAS;IACpBC,YAAY;IACZC,YAAY;IAEZC,KAAK;IAELC,SAAS;QACPF,YAAY;QACZ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;IACP;IAEAG,MAAM;QACJ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;IACP;AACF,EAAE;AAEF,OAAO,MAAMC,YAAY;IACvBC,MAAM;IACNC,MAAM;IACNC,MAAM;AACR,EAAE;AAEF,OAAO,MAAMC,UAAU;IACrBC,UAAU;AACZ,EAAE;AAEF,OAAO,MAAMC,UAAU;IACrBC,QAAQ;IACRC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,OAAO,MAAMC,YAAY7B,GAAG,CAAC;;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AC,CAAC,kBAAkB,EAAER,MAAM,CAAC,GAAGnB,SAAS;YAAC6B;YAAMC;YAAMJ;SAAE;IAC/D;IAEA,OAAOC;AACT,EAAE"}
|
|
@@ -70,7 +70,7 @@ struct BottomSheetView: ExpoSwiftUI.View {
|
|
|
70
70
|
|
|
71
71
|
@ViewBuilder
|
|
72
72
|
private func contentChildren() -> some View {
|
|
73
|
-
ForEach(props.children?.
|
|
73
|
+
ForEach(props.children?.withoutSlots() ?? [], id: \.id) { child in
|
|
74
74
|
let view: any View = child.childView
|
|
75
75
|
AnyView(view)
|
|
76
76
|
}
|
|
@@ -93,6 +93,15 @@ struct BottomSheetView: ExpoSwiftUI.View {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
@ViewBuilder
|
|
97
|
+
private var presentedContent: some View {
|
|
98
|
+
if let background = props.children?.slot("presentationBackground") {
|
|
99
|
+
sheetContent.presentationBackground { background }
|
|
100
|
+
} else {
|
|
101
|
+
sheetContent
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
96
105
|
@ViewBuilder
|
|
97
106
|
private var anchor: some View {
|
|
98
107
|
if let anchorView = props.children?.slot("anchor") {
|
|
@@ -107,7 +116,7 @@ struct BottomSheetView: ExpoSwiftUI.View {
|
|
|
107
116
|
.sheet(isPresented: $isPresented, onDismiss: {
|
|
108
117
|
props.onDismiss()
|
|
109
118
|
}) {
|
|
110
|
-
|
|
119
|
+
presentedContent
|
|
111
120
|
}
|
|
112
121
|
.onChange(of: isPresented, perform: { newIsPresented in
|
|
113
122
|
if props.isPresented == newIsPresented {
|
package/ios/DatePickerView.swift
CHANGED
|
@@ -4,12 +4,7 @@ import SwiftUI
|
|
|
4
4
|
internal struct DatePickerView: ExpoSwiftUI.View {
|
|
5
5
|
@ObservedObject var props: DatePickerProps
|
|
6
6
|
@State private var date = Date()
|
|
7
|
-
|
|
8
|
-
// It shrinks height when user taps a date.
|
|
9
|
-
// https://github.com/expo/expo/issues/47062
|
|
10
|
-
// https://stackoverflow.com/a/74763440/7070640
|
|
11
|
-
// Current fix is to add a fixed min width of 320 when `.graphical` style is used.
|
|
12
|
-
// TODO: Remove if apple fixes the bug in newer versions
|
|
7
|
+
|
|
13
8
|
private var isGraphicalStyle: Bool {
|
|
14
9
|
props.modifiers?.contains {
|
|
15
10
|
$0["$type"] as? String == "datePickerStyle" && $0["style"] as? String == "graphical"
|
|
@@ -20,8 +15,7 @@ internal struct DatePickerView: ExpoSwiftUI.View {
|
|
|
20
15
|
#if os(tvOS)
|
|
21
16
|
Text("DatePicker is not supported on tvOS")
|
|
22
17
|
#else
|
|
23
|
-
|
|
24
|
-
.frame(minWidth: isGraphicalStyle ? 320 : nil)
|
|
18
|
+
datePicker
|
|
25
19
|
.onChange(of: date) { newDate in
|
|
26
20
|
if props.selection == newDate { return }
|
|
27
21
|
props.onDateChange(["date": newDate.timeIntervalSince1970 * 1000])
|
|
@@ -32,10 +26,51 @@ internal struct DatePickerView: ExpoSwiftUI.View {
|
|
|
32
26
|
.onAppear {
|
|
33
27
|
date = props.selection ?? Date()
|
|
34
28
|
}
|
|
35
|
-
.if(props.title == nil && !hasChildren) { $0.labelsHidden() }
|
|
36
29
|
#endif
|
|
37
30
|
}
|
|
38
31
|
|
|
32
|
+
#if !os(tvOS)
|
|
33
|
+
@ViewBuilder
|
|
34
|
+
private var datePicker: some View {
|
|
35
|
+
#if os(iOS)
|
|
36
|
+
if isGraphicalStyle {
|
|
37
|
+
graphicalDatePicker
|
|
38
|
+
} else {
|
|
39
|
+
swiftUIDatePicker
|
|
40
|
+
}
|
|
41
|
+
#else
|
|
42
|
+
swiftUIDatePicker
|
|
43
|
+
#endif
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private var swiftUIDatePicker: some View {
|
|
47
|
+
createDatePicker()
|
|
48
|
+
// Graphical style on macOS: https://github.com/expo/expo/issues/47062
|
|
49
|
+
.frame(minWidth: isGraphicalStyle ? 320 : nil)
|
|
50
|
+
.if(props.title == nil && !hasChildren) { $0.labelsHidden() }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#if os(iOS)
|
|
54
|
+
// SwiftUI's graphical `DatePicker` can keep a wrong height when it appears after launch.
|
|
55
|
+
// https://github.com/expo/expo/issues/47765
|
|
56
|
+
@ViewBuilder
|
|
57
|
+
private var graphicalDatePicker: some View {
|
|
58
|
+
let picker = InlineDatePicker(
|
|
59
|
+
date: $date,
|
|
60
|
+
range: props.range,
|
|
61
|
+
components: props.displayedComponents,
|
|
62
|
+
accessibilityLabel: props.title
|
|
63
|
+
)
|
|
64
|
+
// Like SwiftUI's graphical style, the label is not drawn and is only read by VoiceOver.
|
|
65
|
+
if hasChildren, #available(iOS 18.0, *) {
|
|
66
|
+
picker.accessibilityLabel { _ in Children() }
|
|
67
|
+
} else {
|
|
68
|
+
picker
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
#endif
|
|
72
|
+
#endif
|
|
73
|
+
|
|
39
74
|
private var hasChildren: Bool {
|
|
40
75
|
props.children?.isEmpty == false
|
|
41
76
|
}
|
|
@@ -94,6 +129,96 @@ internal enum DatePickerComponent: String, Enumerable {
|
|
|
94
129
|
case hourAndMinute
|
|
95
130
|
}
|
|
96
131
|
|
|
132
|
+
#if os(iOS)
|
|
133
|
+
private struct InlineDatePicker: UIViewRepresentable {
|
|
134
|
+
@Binding var date: Date
|
|
135
|
+
let range: DateRange?
|
|
136
|
+
let components: [DatePickerComponent]
|
|
137
|
+
let accessibilityLabel: String?
|
|
138
|
+
|
|
139
|
+
func makeCoordinator() -> Coordinator {
|
|
140
|
+
Coordinator(date: $date)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
func makeUIView(context: Context) -> UIDatePicker {
|
|
144
|
+
let picker = UIDatePicker()
|
|
145
|
+
picker.preferredDatePickerStyle = .inline
|
|
146
|
+
picker.addTarget(context.coordinator, action: #selector(Coordinator.valueChanged(_:)), for: .valueChanged)
|
|
147
|
+
return picker
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
func updateUIView(_ picker: UIDatePicker, context: Context) {
|
|
151
|
+
context.coordinator.date = $date
|
|
152
|
+
let environment = context.environment
|
|
153
|
+
let mode = components.toDatePickerMode()
|
|
154
|
+
|
|
155
|
+
// These change the picker's content, so SwiftUI has to measure it again.
|
|
156
|
+
var needsMeasure = false
|
|
157
|
+
if picker.datePickerMode != mode {
|
|
158
|
+
picker.datePickerMode = mode
|
|
159
|
+
needsMeasure = true
|
|
160
|
+
}
|
|
161
|
+
if picker.locale != environment.locale {
|
|
162
|
+
picker.locale = environment.locale
|
|
163
|
+
needsMeasure = true
|
|
164
|
+
}
|
|
165
|
+
if picker.calendar != environment.calendar {
|
|
166
|
+
picker.calendar = environment.calendar
|
|
167
|
+
needsMeasure = true
|
|
168
|
+
}
|
|
169
|
+
if picker.timeZone != environment.timeZone {
|
|
170
|
+
picker.timeZone = environment.timeZone
|
|
171
|
+
}
|
|
172
|
+
picker.minimumDate = range?.start
|
|
173
|
+
picker.maximumDate = range?.end
|
|
174
|
+
if picker.date != date {
|
|
175
|
+
picker.setDate(date, animated: false)
|
|
176
|
+
}
|
|
177
|
+
picker.isEnabled = environment.isEnabled
|
|
178
|
+
picker.accessibilityLabel = accessibilityLabel
|
|
179
|
+
|
|
180
|
+
if needsMeasure {
|
|
181
|
+
picker.invalidateIntrinsicContentSize()
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
func sizeThatFits(_ proposal: ProposedViewSize, uiView: UIDatePicker, context: Context) -> CGSize? {
|
|
186
|
+
let width = proposal.width.flatMap { $0.isFinite ? $0 : nil }
|
|
187
|
+
let size = uiView.systemLayoutSizeFitting(
|
|
188
|
+
CGSize(width: width ?? 0, height: UIView.layoutFittingCompressedSize.height),
|
|
189
|
+
withHorizontalFittingPriority: width == nil ? .fittingSizeLevel : .required,
|
|
190
|
+
verticalFittingPriority: .fittingSizeLevel
|
|
191
|
+
)
|
|
192
|
+
return CGSize(width: width ?? size.width, height: size.height)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
final class Coordinator: NSObject {
|
|
196
|
+
var date: Binding<Date>
|
|
197
|
+
|
|
198
|
+
init(date: Binding<Date>) {
|
|
199
|
+
self.date = date
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@objc func valueChanged(_ picker: UIDatePicker) {
|
|
203
|
+
date.wrappedValue = picker.date
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
private extension [DatePickerComponent] {
|
|
209
|
+
func toDatePickerMode() -> UIDatePicker.Mode {
|
|
210
|
+
switch (contains(.date), contains(.hourAndMinute)) {
|
|
211
|
+
case (true, true):
|
|
212
|
+
return .dateAndTime
|
|
213
|
+
case (false, true):
|
|
214
|
+
return .time
|
|
215
|
+
default:
|
|
216
|
+
return .date
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
#endif
|
|
221
|
+
|
|
97
222
|
#if !os(tvOS)
|
|
98
223
|
internal extension [DatePickerComponent] {
|
|
99
224
|
func toSwiftUIComponents() -> DatePicker.Components {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import ExpoModulesCore
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
// SwiftUI has no API for this, so set it on the `UISegmentedControl` behind the segmented `Picker`.
|
|
7
|
+
internal struct SelectedSegmentTintColorModifier: ViewModifier, Record {
|
|
8
|
+
@Field var color: Color?
|
|
9
|
+
|
|
10
|
+
func body(content: Content) -> some View {
|
|
11
|
+
#if os(iOS)
|
|
12
|
+
content.background(SegmentedControlTintSetter(color: color.map { UIColor($0) }))
|
|
13
|
+
#else
|
|
14
|
+
content
|
|
15
|
+
#endif
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#if os(iOS)
|
|
20
|
+
private struct SegmentedControlTintSetter: UIViewRepresentable {
|
|
21
|
+
let color: UIColor?
|
|
22
|
+
|
|
23
|
+
func makeUIView(context: Context) -> SegmentedControlTintSetterView {
|
|
24
|
+
return SegmentedControlTintSetterView()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
func updateUIView(_ view: SegmentedControlTintSetterView, context: Context) {
|
|
28
|
+
view.color = color
|
|
29
|
+
view.applyColor()
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private final class SegmentedControlTintSetterView: UIView {
|
|
34
|
+
var color: UIColor?
|
|
35
|
+
|
|
36
|
+
override init(frame: CGRect) {
|
|
37
|
+
super.init(frame: frame)
|
|
38
|
+
isUserInteractionEnabled = false
|
|
39
|
+
isAccessibilityElement = false
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
required init?(coder: NSCoder) {
|
|
43
|
+
fatalError("init(coder:) has not been implemented")
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override func didMoveToWindow() {
|
|
47
|
+
super.didMoveToWindow()
|
|
48
|
+
applyColor()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
func applyColor() {
|
|
52
|
+
// The segmented control may not be in the hierarchy until the next layout pass.
|
|
53
|
+
DispatchQueue.main.async { [weak self] in
|
|
54
|
+
guard let self, let segmentedControl = self.findSegmentedControl() else {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
if segmentedControl.selectedSegmentTintColor != self.color {
|
|
58
|
+
segmentedControl.selectedSegmentTintColor = self.color
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private func findSegmentedControl() -> UISegmentedControl? {
|
|
64
|
+
var ancestor = superview
|
|
65
|
+
while let current = ancestor {
|
|
66
|
+
if let match = Self.firstSegmentedControl(in: current) {
|
|
67
|
+
return match
|
|
68
|
+
}
|
|
69
|
+
ancestor = current.superview
|
|
70
|
+
}
|
|
71
|
+
return nil
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private static func firstSegmentedControl(in view: UIView) -> UISegmentedControl? {
|
|
75
|
+
if let segmentedControl = view as? UISegmentedControl {
|
|
76
|
+
return segmentedControl
|
|
77
|
+
}
|
|
78
|
+
for subview in view.subviews {
|
|
79
|
+
if let match = firstSegmentedControl(in: subview) {
|
|
80
|
+
return match
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return nil
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
#endif
|
|
@@ -1973,6 +1973,10 @@ extension ViewModifierRegistry {
|
|
|
1973
1973
|
return try TintModifier(from: params, appContext: appContext)
|
|
1974
1974
|
}
|
|
1975
1975
|
|
|
1976
|
+
register("selectedSegmentTintColor") { params, appContext, _ in
|
|
1977
|
+
return try SelectedSegmentTintColorModifier(from: params, appContext: appContext)
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1976
1980
|
register("hidden") { params, appContext, _ in
|
|
1977
1981
|
return try HiddenModifier(from: params, appContext: appContext)
|
|
1978
1982
|
}
|
package/ios/RNHostView.swift
CHANGED
|
@@ -47,6 +47,24 @@ struct RNHostView: ExpoSwiftUI.View {
|
|
|
47
47
|
isEnabled: !props.layoutRoot
|
|
48
48
|
)
|
|
49
49
|
)
|
|
50
|
+
.onAppear {
|
|
51
|
+
updateTouchHandler()
|
|
52
|
+
}
|
|
53
|
+
.onChange(of: props.children?.first?.childIdentity) { _ in
|
|
54
|
+
updateTouchHandler()
|
|
55
|
+
}
|
|
56
|
+
.onDisappear {
|
|
57
|
+
touchHandler.detach()
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Follows the current child, which Fabric can replace or remount while this view stays.
|
|
62
|
+
private func updateTouchHandler() {
|
|
63
|
+
if props.layoutRoot, let view = firstChildUIView {
|
|
64
|
+
touchHandler.attach(to: view)
|
|
65
|
+
} else {
|
|
66
|
+
touchHandler.detach()
|
|
67
|
+
}
|
|
50
68
|
}
|
|
51
69
|
|
|
52
70
|
@ViewBuilder
|
|
@@ -60,14 +78,6 @@ struct RNHostView: ExpoSwiftUI.View {
|
|
|
60
78
|
) {
|
|
61
79
|
Children()
|
|
62
80
|
}
|
|
63
|
-
.onAppear {
|
|
64
|
-
if props.layoutRoot {
|
|
65
|
-
touchHandler.attach(to: childUIView)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
.onDisappear {
|
|
69
|
-
touchHandler.detach()
|
|
70
|
-
}
|
|
71
81
|
} else if matchesContents {
|
|
72
82
|
// No hosted UIView (a pure SwiftUI child, e.g. Text/Image). Render it at its
|
|
73
83
|
// natural size instead of falling into the fill branch below, which would
|
|
@@ -82,14 +92,6 @@ struct RNHostView: ExpoSwiftUI.View {
|
|
|
82
92
|
Children()
|
|
83
93
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
84
94
|
.modifier(ReportSizeToYogaNodeModifier(shadowNodeProxy: props.shadowNodeProxy))
|
|
85
|
-
.onAppear {
|
|
86
|
-
if props.layoutRoot, let view = firstChildUIView {
|
|
87
|
-
touchHandler.attach(to: view)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
.onDisappear {
|
|
91
|
-
touchHandler.detach()
|
|
92
|
-
}
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
|
|
@@ -173,6 +175,7 @@ private final class RNHostTouchHandler: ObservableObject {
|
|
|
173
175
|
// An axis that is not matched fills the parent and reports its size to the Yoga node instead
|
|
174
176
|
private struct ApplySizeFromYogaNode<Content: SwiftUI.View>: SwiftUI.View {
|
|
175
177
|
@StateObject private var observer: Observer
|
|
178
|
+
let childUIView: UIView
|
|
176
179
|
let horizontal: Bool
|
|
177
180
|
let vertical: Bool
|
|
178
181
|
let shadowNodeProxy: ExpoSwiftUI.ShadowNodeProxy
|
|
@@ -186,6 +189,7 @@ private struct ApplySizeFromYogaNode<Content: SwiftUI.View>: SwiftUI.View {
|
|
|
186
189
|
@ViewBuilder content: () -> Content
|
|
187
190
|
) {
|
|
188
191
|
_observer = StateObject(wrappedValue: Observer(view: childUIView))
|
|
192
|
+
self.childUIView = childUIView
|
|
189
193
|
self.horizontal = horizontal
|
|
190
194
|
self.vertical = vertical
|
|
191
195
|
self.shadowNodeProxy = shadowNodeProxy
|
|
@@ -193,6 +197,14 @@ private struct ApplySizeFromYogaNode<Content: SwiftUI.View>: SwiftUI.View {
|
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
var body: some SwiftUI.View {
|
|
200
|
+
sizedContent
|
|
201
|
+
.onChange(of: childUIView) { newView in
|
|
202
|
+
observer.observe(newView)
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@ViewBuilder
|
|
207
|
+
private var sizedContent: some SwiftUI.View {
|
|
196
208
|
if horizontal && vertical {
|
|
197
209
|
content
|
|
198
210
|
.frame(width: observer.size.width, height: observer.size.height)
|
|
@@ -223,6 +235,12 @@ private struct ApplySizeFromYogaNode<Content: SwiftUI.View>: SwiftUI.View {
|
|
|
223
235
|
|
|
224
236
|
init(view: UIView) {
|
|
225
237
|
self.size = view.bounds.size
|
|
238
|
+
observe(view)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
func observe(_ view: UIView) {
|
|
242
|
+
kvoToken?.invalidate()
|
|
243
|
+
size = view.bounds.size
|
|
226
244
|
kvoToken = view.observe(\.bounds) { [weak self] view, _ in
|
|
227
245
|
MainActor.assumeIsolated {
|
|
228
246
|
self?.size = view.bounds.size
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3367880bd9dfec581496b8b5087f9ae0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a1628408f238e018286c0c9887ebb3cf9912577d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2487d657c68bf866e677ef379bc97b7de37edb41eb173b6d8d938b81bfcb2293
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6c228c1dcbe9ee23cca52ba20eb724d39d18533e6c31ad738ab5738e5dfc64432b7c79363f7ff772f019f8bda955d0d38ccb3f4331d3236e4beddd70e6e426f4
|
|
Binary file
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6b7272e2ff6f2f155c76a4e7a3341af6
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7acd625f3cd50ad228fac699424fcff3c77942bb
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
59cc7013ee6674f030b4f81641fa80fb1829815d6ab5a7903f0e7479e6adb96e
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha512
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0a89be2233ee1dd16b1cb671e0694d6d9a428f7f199e3e3efcdd621090c541d435478b39402a6da271373a70cbed690f989e938ebcbbcd35b740e1bf240dfb64
|