Skip to content

Commit c9ab84f

Browse files
maciejmakowski2003Maciej Makowski
andauthored
Fix/jsi and ts bugs (#244)
* feat: added host functions caching * refactor: removed unused components and moved common files to common example folders and format * fix: fixed metronome, removed unused files and moved common files * fix: back to previous version of hihat * fix: fixed start/stop mechanism bug --------- Co-authored-by: Maciej Makowski <maciej.makowski@swmansion.com>
1 parent 4847c82 commit c9ab84f

33 files changed

+429
-395
lines changed

apps/common-app/src/components/Step.tsx

Lines changed: 0 additions & 46 deletions
This file was deleted.

apps/common-app/src/components/Steps.tsx

Lines changed: 0 additions & 56 deletions
This file was deleted.

apps/common-app/src/components/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
export { default as Icon } from './Icon';
2-
export { default as Step } from './Step';
3-
export { default as Steps } from './Steps';
42
export { default as Button } from './Button';
53
export { default as Slider } from './Slider';
64
export { default as Spacer } from './Spacer';

apps/common-app/src/examples/DrumMachine/DrumMachine.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ import { LayoutChangeEvent, StyleSheet, View } from 'react-native';
66

77
import { colors } from '../../styles';
88
import { Select, Slider, Spacer, Container } from '../../components';
9-
import { Kick, Clap, HiHat } from '../SharedUtils';
9+
import Kick from '../../utils/soundEngines/Kick';
10+
import Clap from '../../utils/soundEngines/Clap';
11+
import HiHat from '../../utils/soundEngines/HiHat';
1012

11-
import { InstrumentName, Pattern, type XYWHRect } from './types';
13+
import { InstrumentName, Pattern, type XYWHRect } from '../../types';
1214
import { size, initialBpm } from './constants';
1315
import NotesHighlight from './NotesHighlight';
1416
import PatternShape from './PatternShape';
1517
import useGestures from './useGestures';
1618
import PlayButton from './PlayButton';
17-
import usePlayer from './usePlayer';
19+
import usePlayer from '../../utils/usePlayer';
1820
import presets from './presets';
21+
import { numBeats } from './constants';
1922
import Grid from './Grid';
2023

2124
const defaultPreset = 'Empty';
@@ -54,6 +57,7 @@ const DrumMachine: React.FC = () => {
5457
bpm,
5558
patterns,
5659
notesPerBeat: 2,
60+
numBeats,
5761
setup: setupPlayer,
5862
});
5963

apps/common-app/src/examples/DrumMachine/Grid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Line, Circle, Paint, vec } from '@shopify/react-native-skia';
55
import { colors } from '../../styles';
66
import { numBeats, cPoint, maxSize, buttonRadius } from './constants';
77
import { getAngle, getPointCX, getPointCY } from './utils';
8-
import type { Instrument } from './types';
8+
import type { Instrument } from '../../types';
99
import instruments from './instruments';
1010

1111
const points = Array(numBeats).fill(0);

apps/common-app/src/examples/DrumMachine/NotesHighlight.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { memo } from 'react';
22
import { Circle, Paint } from '@shopify/react-native-skia';
33
import { SharedValue, useDerivedValue } from 'react-native-reanimated';
44

5-
import { Instrument, PlayingInstruments } from './types';
5+
import { Instrument, PlayingInstruments } from '../../types';
66
import { cPoint, buttonRadius } from './constants';
77
import { getPointCX, getPointCY } from './utils';
88
import instruments from './instruments';

apps/common-app/src/examples/DrumMachine/PatternShape.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Circle, Paint, Path, vec, Skia } from '@shopify/react-native-skia';
33

44
import { getAngle, getPointCX, getPointCY } from './utils';
55
import instruments from './instruments';
6-
import type { Pattern } from './types';
6+
import type { Pattern } from '../../types';
77
import { buttonRadius, cPoint } from './constants';
88

99
interface PatternShapeProps {

apps/common-app/src/examples/DrumMachine/PlayButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Pressable, StyleSheet } from 'react-native';
88

99
import { Icon } from '../../components';
1010
import { colors } from '../../styles';
11-
import type { PlayingInstruments, XYWHRect } from './types';
11+
import type { PlayingInstruments, XYWHRect } from '../../types';
1212
import { size } from './constants';
1313

1414
interface PlayButtonProps {

apps/common-app/src/examples/DrumMachine/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Dimensions } from 'react-native';
2-
import type { InstrumentName, XYPoint } from './types';
2+
import type { InstrumentName, XYPoint } from '../../types';
33

44
export const screenSize = Dimensions.get('screen');
55
export const size = Math.min(screenSize.width, screenSize.height);

apps/common-app/src/examples/DrumMachine/instruments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { maxSize } from './constants';
2-
import type { Instrument } from './types';
2+
import type { Instrument } from '../../types';
33

44
export const HiHat: Instrument = {
55
name: 'hi-hat',

0 commit comments

Comments
 (0)