Skip to content

Commit

Permalink
Add new examples and update docs (#264)
Browse files Browse the repository at this point in the history
* add useAnimationDuration example

* added example for UseReanimatedAnimationBuilderScreen

* add switchListItem example

* update example

* fix ts type

* update folder name

* revert link to match src folder structure

* fix links

* Update to be platform specific

* updated description for useReanimatedAnimationBuilder screen

* updated example for SwitchListItem screen

---------

Co-authored-by: JDMathew <[email protected]>
  • Loading branch information
acharyakavita and JDMathew authored Oct 9, 2024
1 parent fce6630 commit 544bf32
Show file tree
Hide file tree
Showing 17 changed files with 501 additions and 22 deletions.
6 changes: 6 additions & 0 deletions examples/bare/ios/AMAExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = AMAExample/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "AMA Example";
Expand Down Expand Up @@ -498,6 +499,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = AMAExample/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "AMA Example";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -586,8 +588,10 @@
"-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
);
OTHER_LDFLAGS = "$(inherited) ";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
};
name = Debug;
};
Expand Down Expand Up @@ -652,8 +656,10 @@
"-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
);
OTHER_LDFLAGS = "$(inherited) ";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
36 changes: 36 additions & 0 deletions examples/bare/src/AppNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ import {
Header,
HomeScreen,
PressableScreen,
SwitchListItemScreen,
TextScreen,
TouchableOpacityScreen,
TouchableWithoutFeedbackScreen,
UseAMAContextScreen,
UseAnimationDurationScreen,
UseAnimationScreen,
UseReanimatedAnimationBuilderScreen,
UseReanimatedTimingScreen,
UseTimedActionScreen,
} from '@examples/shared-ui';
Expand Down Expand Up @@ -51,6 +54,16 @@ export const AppNavigator = () => {
headerTitle: () => <Header title={'Pressable Demo'} autofocus />,
}}
/>
<Stack.Screen
name="SwitchListItem"
component={SwitchListItemScreen}
options={{
headerLeft: () => <BackButton />,
headerTitle: () => (
<Header title={'Switch List Item Demo'} autofocus />
),
}}
/>
<Stack.Screen
name="TouchableOpacity"
component={TouchableOpacityScreen}
Expand Down Expand Up @@ -89,6 +102,16 @@ export const AppNavigator = () => {
),
}}
/>
<Stack.Screen
name="UseAnimationDuration"
component={UseAnimationDurationScreen}
options={{
headerLeft: () => <BackButton />,
headerTitle: () => (
<Header title={'Animation Duration Demo'} autofocus />
),
}}
/>
<Stack.Screen
name="UseReanimatedTiming"
component={UseReanimatedTimingScreen}
Expand All @@ -99,6 +122,16 @@ export const AppNavigator = () => {
),
}}
/>
<Stack.Screen
name="UseReanimatedAnimationBuilder"
component={UseReanimatedAnimationBuilderScreen}
options={{
headerLeft: () => <BackButton />,
headerTitle: () => (
<Header title={'Reanimated Animation Builder Demo'} autofocus />
),
}}
/>
<Stack.Screen
name="Form"
component={FormScreen}
Expand Down Expand Up @@ -192,7 +225,10 @@ type StackParamList = {
TouchableWithoutFeedback: undefined;
Text: undefined;
UseAnimation: undefined;
UseAnimationDuration: undefined;
UseReanimatedAnimationBuilder: undefined;
UseReanimatedTiming: undefined;
SwitchListItem: undefined;
Form: undefined;
FlatList: undefined;
ExpandablePressable: undefined;
Expand Down
3 changes: 3 additions & 0 deletions examples/bare/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export type RootStackParamList = {
TouchableWithoutFeedback: undefined;
Text: undefined;
UseAnimation: undefined;
UseAnimationDuration: undefined;
UseReanimatedAnimationBuilder: undefined;
UseReanimatedTiming: undefined;
Form: undefined;
FlatList: undefined;
Expand All @@ -14,4 +16,5 @@ export type RootStackParamList = {
BottomSheet: undefined;
UseTimedAction: undefined;
UseAMAContext: undefined;
SwitchListItem: undefined;
};
36 changes: 36 additions & 0 deletions examples/expo/src/AppNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ import {
Header,
HomeScreen,
PressableScreen,
SwitchListItemScreen,
TextScreen,
TouchableOpacityScreen,
TouchableWithoutFeedbackScreen,
UseAMAContextScreen,
UseAnimationDurationScreen,
UseAnimationScreen,
UseReanimatedAnimationBuilderScreen,
UseReanimatedTimingScreen,
UseTimedActionScreen,
} from '@examples/shared-ui';
Expand Down Expand Up @@ -51,6 +54,16 @@ export const AppNavigator = () => {
headerTitle: () => <Header title={'Pressable Demo'} autofocus />,
}}
/>
<Stack.Screen
name="SwitchListItem"
component={SwitchListItemScreen}
options={{
headerLeft: () => <BackButton />,
headerTitle: () => (
<Header title={'Switch List Item Demo'} autofocus />
),
}}
/>
<Stack.Screen
name="TouchableOpacity"
component={TouchableOpacityScreen}
Expand Down Expand Up @@ -89,6 +102,16 @@ export const AppNavigator = () => {
),
}}
/>
<Stack.Screen
name="UseAnimationDuration"
component={UseAnimationDurationScreen}
options={{
headerLeft: () => <BackButton />,
headerTitle: () => (
<Header title={'Animation Duration Demo'} autofocus />
),
}}
/>
<Stack.Screen
name="UseReanimatedTiming"
component={UseReanimatedTimingScreen}
Expand All @@ -99,6 +122,16 @@ export const AppNavigator = () => {
),
}}
/>
<Stack.Screen
name="UseReanimatedAnimationBuilder"
component={UseReanimatedAnimationBuilderScreen}
options={{
headerLeft: () => <BackButton />,
headerTitle: () => (
<Header title={'Reanimated Animation Builder Demo'} autofocus />
),
}}
/>
<Stack.Screen
name="Form"
component={FormScreen}
Expand Down Expand Up @@ -192,9 +225,12 @@ type StackParamList = {
TouchableWithoutFeedback: undefined;
Text: undefined;
UseAnimation: undefined;
UseAnimationDuration: undefined;
UseReanimatedTiming: undefined;
UseReanimatedAnimationBuilder: undefined;
Form: undefined;
FlatList: undefined;
SwitchListItem: undefined;
ExpandablePressable: undefined;
FlatListDynamic: undefined;
FlatListStatic: undefined;
Expand Down
3 changes: 3 additions & 0 deletions examples/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ export { TextScreen } from './src/screens/Text.screen';
export { TouchableOpacityScreen } from './src/screens/TouchableOpacity.screen';
export { TouchableWithoutFeedbackScreen } from './src/screens/TouchableWithoutFeedback.screen';
export { UseAMAContextScreen } from './src/screens/UseAMAContext.screen';
export { UseAnimationDurationScreen } from './src/screens/UseAnimationDurationScreen';
export { UseAnimationScreen } from './src/screens/UseAnimationScreen';
export { UseReanimatedAnimationBuilderScreen } from './src/screens/UseReanimatedAnimationBuilderScreen';
export { UseReanimatedTimingScreen } from './src/screens/UseReanimatedTimingScreen';
export { UseTimedActionScreen } from './src/screens/UseTimedAction.screen';
export { SwitchListItemScreen } from './src/screens/SwitchListItemScreen';

// other

Expand Down
15 changes: 15 additions & 0 deletions examples/shared/src/screens/Home.screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export const HomeScreen = ({ navigation }) => {
onPress={() => navigate('TouchableWithoutFeedback')}
/>
<Spacer height={'normal'} />
<CTAPressable
title="SwitchListItem"
onPress={() => navigate('SwitchListItem')}
/>
<Spacer height={'normal'} />
<CTAPressable
title="ExpandablePressable"
onPress={() => navigate('ExpandablePressable')}
Expand Down Expand Up @@ -57,6 +62,16 @@ export const HomeScreen = ({ navigation }) => {
onPress={() => navigate('UseAnimation')}
/>
<Spacer height={'normal'} />
<CTAPressable
title="useAnimationDuration"
onPress={() => navigate('UseAnimationDuration')}
/>
<Spacer height={'normal'} />
<CTAPressable
title="useReanimatedAnimationBuilder"
onPress={() => navigate('UseReanimatedAnimationBuilder')}
/>
<Spacer height={'normal'} />
<CTAPressable
title="useReanimatedTiming"
onPress={() => navigate('UseReanimatedTiming')}
Expand Down
Loading

0 comments on commit 544bf32

Please sign in to comment.