Skip to content

Commit

Permalink
Merge branch 'patch/v1.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
troberts-28 committed May 18, 2024
2 parents 0a50aa5 + b6aaf58 commit 8536205
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src/
tests/
node_modules/
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ This is currently only supported on Expo with the [expo-av](https://www.npmjs.co

**To enable audio feedback, you need to supply the imported `Audio` class as a prop to either TimerPickerModal or TimerPicker.**

Please note that the default click sound uses a hosted mp3 file. To make the click sound work offline, you need to supply your own
sound asset through the `clickSoundAsset` prop. You can download the default click sound [here](https://drive.google.com/uc?export=download&id=10e1YkbNsRh-vGx1jmS1Nntz8xzkBp4_I).

<br>

## Installation 🚀
Expand Down Expand Up @@ -246,6 +249,7 @@ return (
closeOnOverlayPress
use12HourPicker
Audio={Audio}
// supply your own custom click sound asset
clickSoundAsset={require("./assets/custom_click.mp3")}
LinearGradient={LinearGradient}
Haptics={Haptics}
Expand Down Expand Up @@ -396,7 +400,7 @@ return (
| LinearGradient | Linear Gradient Component | [expo-linear-gradient](https://www.npmjs.com/package/expo-linear-gradient).LinearGradient or [react-native-linear-gradient](https://www.npmjs.com/package/react-native-linear-gradient).default | - | false |
| Haptics | Haptics Namespace (required for Haptic feedback) | [expo-haptics](https://www.npmjs.com/package/expo-haptics) | - | false |
| Audio | Audio Class (required for audio feedback i.e. click sound) | [expo-av](https://www.npmjs.com/package/expo-av).Audio | - | false |
| clickSoundAsset | Custom sound asset for click sound | require(.../somefolderpath) or {uri: www.someurl} | - | false |
| clickSoundAsset | Custom sound asset for click sound (required for offline click sound - download default [here](https://drive.google.com/uc?export=download&id=10e1YkbNsRh-vGx1jmS1Nntz8xzkBp4_I)) | require(.../somefolderpath) or {uri: www.someurl} | - | false |
| pickerContainerProps | Props for the picker container | `React.ComponentProps<typeof View>` | - | false |
| pickerGradientOverlayProps | Props for both gradient overlays | `Partial<LinearGradientProps>` | - | false |
| topPickerGradientOverlayProps | Props for the top gradient overlay | `Partial<LinearGradientProps>` | - | false |
Expand Down
5 changes: 2 additions & 3 deletions example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import {
View,
useWindowDimensions,
} from "react-native";
import type {
NativeScrollEvent,
NativeSyntheticEvent} from "react-native";
import type { NativeScrollEvent, NativeSyntheticEvent } from "react-native";

import { TimerPicker, TimerPickerModal } from "../src";

Expand Down Expand Up @@ -205,6 +203,7 @@ export default function App() {
secondLabel=""
styles={{
theme: "dark",
backgroundColor: "#202020",
pickerItem: {
fontSize: 34,
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"url": "https://github.com/troberts-28"
},
"license": "MIT",
"version": "1.8.1",
"version": "1.8.2",
"main": "dist/commonjs/index.js",
"types": "dist/typescript/src/index.d.ts",
"scripts": {
Expand Down
Binary file removed src/assets/select_click.mp3
Binary file not shown.
7 changes: 5 additions & 2 deletions src/components/DurationScroll/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
const loadSound = async () => {
if (Audio) {
const { sound } = await Audio.Sound.createAsync(
clickSoundAsset ??
require("../../assets/select_click.mp3"),
clickSoundAsset ?? {
// use a hosted sound as a fallback (do not use local asset due to loader issues
// in some environments when including mp3 in library)
uri: "https://drive.google.com/uc?export=download&id=10e1YkbNsRh-vGx1jmS1Nntz8xzkBp4_I",
},
{ shouldPlay: false }
);
setClickSound(sound);
Expand Down

0 comments on commit 8536205

Please sign in to comment.