Skip to content

Commit 1ff6288

Browse files
committed
💫 Updste: Ex - AppMetadataCard
1 parent 0b325d3 commit 1ff6288

File tree

3 files changed

+101
-2
lines changed

3 files changed

+101
-2
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/* eslint-disable react-native/no-inline-styles */
2+
/* eslint-disable react-hooks/exhaustive-deps */
3+
import * as React from 'react';
4+
import { StyleSheet } from 'react-native';
5+
6+
import * as LibraryPackageConfig from '../../../package.json';
7+
import * as ExamplePackageConfig from '../../package.json';
8+
import { IS_USING_NEW_ARCH } from '../constants/SharedEnv';
9+
10+
import { ExampleItemCard, ObjectPropertyDisplay, Colors } from 'react-native-ios-utilities';
11+
import type { ExampleItemProps } from '../examples/SharedExampleTypes';
12+
13+
14+
export function AppMetadataCard(props: ExampleItemProps) {
15+
16+
return (
17+
<ExampleItemCard
18+
style={props.style}
19+
index={props.index}
20+
title={'App Metadata'}
21+
>
22+
<ObjectPropertyDisplay
23+
recursiveStyle={styles.debugDisplayInner}
24+
object={{
25+
libraryName: LibraryPackageConfig.name,
26+
libraryVersion: LibraryPackageConfig.version,
27+
IS_USING_NEW_ARCH,
28+
exampleDependencies: ExamplePackageConfig.dependencies,
29+
}}
30+
/>
31+
</ExampleItemCard>
32+
);
33+
};
34+
35+
const styles = StyleSheet.create({
36+
detachedView: {
37+
},
38+
detachedContentContainer: {
39+
flex: 1,
40+
alignItems: 'center',
41+
justifyContent: 'center',
42+
},
43+
detachedContentContainerDetached: {
44+
},
45+
counterContainer: {
46+
alignItems: 'center',
47+
justifyContent: 'center',
48+
backgroundColor: 'rgba(255,255,255,0.3)',
49+
borderRadius: 10,
50+
marginTop: 12,
51+
paddingHorizontal: 15,
52+
paddingVertical: 15
53+
},
54+
counterContainerLarge: {
55+
flex: 1,
56+
alignSelf: 'stretch',
57+
marginHorizontal: 24,
58+
marginBottom: 32,
59+
marginTop: 52,
60+
borderRadius: 40,
61+
},
62+
counterLabel: {
63+
fontSize: 24,
64+
fontWeight: '900',
65+
color: 'rgba(0,0,0,0.5)',
66+
},
67+
counterLabelLarge: {
68+
fontSize: 64,
69+
},
70+
counterSubtitleLabel: {
71+
fontSize: 16,
72+
color: 'rgba(0,0,0,0.7)',
73+
fontWeight: '400',
74+
},
75+
counterSubtitleLabelAlt: {
76+
fontSize: 18,
77+
marginVertical: 4,
78+
fontWeight: '600',
79+
color: 'rgba(0,0,0,0.5)',
80+
},
81+
counterSubtitleLabelLarge: {
82+
fontSize: 32,
83+
},
84+
debugDisplayInner: {
85+
backgroundColor: `${Colors.PURPLE[200]}99`,
86+
},
87+
});

example/src/constants/ExampleCardItems.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { AppMetadataCard } from "../components/AppMetadataCard";
2+
13
import { ContextMenuViewExample01 } from "../examples/ContextMenuViewExample01";
24
import { ContextMenuViewExample02 } from "../examples/ContextMenuViewExample02";
35
import { ContextMenuViewExample03 } from "../examples/ContextMenuViewExample03";
@@ -363,5 +365,12 @@ export const EXAMPLE_ITEMS: Array<ExampleItem> = (() => {
363365
// items.splice(0, 0, ...[DebugControls]);
364366
// }
365367

366-
return [...screenItems, ...cardItems];
368+
return [
369+
{
370+
type: 'card',
371+
component: AppMetadataCard,
372+
},
373+
...screenItems,
374+
...cardItems
375+
];
367376
})();

example/src/constants/SharedEnv.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ export const SHARED_ENV = {
44
enableReactNavigation: true,
55
enableTabNavigation: false,
66
shouldSetAppBackground: false
7-
};
7+
};
8+
9+
export const IS_USING_NEW_ARCH =
10+
(global as any)?.nativeFabricUIManager != null;

0 commit comments

Comments
 (0)