diff --git a/examples/bare/index.js b/examples/bare/index.js index 1957efdd..ebf66c0f 100644 --- a/examples/bare/index.js +++ b/examples/bare/index.js @@ -1,7 +1,8 @@ import 'react-native-gesture-handler'; -import {AppRegistry} from 'react-native'; +import { AppRegistry } from 'react-native'; + +import { name as appName } from './app.json'; import App from './src/App'; -import {name as appName} from './app.json'; AppRegistry.registerComponent(appName, () => App); diff --git a/examples/bare/src/AppNavigator.tsx b/examples/bare/src/AppNavigator.tsx index bfe4eab8..c865c450 100644 --- a/examples/bare/src/AppNavigator.tsx +++ b/examples/bare/src/AppNavigator.tsx @@ -1,6 +1,7 @@ import { BackButton, BottomSheetScreen, + CarouselScreen, ExpandablePressableScreen, FlatListDynamicScreen, FlatListScreen, @@ -186,6 +187,14 @@ export const AppNavigator = () => { headerTitle: () =>
, }} /> + , + headerTitle: () =>
, + }} + /> - - - + + + + + + ); } diff --git a/examples/expo/index.js b/examples/expo/index.js index 1d6e981e..bca59af1 100644 --- a/examples/expo/index.js +++ b/examples/expo/index.js @@ -1,5 +1,7 @@ import { registerRootComponent } from 'expo'; +import 'react-native-gesture-handler'; + import App from './App'; // registerRootComponent calls AppRegistry.registerComponent('main', () => App); diff --git a/examples/expo/src/AppNavigation.tsx b/examples/expo/src/AppNavigation.tsx index 6ffeca6d..1f3bc124 100644 --- a/examples/expo/src/AppNavigation.tsx +++ b/examples/expo/src/AppNavigation.tsx @@ -1,6 +1,7 @@ import { BackButton, BottomSheetScreen, + CarouselScreen, ExpandablePressableScreen, FlatListDynamicScreen, FlatListScreen, @@ -186,6 +187,14 @@ export const AppNavigator = () => { headerTitle: () =>
, }} /> + , + headerTitle: () =>
, + }} + /> = ({ item }) => { + return ; +}; + +export const CarouselScreen = () => { + const ref = React.useRef>(null); + const { width } = useWindowDimensions(); + + const snapToOffsets = data.reduce((acc, _, index) => { + if (index === 0) { + return [...acc, 0]; + } else if (index === 1) { + return [ + ...acc, + IMAGE_WIDTH + 2 * ITEM_SEPARATOR_WIDTH - (width - IMAGE_WIDTH) / 2, + ]; + } else { + return [ + ...acc, + acc?.[acc.length - 1] + IMAGE_WIDTH + ITEM_SEPARATOR_WIDTH, + ]; + } + }, [] as number[]); + return ( + + + {`The Carousel above is fully accessible, use ${ + isAndroid ? 'TalkBack on Android' : 'VoiceOver on iOS' + } to interact with it.`} + + ); +}; + +const ItemSeparator: React.FC = () => ( + +); + +const styles = StyleSheet.create({ + wrapper: { + paddingHorizontal: theme.padding.big, + marginTop: theme.padding.big, + }, + image: { + width: IMAGE_WIDTH, + height: 300, + borderRadius: 6, + }, + text: { + marginTop: theme.padding.normal, + fontSize: theme.fontSize.normal, + textAlign: 'center', + }, +}); diff --git a/examples/shared/src/screens/Home.screen.tsx b/examples/shared/src/screens/Home.screen.tsx index 53d5d592..085a0292 100644 --- a/examples/shared/src/screens/Home.screen.tsx +++ b/examples/shared/src/screens/Home.screen.tsx @@ -53,6 +53,11 @@ export const HomeScreen = ({ navigation }) => { onPress={() => navigate('BottomSheet')} /> + {/**/} + + + navigate('Carousel')} /> + {/* */}
diff --git a/examples/shared/src/theme.ts b/examples/shared/src/theme.ts index 41c7ac07..92bb51e0 100644 --- a/examples/shared/src/theme.ts +++ b/examples/shared/src/theme.ts @@ -5,7 +5,8 @@ export const theme = { big: 24, }, fontSize: { - normal: 12, + small: 12, + normal: 15, medium: 18, big: 24, },