Skip to content

Commit 8f462c7

Browse files
committed
Add code higlighting
1 parent 8ec9344 commit 8f462c7

12 files changed

Lines changed: 32 additions & 10 deletions

packages/docs/docusaurus.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ const config: Config = {
2929
// GitHub pages deployment config.
3030
// If you aren't using GitHub pages, you don't need these.
3131
organizationName: 'MatiPl01', // Usually your GitHub org/user name.
32-
3332
plugins: [
3433
function webpackPlugin() {
3534
return {
3635
configureWebpack() {
3736
return {
37+
infrastructureLogging: {
38+
level: 'error'
39+
},
3840
mergeStrategy: {
3941
'resolve.extensions': 'prepend'
4042
},
@@ -73,7 +75,6 @@ const config: Config = {
7375
};
7476
}
7577
],
76-
7778
presets: [
7879
[
7980
'classic',

packages/docs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"private": true,
55
"scripts": {
66
"browserslist:update": "npx update-browserslist-db@latest",
7-
"docusaurus": "docusaurus",
8-
"start": "docusaurus start",
9-
"build": "docusaurus build",
7+
"docusaurus": "BROWSERSLIST_IGNORE_OLD_DATA=1 docusaurus",
8+
"start": "BROWSERSLIST_IGNORE_OLD_DATA=1 docusaurus start",
9+
"build": "BROWSERSLIST_IGNORE_OLD_DATA=1 docusaurus build",
1010
"swizzle": "docusaurus swizzle",
1111
"deploy": "docusaurus deploy",
1212
"clear": "docusaurus clear",

packages/docs/src/components/InteractiveExample/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useColorMode } from '@docusaurus/theme-common';
33
import CodeBlock from '@theme/CodeBlock';
44
import { clsx } from 'clsx';
55
import React, { useCallback, useEffect, useRef, useState } from 'react';
6+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
67

78
import styles from './styles.module.css';
89

@@ -280,11 +281,11 @@ export default function InteractiveExample({
280281
</div>
281282
}>
282283
{() => (
283-
<div className={styles.gestureHandlerRoot}>
284+
<GestureHandlerRootView className={styles.gestureHandlerRoot}>
284285
<React.Fragment key={key}>
285286
<Component />
286287
</React.Fragment>
287-
</div>
288+
</GestureHandlerRootView>
288289
)}
289290
</BrowserOnly>
290291
</div>

packages/docs/src/examples/AutoScroll.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Sortable from 'react-native-sortables';
66
const DATA = Array.from({ length: 30 }, (_, index) => `Item ${index + 1}`);
77

88
export default function AutoScrollExample() {
9+
// highlight-next-line
910
const scrollableRef = useAnimatedRef<Animated.ScrollView>();
1011

1112
const renderItem = useCallback(
@@ -20,6 +21,7 @@ export default function AutoScrollExample() {
2021
return (
2122
<Animated.ScrollView
2223
contentContainerStyle={styles.contentContainer}
24+
// highlight-next-line
2325
ref={scrollableRef}
2426
style={{
2527
height: 400 // Limit height to enable scrolling in demo
@@ -30,6 +32,7 @@ export default function AutoScrollExample() {
3032
data={DATA}
3133
renderItem={renderItem}
3234
rowGap={10}
35+
// highlight-next-line
3336
scrollableRef={scrollableRef} // required for auto scroll
3437
/>
3538
</Animated.ScrollView>

packages/docs/src/examples/CustomHandle.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ export default function CustomHandleExample() {
1010
<View style={styles.card}>
1111
<Text style={styles.text}>{item}</Text>
1212
{/* Wraps the handle component */}
13+
{/* highlight-next-line */}
1314
<Sortable.Handle>
1415
<View style={styles.handle}>
1516
<Text style={styles.handleText}>::</Text>
1617
</View>
18+
{/* highlight-next-line */}
1719
</Sortable.Handle>
1820
</View>
1921
),
@@ -29,6 +31,7 @@ export default function CustomHandleExample() {
2931
overDrag='vertical'
3032
renderItem={renderItem}
3133
rowGap={10}
34+
// highlight-next-line
3235
customHandle // must be set to use a custom handle
3336
/>
3437
</View>

packages/docs/src/examples/DifferentHeights.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const HEIGHTS = [120, 80, 150, 60, 100, 130, 90, 70, 110, 140, 50, 85];
99
export default function DifferentItemHeightsExample() {
1010
const renderItem = useCallback(
1111
({ index, item }: { item: string; index: number }) => (
12+
// highlight-next-line
1213
<View style={[styles.card, { height: HEIGHTS[index % HEIGHTS.length] }]}>
1314
<Text style={styles.text}>{item}</Text>
1415
</View>

packages/docs/src/examples/DropIndicatorCustomComponent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export default function DropIndicatorCustomComponentExample() {
8484

8585
return (
8686
<View style={styles.container}>
87+
// highlight-next-line
8788
<Sortable.Grid
8889
columnGap={10}
8990
columns={3}

packages/docs/src/examples/DropIndicatorCustomStyle.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default function DropIndicatorCustomStyleExample() {
1616

1717
return (
1818
<View style={styles.container}>
19+
// highlight-next-line
1920
<Sortable.Grid
2021
columnGap={10}
2122
columns={3}

packages/docs/src/examples/DropIndicatorDefault.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback } from 'react';
1+
import { useCallback } from 'react';
22
import { StyleSheet, Text, View } from 'react-native';
33
import Sortable from 'react-native-sortables';
44

@@ -22,6 +22,7 @@ export default function DropIndicatorDefaultExample() {
2222
data={DATA}
2323
renderItem={renderItem}
2424
rowGap={10}
25+
// highlight-next-line
2526
showDropIndicator
2627
/>
2728
</View>

packages/docs/src/examples/FixedItems.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import { StyleSheet, Text, View } from 'react-native';
33
import Sortable from 'react-native-sortables';
44

55
const DATA = Array.from({ length: 12 }, (_, index) => `Item ${index + 1}`);
6-
const FIXED_ITEMS = [DATA[0], DATA[7], DATA[11]];
6+
const FIXED_ITEMS = new Set([DATA[0], DATA[7], DATA[11]]);
77

88
export default function FixedItemsExample() {
99
const renderItem = useCallback(({ item }: { item: string }) => {
10-
const isFixed = FIXED_ITEMS.includes(item);
10+
const isFixed = FIXED_ITEMS.has(item);
11+
1112
return (
13+
// highlight-next-line
1214
<Sortable.Handle mode={isFixed ? 'fixed-order' : 'draggable'}>
1315
<View
1416
style={[
@@ -21,6 +23,7 @@ export default function FixedItemsExample() {
2123
]}>
2224
<Text style={styles.text}>{item}</Text>
2325
</View>
26+
{/* highlight-next-line */}
2427
</Sortable.Handle>
2528
);
2629
}, []);
@@ -33,6 +36,7 @@ export default function FixedItemsExample() {
3336
data={DATA}
3437
renderItem={renderItem}
3538
rowGap={10}
39+
// highlight-next-line
3640
customHandle
3741
/>
3842
</View>

0 commit comments

Comments
 (0)