Skip to content

Commit

Permalink
Fix/jsi and ts bugs (#244)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
maciejmakowski2003 and Maciej Makowski authored Jan 7, 2025
1 parent 4847c82 commit c9ab84f
Show file tree
Hide file tree
Showing 33 changed files with 429 additions and 395 deletions.
46 changes: 0 additions & 46 deletions apps/common-app/src/components/Step.tsx

This file was deleted.

56 changes: 0 additions & 56 deletions apps/common-app/src/components/Steps.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions apps/common-app/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export { default as Icon } from './Icon';
export { default as Step } from './Step';
export { default as Steps } from './Steps';
export { default as Button } from './Button';
export { default as Slider } from './Slider';
export { default as Spacer } from './Spacer';
Expand Down
10 changes: 7 additions & 3 deletions apps/common-app/src/examples/DrumMachine/DrumMachine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ import { LayoutChangeEvent, StyleSheet, View } from 'react-native';

import { colors } from '../../styles';
import { Select, Slider, Spacer, Container } from '../../components';
import { Kick, Clap, HiHat } from '../SharedUtils';
import Kick from '../../utils/soundEngines/Kick';
import Clap from '../../utils/soundEngines/Clap';
import HiHat from '../../utils/soundEngines/HiHat';

import { InstrumentName, Pattern, type XYWHRect } from './types';
import { InstrumentName, Pattern, type XYWHRect } from '../../types';
import { size, initialBpm } from './constants';
import NotesHighlight from './NotesHighlight';
import PatternShape from './PatternShape';
import useGestures from './useGestures';
import PlayButton from './PlayButton';
import usePlayer from './usePlayer';
import usePlayer from '../../utils/usePlayer';
import presets from './presets';
import { numBeats } from './constants';
import Grid from './Grid';

const defaultPreset = 'Empty';
Expand Down Expand Up @@ -54,6 +57,7 @@ const DrumMachine: React.FC = () => {
bpm,
patterns,
notesPerBeat: 2,
numBeats,
setup: setupPlayer,
});

Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/examples/DrumMachine/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Line, Circle, Paint, vec } from '@shopify/react-native-skia';
import { colors } from '../../styles';
import { numBeats, cPoint, maxSize, buttonRadius } from './constants';
import { getAngle, getPointCX, getPointCY } from './utils';
import type { Instrument } from './types';
import type { Instrument } from '../../types';
import instruments from './instruments';

const points = Array(numBeats).fill(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { memo } from 'react';
import { Circle, Paint } from '@shopify/react-native-skia';
import { SharedValue, useDerivedValue } from 'react-native-reanimated';

import { Instrument, PlayingInstruments } from './types';
import { Instrument, PlayingInstruments } from '../../types';
import { cPoint, buttonRadius } from './constants';
import { getPointCX, getPointCY } from './utils';
import instruments from './instruments';
Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/examples/DrumMachine/PatternShape.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Circle, Paint, Path, vec, Skia } from '@shopify/react-native-skia';

import { getAngle, getPointCX, getPointCY } from './utils';
import instruments from './instruments';
import type { Pattern } from './types';
import type { Pattern } from '../../types';
import { buttonRadius, cPoint } from './constants';

interface PatternShapeProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/examples/DrumMachine/PlayButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Pressable, StyleSheet } from 'react-native';

import { Icon } from '../../components';
import { colors } from '../../styles';
import type { PlayingInstruments, XYWHRect } from './types';
import type { PlayingInstruments, XYWHRect } from '../../types';
import { size } from './constants';

interface PlayButtonProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/examples/DrumMachine/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dimensions } from 'react-native';
import type { InstrumentName, XYPoint } from './types';
import type { InstrumentName, XYPoint } from '../../types';

export const screenSize = Dimensions.get('screen');
export const size = Math.min(screenSize.width, screenSize.height);
Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/examples/DrumMachine/instruments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { maxSize } from './constants';
import type { Instrument } from './types';
import type { Instrument } from '../../types';

export const HiHat: Instrument = {
name: 'hi-hat',
Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/examples/DrumMachine/presets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Preset } from './types';
import type { Preset } from '../../types';
import { numBeats } from './constants';

const Empty: Preset = {
Expand Down
39 changes: 0 additions & 39 deletions apps/common-app/src/examples/DrumMachine/types.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/common-app/src/examples/DrumMachine/useGestures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

import { getAngle, getPointCX, getPointCY, isPointInCircle } from './utils';
import { numBeats, buttonRadius, cPoint } from './constants';
import type { Touché, XYWHRect } from './types';
import type { Touché, XYWHRect } from '../../types';
import Instruments from './instruments';
import { useMemo } from 'react';

Expand Down
Loading

0 comments on commit c9ab84f

Please sign in to comment.