Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
60cdb2d
copied from old pr
akwasniewski Dec 2, 2025
d8b1818
better svg
akwasniewski Dec 2, 2025
c5e855f
nested text
akwasniewski Dec 2, 2025
6bac695
feedback component
akwasniewski Dec 3, 2025
089ec64
Merge branch 'next' into @akwasniewski/examples
akwasniewski Dec 3, 2025
ebf8e61
simplify commons
akwasniewski Dec 8, 2025
6a18c4c
hover
akwasniewski Dec 8, 2025
911b7f5
colours
akwasniewski Dec 8, 2025
bef6b42
more consistent styling
akwasniewski Dec 8, 2025
21bbbfd
fix overlap feedback
akwasniewski Dec 8, 2025
20e13ba
fix feedback
akwasniewski Dec 8, 2025
f545956
fix svg
akwasniewski Dec 9, 2025
141a65c
delete redundant comments
akwasniewski Dec 9, 2025
2aa2e7e
Merge branch 'next' into @akwasniewski/examples
akwasniewski Dec 9, 2025
85ee8ad
reorganisation
akwasniewski Dec 11, 2025
f41079e
simple
akwasniewski Dec 11, 2025
f74dc1e
shared value
akwasniewski Dec 11, 2025
49ea4de
mouse buttons
akwasniewski Dec 11, 2025
712e748
stylus data
akwasniewski Dec 11, 2025
7086651
context menu
akwasniewski Dec 11, 2025
a9702fc
animated card
akwasniewski Dec 11, 2025
0524e0a
animated
akwasniewski Dec 12, 2025
9e2059e
common assets
akwasniewski Dec 12, 2025
47cac99
reorg
akwasniewski Dec 12, 2025
3e7d620
fix overlap
akwasniewski Dec 12, 2025
8e059c6
final styling
akwasniewski Dec 12, 2025
89b3c9b
Merge branch 'next' into @akwasniewski/examples
akwasniewski Dec 12, 2025
57969d8
Merge branch 'next' into @akwasniewski/examples
akwasniewski Dec 15, 2025
37b7261
Merge branch 'next' into @akwasniewski/examples
akwasniewski Dec 16, 2025
00067fc
Merge branch 'next' into @akwasniewski/examples
akwasniewski Dec 18, 2025
15490fb
hover effect
akwasniewski Dec 18, 2025
cab8a09
fix comment
akwasniewski Dec 18, 2025
68893ad
colors in animated example
akwasniewski Dec 18, 2025
6b70961
button feedback
akwasniewski Dec 18, 2025
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
493 changes: 164 additions & 329 deletions apps/common-app/App.tsx

Large diffs are not rendered by default.

146 changes: 144 additions & 2 deletions apps/common-app/src/common.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,60 @@
import React from 'react';
import { Text, StyleSheet, ViewStyle, StyleProp } from 'react-native';
import React, {
forwardRef,
useCallback,
useEffect,
useImperativeHandle,
useRef,
useState,
} from 'react';
import {
Text,
StyleSheet,
ViewStyle,
StyleProp,
View,
Platform,
} from 'react-native';
import Animated, {
Easing,
runOnJS,
useAnimatedStyle,
useSharedValue,
withTiming,
} from 'react-native-reanimated';

export interface Example {
name: string;
component: React.ComponentType;
unsupportedPlatforms?: Set<typeof Platform.OS>;
}

export interface ExamplesSection {
sectionTitle: string;
data: Example[];
}

const styles = StyleSheet.create({
lipsum: {
padding: 10,
},
info_container: {
padding: 16,
backgroundColor: '#F5F7FA',
borderRadius: 12,
marginVertical: 12,
borderWidth: 1,
borderColor: '#E2E8F0',
},
info_body: {
fontSize: 15,
lineHeight: 22,
color: '#4A5568',
},
feedback: {
marginTop: 20,
fontSize: 16,
fontWeight: '600',
},
});

type Props = {
Expand All @@ -25,9 +75,101 @@
}
}

interface InfoSectionProps {
description: string;
}

export function InfoSection({ description }: InfoSectionProps) {
return (
<View style={styles.info_container}>
<Text style={styles.info_body}>{description}</Text>
</View>
);
}

type FeedbackProps = {
duration?: number;
};

export type FeedbackHandle = {
showMessage: (message: string) => void;
};

export const Feedback = forwardRef<FeedbackHandle, FeedbackProps>(

Check warning on line 98 in apps/common-app/src/common.tsx

View workflow job for this annotation

GitHub Actions / check (apps/common-app)

In React 19, 'forwardRef' is no longer necessary. Pass 'ref' as a prop instead
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copying from linter:

In React 19, 'forwardRef' is no longer necessary. Pass 'ref' as a prop instead

({ duration = 1000 }, ref) => {
const [text, setText] = useState('Feedback');
const timerRef = useRef<number | null>(null);

const opacity = useSharedValue(0);

const animatedStyle = useAnimatedStyle(() => ({
opacity: opacity.value,
}));

const displayMessage = useCallback(
(message: string) => {
console.log(message);
if (timerRef.current) {
clearTimeout(timerRef.current);
}

setText(message);
opacity.value = withTiming(1, {
duration: 100,
easing: Easing.out(Easing.ease),
});

timerRef.current = setTimeout(() => {
opacity.value = withTiming(0, {
duration: 500,
easing: Easing.out(Easing.ease),
});
timerRef.current = null;
}, duration) as unknown as number;
},
[duration, opacity]
);

useImperativeHandle(ref, () => ({
showMessage: (message: string) => {
'worklet';
runOnJS(displayMessage)(message);
},
}));

useEffect(() => {
return () => {
if (timerRef.current) {
clearTimeout(timerRef.current);
}
};
}, []);

if (!text) {
return null;
}

return (
<Animated.Text style={[styles.feedback, animatedStyle]}>
{text}
</Animated.Text>
);
}
);

export const COLORS = {
offWhite: '#f8f9ff',
headerSeparator: '#eef0ff',
PURPLE: '#b58df1',
NAVY: '#001A72',
RED: '#A41623',
YELLOW: '#F2AF29',
GREEN: '#0F956F',
GRAY: '#ADB1C2',
KINDA_RED: '#FFB2AD',
KINDA_YELLOW: '#FFF096',
KINDA_GREEN: '#C4E7DB',
KINDA_BLUE: '#A0D5EF',
};

const LOREM_IPSUM = `
Expand Down
61 changes: 0 additions & 61 deletions apps/common-app/src/components/buttons/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
RotationGestureHandlerStateChangeEvent,
} from 'react-native-gesture-handler';

import { USE_NATIVE_DRIVER } from '../../config';
import { USE_NATIVE_DRIVER } from '../../../config';

class Snappable extends Component<PropsWithChildren<Record<string, unknown>>> {
private onGestureEvent?: (event: PanGestureHandlerGestureEvent) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
ScrollView,
} from 'react-native-gesture-handler';

import { USE_NATIVE_DRIVER } from '../../config';
import { LoremIpsum } from '../../common';
import { USE_NATIVE_DRIVER } from '../../../config';
import { LoremIpsum } from '../../../common';

type DraggableBoxProps = {
minDist?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ForceTouchGestureHandlerStateChangeEvent,
} from 'react-native-gesture-handler';

import { USE_NATIVE_DRIVER } from '../../config';
import { USE_NATIVE_DRIVER } from '../../../config';

export default class Example extends Component {
private force = new Animated.Value(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
TapGestureHandlerStateChangeEvent,
} from 'react-native-gesture-handler';

import { LoremIpsum } from '../../common';
import { LoremIpsum } from '../../../common';

interface PressBoxProps {
setDuration?: (duration: number) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { ScrollView } from 'react-native-gesture-handler';

import { DraggableBox } from '../draggable';
import { LoremIpsum } from '../../common';
import { LoremIpsum } from '../../../common';

const CIRCLE_SIZE = 80;

Expand Down
Loading
Loading