Skip to content

Commit 57dccde

Browse files
committed
📝 Make use of new styles in examples
1 parent cc34507 commit 57dccde

5 files changed

Lines changed: 23 additions & 5 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Works with Expo and bare React Native apps ✅
1313

1414
Includes iOS-style haptic and audio feedback 🍏
1515

16+
- [React Native Timer Picker ⏰🕰️⏳](#react-native-timer-picker-️)
1617
- [Demos 📱](#demos-)
1718
- [Installation 🚀](#installation-)
1819
- [Peer Dependencies 👶](#peer-dependencies-)
@@ -289,6 +290,9 @@ return (
289290
setIsVisible={setShowPicker}
290291
styles={{
291292
theme: "light",
293+
pickerColumnWidth: {
294+
hours: 90,
295+
},
292296
}}
293297
use12HourPicker
294298
visible={showPicker}
@@ -426,6 +430,8 @@ return (
426430
setIsVisible={setShowPicker}
427431
styles={{
428432
theme: "dark",
433+
pickerLabelGap: 10,
434+
text: { fontSize: 18 },
429435
}}
430436
visible={showPicker}
431437
/>

examples/example-bare/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ export default function App() {
173173
pickerFeedback={pickerFeedback}
174174
setIsVisible={setShowPickerExample2}
175175
styles={{
176+
pickerColumnWidth: {
177+
hours: 90,
178+
},
176179
theme: "light",
177180
}}
178181
use12HourPicker
@@ -217,6 +220,8 @@ export default function App() {
217220
pickerFeedback={pickerFeedback}
218221
setIsVisible={setShowPickerExample3}
219222
styles={{
223+
pickerLabelGap: 10,
224+
text: { fontSize: 18 },
220225
theme: "dark",
221226
}}
222227
visible={showPickerExample3}

examples/example-expo/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ export default function App() {
210210
}}
211211
pickerFeedback={pickerFeedback}
212212
setIsVisible={setShowPickerExample3}
213-
styles={{ theme: "dark" }}
213+
styles={{
214+
pickerLabelGap: 10,
215+
text: { fontWeight: "bold" },
216+
theme: "dark",
217+
}}
214218
visible={showPickerExample3}
215219
/>
216220
</View>

src/components/TimerPickerModal/TimerPickerModal.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ import Modal from "../Modal";
1414
import TimerPicker from "../TimerPicker";
1515
import type { TimerPickerRef } from "../TimerPicker";
1616
import type { PerColumnValue, PickerColumn } from "../TimerPicker/styles";
17-
import { generateStyles } from "./styles";
17+
import { DEFAULT_COLUMN_WIDTH, generateStyles } from "./styles";
1818
import type { TimerPickerModalRef, TimerPickerModalProps } from "./types";
1919

20-
const DEFAULT_COLUMN_WIDTH = 58;
21-
2220
const resolveColumnWidth = (
2321
pickerColumnWidth: PerColumnValue | undefined,
2422
column: PickerColumn

src/components/TimerPickerModal/styles.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import type { DimensionValue, TextStyle, ViewStyle } from "react-native";
33

44
import type { CustomTimerPickerStyles } from "../TimerPicker/styles";
55

6+
export const DEFAULT_COLUMN_WIDTH = 70;
7+
68
export interface CustomTimerPickerModalStyles extends CustomTimerPickerStyles {
79
button?: TextStyle;
810
buttonContainer?: ViewStyle;
@@ -39,7 +41,10 @@ export const generateStyles = (
3941
const totalColumnWidth = variables.totalColumnWidth;
4042
const modalPadding = (customContentContainerStyle?.paddingHorizontal as number) ?? 20;
4143
const labelOverhang = 20;
42-
const computedWidth = Math.max(116, totalColumnWidth + modalPadding * 2 + labelOverhang);
44+
const computedWidth = Math.max(
45+
DEFAULT_COLUMN_WIDTH * 2,
46+
totalColumnWidth + modalPadding * 2 + labelOverhang
47+
);
4348

4449
return StyleSheet.create({
4550
button: {

0 commit comments

Comments
 (0)